This example with the accompanying DTC Utilities library provides a method to monitor the lamp status of the J1939 DM1 messages which can then be used to drive the built in user LED's or any of the outputs for external alarm indication.
Not included in this example are parsing of individual SPN's, typically this is handled by a diagnostic display.
DM1 General Description
J1939 DM1 diagnostic trouble code (DTC) messages represent currently active faults that exist on a device such as an engine control module (ECM). The specification allows the message to be sent continually at a one second interval even if no fault is active (SPN=0, FMI=0). Special rules apply to sending the message immediately when there is a DTC state change so you can expect the message timing will not always be at one second intervals.
The message uses PGN 0xFECA and will contain the SPN describing the component that failed as well as the FMI code which describes the failure mode. Lamp status (red, amber, mil, protect) are also contained in the message along with the flash codes for each lamp.
The source address of the message is used to determine which devices sent the DTC.
The DM1 message may be transmitted individually as a standard J1939 DM1 message or in a BAM multipack message if there are many fault codes active at the same time.
See SAE Document J1939-73 section 5.7.1 for greater details.
Example Description
This example utilizes the J1939 DM1_Read function block that is included with Codesys.
Inputs to the function block include the source address of the device you wish to monitor.
The DTC & lamp information from the DM1_Read function block is not latched and only exists during the clock cycle in which the DM1 message was received so this information must be latched and processed. This is done by the DTC_Utilities library DM1_LampParser.
The output of the DM1_LampParser are a red and amber variable that represent the current state of the lamps (On/Off) including fast and slow flashing and can be used to directly drive the user LED's or any of the outputs.
All the code needed to setup the function blocks is found in the PLC_PRG POU. You must first install the DTC_Utilities library.
Comments
0 comments
Please sign in to leave a comment.