Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4746

Detection of 1 wire device

$
0
0
I have a single 18B20 temp sensor and read the device using the code below

Code:

'Get and display the temperature
GIE = 0
OWOUT DQ, 1, [$CC, $44]                ' Start temperature conversion
OWOUT DQ, 1, [$CC, $BE]                ' Read the temperature
OWIN DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE]
GIE = 1
temperature = temperature */ 1600

lcdout $FE,$D4+0,"TEMP ",dec(temperature / 100),$DF,"C"

What I would like to do is detect if the sensor is connected or not, and if it's not present to simply display "N/C" in place of the temperature

Any suggestions

Viewing all articles
Browse latest Browse all 4746

Trending Articles