ok i will show u my code , this one is giving me 2 digits result on the LCD screen
but i want it to show the other 2 digits after a comma for precision ( for example
28.50 deg. )
and this is the source code:
---------------------------
program LCD_Temp1 ' thermometer with temp. range going
' from -9 deg. to + 55 deg.
dim rr as float
txt as char[5]
t as float
main:
ADCON0 = $55 ' %01010101
ADCON1 = $80
TRISD = $00
TRISA = $FF
LCD_INIT( PORTD)
LCD_CMD(LCD_CURSOR_OFF)
delay_ms(2000)
Lcd_cmd(Lcd_Clear)
Lcd_Out( 1,1,"temperature:")
Lcd_out( 2,10,"celsius")
while true
rr=ADC_read(2)
if (rr>250.0)and(rr<740.0)then ' the temp vs a2d curve is supposed lineaire
Lcd_Out(2,1,"+") ' when 250 < adc <740
t=(-0.108)*rr+80.0 ' +53 c --> 0 c
floattostr(t,txt)
lcd_out(2,2,txt)
delaY_ms(1000)
end if
if ( rr > 739.0) and ( rr < 800.0) then
Lcd_Out(2,1,"-")
t=(-0.138) *rr + 102.7 ' -0.1 c --> - 8.3 c
inttostr( t,txt)
lcd_out(2,2,txt)
delay_ms(1000)
end if
wend
end.