National Instruments 372139B-01 Automobile User Manual


 
Chapter 6 Automotive Diagnostic Command Set API for C
Automotive Diagnostic Command Set User Manual 6-24 ni.com
ndOBDOpen
Purpose
Opens a diagnostic session on a CAN port for OBD-II.
Format
long ndOBDOpen (
char CANInterface[],
unsigned long baudrate,
unsigned long transmitID,
unsigned long receiveID,
TD1 *diagRefOut);
Input
CANInterface
Specifies the CAN interface on which the diagnostic communication should take place.
The values are CAN0, CAN1, and so on.
baudrate
The diagnostic communication baud rate.
transmitID
The CAN identifier for sending diagnostic request messages from the host to the ECU.
Set to –1 (0xFFFFFFFF) for the default OBD CAN identifier.
receiveID
The CAN identifier for sending diagnostic response messages from the ECU to the host.
Set to –1 (0xFFFFFFFF) for the default OBD CAN identifier.
Output
diagRefOut
A struct containing all necessary information about the diagnostic session. This is
passed as a handle to all subsequent diagnostic functions, and you must close it using
ndCloseDiagnostic.
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.