With printf support set to minimal the use of sprintf is limited to signed/unsigned integers (%d). In my case, it's necessary to support the display of data from a device in a range 0.00001 to 9999999.9. Passing a function a float is fine, and I can extract the integer from the decimal fraction portion and then perform the display output, but a problem arises when either value exceeds 65535. Therefore the following
sprintf(cNum,"%d",nIntegerValue);
is very limited.
I'd rather avoid full printf support (which I assume will some the problem using formatting for a long integer).
My LCD print function takes two parameters, an unsigned short from 0-9 and a position value 1-8 (the LCD is a simple display with 8 digits). So to display a float to the LCD I convert the integer and decimal portions to a string, then iterate through each string and output each character to the LCD print function.
Is there an efficient workaround or other suggested technique to provide for loading a character array with a long int value?
I suppose some division and modulus operations would do, but division is expensive.