|
|
View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 17, 2006 1:49 pm |
|
|
Use printf to convert to ASCII. Use the re-direction feature of the CCS
printf() function to send the output to your lcd driver. Example:
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()
{
float value;
lcd_init();
value = 1.243;
printf(lcd_putc, "%7.3f", value);
while(1);
}
|
|
|
|
croc4
Joined: 02 Sep 2005 Posts: 10
|
Thank you!!! |
Posted: Fri Mar 17, 2006 2:11 pm |
|
|
Thanks, the printf, did the trick. I didn't know you could do that, I have a lot to learn.
Thanks again,
Croc4 |
|
|
gs
Joined: 22 Aug 2005 Posts: 30 Location: Ioannina - Greece
|
|
Posted: Sat Mar 18, 2006 7:52 pm |
|
|
You could also multiply with 1000 and print the result as 1000's,".",100's,10's,1's
If you want to avoid use of floats you could modify the calculations this way. _________________ www.hlektronika.gr |
|
|
|
|
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
|