|
|
View previous topic :: View next topic |
Author |
Message |
zenjhen
Joined: 26 Sep 2003 Posts: 3 Location: Albuquerque
|
Printing counter (i) to LCD screen |
Posted: Sun Oct 12, 2003 9:37 am |
|
|
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
|
|
Posted: Sun Oct 12, 2003 10:58 am |
|
|
Use the sprintf() function to put the data into a string and output the string to your lcd. |
|
|
Guest
|
|
Posted: Sun Oct 12, 2003 12:58 pm |
|
|
thanks! |
|
|
Pete Smith
Joined: 17 Sep 2003 Posts: 55 Location: Chester, UK
|
Re: Printing counter (i) to LCD screen |
Posted: Mon Oct 13, 2003 12:51 am |
|
|
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?
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. |
|
|
|
|
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
|