PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 14, 2004 12:15 pm |
|
|
Quote: | I would like to display a variable on it but I don't know how | Use the special CCS feature, which allows the output of printf()
to be re-directed to another function. In the example below,
the output of printf is sent to the lcd_putc() function.
The printf function converts the variable 'temperature' into
ASCII characters, so it can be displayed on your LCD.
Code: | #include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#include <lcd.c>
//=============================================
void main()
{
signed char temperature;
temperature = -40;
printf(lcd_putc, "\fTemperature: %d", temperature );
while(1);
} |
|
|