Supported platforms: CODESYS 2.3, CODESYS 3.5

 

J1939_SPNFMI_Convert (FUN)

Description

This function translates DTC message data from the four possible dialects to SPN/FMI pairs.

 

The dialect is given to the function as an input, but if the CM bit of the raw data is FALSE, the given dialect is overridden and the function uses dialect 4 instead.

 

Function is used when receiving J1939 device's DM log (e.g. DM1).

Limitations

This function can be run on every program cycle, but is suggested to be run only when the data is changed / received. The status of the PGN is 2, when the data is ready.

 

Inputs

Input variable name

Data type

Range

Description

i_SPNFMIConversionMethod

WORD

1..4

SPN/FMI pair conversion method according to J1939 specification

i_pDTC_Data

POINTER TO DWORD

-

Pointer to raw diagnostic trouble codes data

i_NumberOfDTC

BYTE

1..16

Number of diagnostic trouble codes to translate

i_pSPNFMI_Data

POINTER TO J1939_SPNFMI

-

Pointer to array where SPN/FMI codes are decoded to

Outputs

Data type

Range

Description

INT

-

Negative, when error

 

Example code

Application code example for converting DM1 log's DTCs to SPN-FMI values is included in Using J1939 topic.

 

See also

 

Source file Topic000443.htm

Last updated 24-Apr-2025