Display a Long on LCD

Question: How do I display a long variable on the LCD using the PSoC C-compiler?

 

Answer:

A long can be converted to ascii using the ltoa function and then displayed on an LCD using the LCD_PrString function.  An example code snippet is shown below.

#include <stdlib.h>

void main(void)
{
   long myLong = 134546;
   char OutputString[12];

   ltoa(OutputString, myLong, 10);
   LCD_Position(0,0);
   LCD_PrString(OutputString);

}

Details of the ltoa function may be found in the "C Language User Guide" under the Help >> Documentation menu in PSoC Designer