display numbers on lcd

Thread Starter

h.d

Joined Oct 22, 2007
150
hi for all
am work in PIC and want to display numbers on LCD
the numbers have fraction(3.1)like that
how can i display it un lcd (how to write the program)
i try it as float then cinvert to string the result is like (3.099999)
i need (3.1)
am programming by mBASIC.
thanks
 

beenthere

Joined Apr 20, 2004
15,819
Coming up with 3.099999 instead of 3.1 is due to a rounding error. You may need to write some extra code to evaluate math results and round the decimal results up befor converting to ASCII.
 

Thread Starter

h.d

Joined Oct 22, 2007
150
no am write like that
a=3.1
floattostr(a,a1)
lcd_out(1,1,a1)

so no need for rounding
and the problem that i need to display only one digit after comma not 5 digits.
 
Top