CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

howto display a variable on LCD?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Bloobird0
Guest







howto display a variable on LCD?
PostPosted: Mon Jun 14, 2004 12:00 pm     Reply with quote

hello all, I use an LCD that works fine for displaying text (common LCD in 4 bit mode).

Nevertheless I would like to display a variable on it but I don't know how.

For example:
lcd_putc("\fTemperature: %i�C"); //test �cran LCD

where i is the variable to display (integer).

Can someone help me?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jun 14, 2004 12:15 pm     Reply with quote

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);
}
Bloobird0
Guest







PostPosted: Mon Jun 14, 2004 12:19 pm     Reply with quote

yesss, it works great!!

Thank you for this tip!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group