Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Floating value on LCD

Status
Not open for further replies.

neelam29

New Member
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
 
Are you sure that the compiler and the library function can even dispaly a floating point number?
 
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.
 
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.
 
Thanks a lot kchriste. Your method worked out. Thanks once again to all of you.

With best regards,
Neelam
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top