Hi Alain, it's now getting hot in here !
I found another example on the net and pasted that into a new program that included my know LCD working code. The only switch activated on the board is SW9-7 for backlight.
The display now reads:Code:temperature VAR WORD ' Temperature storage count_remain VAR BYTE ' Count remaining count_per_c VAR BYTE ' Count per degree C DQ VAR PORTA.5 ' One-wire data pin ' Define LCD registers and bits ;set PORTB as all output ANSEL = 0 ANSELH = 0 DEFINE OSC 20 DEFINE LCD_DREG PORTB DEFINE LCD_DBIT 0 DEFINE LCD_RSREG PORTB DEFINE LCD_RSBIT 4 DEFINE LCD_EREG PORTB DEFINE LCD_EBIT 5 DEFINE LCD_BITS 4 DEFINE LCD_LINES 2 DEFINE LCD_COMMANDUS 1000 DEFINE LCD_DATAUS 100 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
654.11 C
554.54 F
I'm just wondering if the DS device is faulty ?
I'll give your revised code a try later - I need a break !




Bookmarks