National Instruments CAN 372139B-01 User Manual

Page 287

Advertising
background image

Chapter 6

Automotive Diagnostic Command Set API for C

© National Instruments Corporation

6-123

Automotive Diagnostic Command Set User Manual

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

6

testNotCompletedThisMonitoringCycle

7

warningIndicatorRequested

For OBD, this field usually does not contain valid information.

AddData

contains optional additional data for this DTC. Usually, this does not

contain valid information (refer to

DTCDescriptor

).

len

On input,

len

must contain the

DTCs

array length in elements. On return, it contains the

number of valid elements in the

DTCs

array.

success

Indicates successful receipt of a positive response message for this diagnostic service.

Return Value

The return value indicates the function call status as a signed 32-bit integer. Zero means the
function executed successfully. A negative value specifies an error, which means the function
did not perform the expected behavior. A positive value specifies a warning, which means the
function performed as expected, but a condition arose that may require attention.

Use the

ndStatusToString

function to obtain a descriptive string for the return value.

Advertising