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 support@ccsinfo.com

Special characters on an LCD

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



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

Special characters on an LCD
PostPosted: Wed Aug 11, 2010 11:24 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 11, 2010 11:59 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 11, 2010 12:00 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 14, 2010 12:09 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 14, 2010 12:48 pm     Reply with quote

Simply use standard C format specifier syntax: "%lu:%02u"
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Sat Aug 14, 2010 12:52 pm     Reply with quote

thanks, I knew there was a simple way.
Ringo
_________________
Ringo Davis
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