LCDInfo.com http://forum.lcdinfo.com/ |
|
Display floating point and decimal numbers on LCD http://forum.lcdinfo.com/viewtopic.php?f=9&t=560 |
Page 1 of 1 |
Author: | CMOS [ Sat Mar 13, 2004 18:19 ] |
Post subject: | Display floating point and decimal numbers on LCD |
Can anyone please show me a sample C code to convert floating point and integer to BCD/ASCII? I want to display it on 16x2 alphanumeric LCD. For ex. I want to display "0.5" etc. on LCD which are in float data types. I am using SDCC compiler for 8051. However code for any compiler will do unless it is not using any in-built library functions. Thanks. |
Author: | Relampago [ Sat Mar 13, 2004 20:53 ] |
Post subject: | |
char buffer[255]; double/float yourvar; sprintf(buffer, "%d" , yourvar); buffer than consists your var as string for %d u can use the standard c conventions like %f %.2f and so on .... |
Author: | CMOS [ Sat Mar 13, 2004 21:12 ] |
Post subject: | |
Thanks. I'll try that out. |
Page 1 of 1 | All times are UTC + 2 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |