µTasker String Output Functions Overview

The µTasker project includes several string output functions which are useful for sending strings to a debug output (generally a serial debug output, USB or TELNET). They also allow a convenient way of converting hexadecimal or decimal values between ASCII representation and binary, plus some additional formatting options which are often used in embedded designs.

The µTasker routines allows projects to operate without the need for typical library support like printf() which tends to cause project-bloat due to its usually extensive formatting support. The function specific descriptions explain the functions available and give examples of how they are typically used to allow efficient conversion and output for many applications where printf() compatibility and capabilities are not justified.

Differences between V1.3 and V1.4 routines

The µTasker V1.4 project introduced some changes in the string formatting routines which improve consistence in their use. This resulted in some potential incompatibilities in application code which needs to be discussed in case pre-V1.4 projects are to be moved to the V1.4 version.

The first point to note is that the V1.4 demo project application code only uses the new style (the V1.4 demo application must be compiled with the following define active), but all non-application code supports both uses. This is controlled in types.h by the define:
#define STRING_OPTIMISATION // activate to optimise return pointers from string output functions

Existing pre-V1.4 application code can continue using the original style as long as this define is disabled. However it is generally recommended that the application is adapted to make use of the improved routines since this is not a difficult modification.

The following compares the routines, whereby the changes required to make existing code compatible to V1.4 code are also noted.

V1.3

V1.4

Changes

QUEUE_TRANSFER fnDebugMsg (CHAR *ucToSend);

QUEUE_TRANSFER fnDebugMsg (CHAR *ucToSend);

No changes

unsigned long fnHexStrHex(CHAR *ucNewAdd);

unsigned long fnHexStrHex(CHAR *ucNewAdd);

No changes

unsigned long fnDecStrHex(CHAR *ucNewAdd

unsigned long fnDecStrHex(CHAR *ucNewAdd

No changes

CHAR *fnBufferHex(unsigned long ulValue, unsigned char uLen, CHAR *pBuf);

CHAR *fnBufferHex(unsigned long ulValue, unsigned char uLen, CHAR *pBuf);

No changes to conversion but the returned pointer is set to the null-terminator and not one after it*

extern void fnDebugHex(unsigned long ulValue, unsigned char ucLen);

extern void fnDebugHex(unsigned long ulValue, unsigned char ucLen);

No changes

CHAR *fnDebugDec(signed long slNumberToConvert, unsigned char ucStyle, CHAR *ptrBuf);

void fnDebugDec(signed long slNumberToConvert, unsigned char ucStyle);

Used to send exclusively over the debug output and not to an optional buffer

-

CHAR *fnBufferDec(signed long slNumberToConvert, unsigned char ucStyle, CHAR *ptrBuf);

New to format a value as ASCII decimal in a buffer

*For completeness it is mentioned here that uStrcpy() also returns a pointer to the NULL terminator instead of one position afterwards when STRING_OPTIMISATION is used.

The function descriptions discuss the V1.4 use only.

Last document update: 12.9.2009