void fnDebugDec(
signed long slNumberToConvert,
unsigned char ucStyle);
slNumberToConvert is a signed long value to be sent as an ASCII decimal string over the present debug output.
The conversion style is defined by
ucStyle, which can be a mixture of following flags:
- DISPLAY_NEGATIVE - slNumberToConvert is handled as a signed number and displayed negative if appropriate
- LEADING_ZERO - the output string starts with a zero, which is useful when displaying time formats (eg. 12:04:07 in stead of 12:4:7)
- LEADING_SPACE - ensure display of time with 2 digits - space as filler
- WITH_SPACE - the output string starts with a space
- WITH_TERMINATOR (default)
- NO_TERMINATOR - the resulting string is without a NULL-terminator
- WITH_CR_LF - '\r\n' is added at the end of the string
Examples
fnDebugDec(-125000, (DISPLAY_NEGATIVE));
fnDebugDec(125000, (LEADING_SPACE | WITH_CR_LF));
Resulting string sent to the debug output = "-125000 125000\r\n"
Example of formating time output
extern void fnPrintUpTime(void)
{
unsigned long ulUpTimeSecs = (uTaskerSystemTick / SEC);
unsigned long ulUpTime = ulUpTimeSecs /60/60/24; // the up time in days
fnDebugDec(ulUpTime, 0);
fnDebugMsg("Days");
ulUpTimeSecs -= (ulUpTime * 60*60*24); // minus the days
ulUpTime = (ulUpTimeSecs / (60*60)); // the UP time in hours
fnBufferDec(ulUpTime, LEADING_SPACE);
fnDebugMsg(":");
ulUpTimeSecs -= (ulUpTime * 60*60); // minus the hours
ulUpTime = (ulUpTimeSecs / (60)); // the UP time in minutes
fnDebugDec(ulUpTime, LEADING_ZERO);
fnDebugMsg(":");
ulUpTimeSecs -= (ulUpTime * 60); // minus the minutes
fnDebugDec(ulUpTimeSecs, (LEADING_ZERO | WITH_CR_LF));
}
Related functions
fnBufferDec();
fnDebugHex();
fnHexStrHex();
fnDecStrHex();
Please use the
µTasker forum to ask specific questions.