Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 6th January 2008, 06:34 PM   (permalink)
Default Floating value on LCD

Hi friends,
I'm doing programming in Hitech C, my uC is PIC16F877A & displaying on 16x2 LCD I'm trying to display a integer value on above line & floating value on lower line of lcd using the following commands, the integer value is comming but the floating value isn't comming instead it's showing ' f ' on LCD

lcd_goto(0x80);
x_int=314;
sprintf (buf, "%d", x_int);
lcd_puts(buf);

lcd_goto(0xC0);
y_float=11.22;
sprintf (buf, "%f", y_float);
lcd_puts(buf);

a similar thing i had done with keil C51 & At89c52 it was working properly.

Can you please guide me.....

With best regards,
Neelam
neelam29 is offline  
Old 6th January 2008, 07:15 PM   (permalink)
Default

Are you sure that the compiler and the library function can even dispaly a floating point number?
__________________
We never have time to do it right; but we always have time to do it over.
Papabravo is offline  
Old 6th January 2008, 07:22 PM   (permalink)
Default

Try sending the integer and the float to the same location but separated by time. This will rule out address overflowing.

Does lcd_goto() use the actual command for the address or the hex address itself? For instance, 0x80 is the command code to position at address 0x00. Your lcd_goto() seems to operating more like lcd_command(). lcd_goto(0x00) for first line and lcd_goto(0x40) for second line makes more sense.
donniedj is offline  
Old 6th January 2008, 08:07 PM   (permalink)
Default

Are you compiling with the -LF option? I believe that the standard library, 96LIBC.LIB, contains versions of sprintf and printf that do not support floating point.
You need to make the compiler use the 96LIBF.LIB instead.
__________________
--- The days of the digital watch are numbered. ---
kchriste is offline  
Old 6th January 2008, 10:00 PM   (permalink)
Default

Thanks a lot kchriste. Your method worked out. Thanks once again to all of you.

With best regards,
Neelam
neelam29 is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
LCD 2x16 Demo for the Unicorn (18F4550) blueroomelectronics Micro Controllers 21 31st October 2008 05:17 PM
Substituting a 16x2 LCD display for 16x1 LCD display? Dawny Electronic Projects Design/Ideas/Reviews 19 11th October 2008 09:58 AM
HD44780 LCD operation ssylee Micro Controllers 25 15th December 2007 01:52 AM
PIC16F628A LCD problems. HerbertMunch Micro Controllers 17 2nd October 2007 10:20 AM
Newbie needs help with LCD backlight dimming Mongoose General Electronics Chat 6 22nd September 2007 12:23 AM



All times are GMT. The time now is 02:33 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker