void fnDebugHex(
unsigned long ulValue,
unsigned char uLen);
ulValue is an unsigned long value to be sent as an ASCII HEX string to the present debug output.
The conversion style is defined by
uLen, which can be a mixture of following flags:
- WITH_LEADIN - the output string begins with the hex lead-in "0x"
- NO_LEADIN - default
- WITH_TERMINATOR (default)
- NO_TERMINATOR - the resulting string is without a NULL-terminator
- CODE_CAPITALS - the ASCILL hex output uses capital letters to display A..F
- CODE_SMALL - (default) the ASCILL hex output uses small letters to display a..f
- WITH_SPACE - insert a space at the beginning of the string
- WITH_CR_LF - '\r\n' is added at the end of the string
The length of the hexadecimal input is also included in the ucStyle parameter, with valid values of 1, 2 or 4 (the number of bytes in the value).
Examples
Example of displaying a MAC address in formatted hex at the debug output
// Convert a MAC address to a string
//
extern void fnMACStr(unsigned char *ptrMAC)
{
int i = MAC_LENGTH;
while (--i) {
fnDebugHex(*ptrMAC++, (unsigned char)(1 | NO_LEADIN | NO_TERMINATOR));
fnDebugMsg('-');
}
fnDebugHex(*ptrMAC++, (unsigned char)(1 | NO_LEADIN | WITH_TERMINATOR));
}
Related functions
fnDebugDec();
fnBufferHex();
fnHexStrHex();
fnDecStrHex();
Please use the
µTasker forum to ask specific questions.