View previous topic :: View next topic |
Author |
Message |
Ringo42
Joined: 07 May 2004 Posts: 263
|
Special characters on an LCD |
Posted: Wed Aug 11, 2010 11:24 am |
|
|
I'm using the Flex_lcd driver. I would like to use the "degree" symbol for temperature. According to the LCD data sheet that character is a Decimal 223. How do I pass this to the Flex_lcd driver to get it to display?
I'm using Version 4.085 in case it matters.
Thanks
Ringo _________________ Ringo Davis |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Aug 11, 2010 11:59 am |
|
|
You can extend lcd_putc() by code to map certain characters, e.g.:
Code: | case '°':
lcd_send_byte(1,223);
break; |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 11, 2010 12:00 pm |
|
|
You can use lcd_putc() with the decimal code, or use printf with
the "\xnn" escape sequence, where 'nn' is the hex code for the char.
Or use custom chars, to get a better looking degrees symbol:
http://www.ccsinfo.com/forum/viewtopic.php?t=40565 |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Sat Aug 14, 2010 12:09 pm |
|
|
That works perfectly.
I'm trying to print the time (minutes and seconds) like this
printf(lcd_putc" %ld:%2d\n",TotalMinutes,Seconds);
but I get something like
1: 1
instead of
1:01
How do I make it print the '0'? Is there an easy way or do I have to treat single digits as a special case and print the 0 then the digit?
Thanks
Ringo _________________ Ringo Davis |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sat Aug 14, 2010 12:48 pm |
|
|
Simply use standard C format specifier syntax: "%lu:%02u" |
|
|
Ringo42
Joined: 07 May 2004 Posts: 263
|
|
Posted: Sat Aug 14, 2010 12:52 pm |
|
|
thanks, I knew there was a simple way.
Ringo _________________ Ringo Davis |
|
|
|