Output – National Instruments CAN 372139B-01 User Manual

Page 213

Advertising
background image

Chapter 6

Automotive Diagnostic Command Set API for C

© National Instruments Corporation

6-49

Automotive Diagnostic Command Set User Manual

DTCDescriptor

A struct that describes the DTC records the ECU delivers:

typedef struct {

long DTCByteLength;

long StatusByteLength;

long AddDataByteLength;

unsigned short ByteOrder;

} TD3;

DTCByteLength

indicates the number of bytes the ECU sends for each DTC. The

default is 2.

StatusByteLength

indicates the number of bytes the ECU sends for each DTC’s

status. The default is 1.

AddDataByteLength

indicates the number of bytes the ECU sends for each DTC’s

additional data. Usually, there are no additional data, so the default is 0.

ByteOrder

indicates the byte ordering for multibyte items:

0: MSB_FIRST (Motorola) , default

1: LSB_FIRST (Intel)

This function interprets the response byte stream according to this description and
returns the resulting DTC records in the

DTCs

struct array.

Output

DTCs

Returns the resulting DTCs as an array of structs:

typedef struct {

unsigned long DTC;

unsigned long Status;

unsigned long AddData;

} TD4;

DTC

is the resulting Diagnostic Trouble Code. For the default 2-byte DTCs, use

ndDTCToString

to convert this code to readable format as defined by SAE J2012.

Status

is the DTC status. Usually, this is a bit field with following meaning:

Bit

Meaning

0

testFailed

1

testFailedThisMonitoringCycle

2

pendingDTC

3

confirmedDTC

4

testNotCompletedSinceLastClear

5

testFailedSinceLastClear

Advertising