ndDTCToString
- Updated2025-10-07
- 1 minute(s) read
Purpose
Returns a string representation (such as P1234) for a 2-byte diagnostic trouble code (DTC)
Format
void ndDTCToString(
unsigned long DTCNum,
char DTCString[],
long *len);
Input
DTCNum
The DTC number as returned in the DTCs structs of ndReadDTCByStatus, ndReadStatusOfDTC, ndUDSReportDTCBySeverityMaskRecord, ndUDSReportDTCByStatusMask, ndUDSReportSeverityInformationOfDTC, ndUDSReportSupportedDTCs, ndOBDRequestEmissionRelatedDTCs, or ndOBDRequestEmissionRelatedDTCsDuringCurrentDriveCycle.
Note
  This function converts only 2-byte DTCs. If you feed in larger numbers, the function returns garbage.
Output
DTCString
The DTC string representation.
len
On input, len must contain the DTCString array length (at least 6). On return, it contains the number of valid data bytes in the DTCString array. Description
The SAE J2012 standard specifies a naming scheme for 2-byte DTCs consisting of one letter and four digits. Use ndDTCToString to convert the DTC numerical representation to this name.