Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Displaying a long variable on LCD

Displaying a long variable on LCD

Anonymous
Not applicable

How to display a long variable on the LCD using the PSoC C-compiler?

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.

 

Translation - Japanese: LCDにLongを表示する - Community Translated (JA)

0 Likes
659 Views