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

Printing counter (i) to LCD screen

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



Joined: 26 Sep 2003
Posts: 3
Location: Albuquerque

View user's profile Send private message Yahoo Messenger

Printing counter (i) to LCD screen
PostPosted: Sun Oct 12, 2003 9:37 am     Reply with quote

i got the lcd_putc working finally, but for my project i need to be able to do more than just that. as an example,


int16 i

for (i=1;i<=100;i++){

lcd_putc( "\fSending data to LCD.\n Here is data: ");
lcd_putc(i);
}
now i've tried many varitations on this theme, lcd_putc does not support the %lu printf stuff. what i get is a single hex character that gets printed out and incremented each loop.

what i need is a hex to ascii converter, and i'm suprised that there is not one already built in. seems like i cant be the only one that needs this sort of subroutine.

any help would be really appreciated, even if it is just a suggestion for an algorithm....

stuck on i
jhen
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sun Oct 12, 2003 10:58 am     Reply with quote

Use the sprintf() function to put the data into a string and output the string to your lcd.
Guest








PostPosted: Sun Oct 12, 2003 12:58 pm     Reply with quote

thanks!
Pete Smith



Joined: 17 Sep 2003
Posts: 55
Location: Chester, UK

View user's profile Send private message Visit poster's website MSN Messenger ICQ Number

Re: Printing counter (i) to LCD screen
PostPosted: Mon Oct 13, 2003 12:51 am     Reply with quote

zenjhen wrote:
i got the lcd_putc working finally, but for my project i need to be able to do more than just that. as an example,


int16 i

for (i=1;i<=100;i++){

lcd_putc( "\fSending data to LCD.\n Here is data: ");
lcd_putc(i);
}
now i've tried many varitations on this theme, lcd_putc does not support the %lu printf stuff. what i get is a single hex character that gets printed out and incremented each loop.

what i need is a hex to ascii converter, and i'm suprised that there is not one already built in. seems like i cant be the only one that needs this sort of subroutine.

any help would be really appreciated, even if it is just a suggestion for an algorithm....

stuck on i
jhen


RTFM? Very Happy

printf(lcd_putc,"Hello World %02X %08lu %04.4f\n",num1,num2,num3);

should work quite nicely. It uses printf, but passes each char in turn to lcd_putc.

Page 126 on the current manual and EX_LCDTH.C will give you some quick pointers.

HTH

Pete.
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