Hello.
Now i have connected the LCD as PBP defaults and when i run the PIC with this code the display shown the temerature for 1sec and then it shows "fffffffffffffffffffffff" on both lines for a sec and then shows the temerature again and so on...
Why?
Code:' One-wire temperature for LAB-X1 and DS1820 define OSC 20 DEFINE LCD_COMMANDUS 2000 DEFINE LCD_DATAUS 600 temperature Var Word ' Temperature storage count_remain Var Byte ' Count remaining count_per_c Var Byte ' Count per degree C pause 1000 DQ Var PORTB.2 ' One-wire data pin ADCON1 = 7 ' Set PORTA and PORTE to digital mainloop: OWOut DQ, 1, [$CC, $44] ' Start temperature conversion waitloop: OWIn DQ, 4, [count_remain] ' Check for still busy converting If count_remain = 0 Then waitloop OWOut DQ, 1, [$CC, $BE] ' Read the temperature OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c] ' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature) temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c) Lcdout $fe, 1, DEC (temperature / 100), ".", DEC2 temperature, " C" ' Calculate temperature in degrees F to 2 decimal places (not valid for negative temperature) temperature = (temperature */ 461) + 3200 Lcdout $fe, $c0, DEC (temperature / 100), ".", DEC2 temperature, " F" Pause 1000 ' Display about once a second Goto mainloop ' Do it forever




Bookmarks