http://www.picbasic.co.uk/forum/cont...r-nine-of-themhttp://www.picbasic.co.uk/forum/cont...r-nine-of-themHi neo,
Below is a code snippet from my WIKI article on reading the DS18b20 temperature sensor...
you may find something usefull if you go look at that article.
NOTE: most of the code I borrowed from others and simply wrote the article for the WIKI.
Code:
ReadSensor:
OWOUT DQ, 1, [$55,str id\8,$44] 'instructs sensors to match[$55] this[ID] rom code and
'initiates[$44] temperature conversion on matching sensor
CkAgn:
OWIN DQ, 4, [busy] ' Check for still busy converting
IF busy = 0 THEN ckagn ' Still busy?, then loop
owout dq,1,[$55,str id\8,$BE] 'instructs sensors to match[$55] this[ID] and start sending back scratchpad[$BE]
OWIN DQ, 2, [Raw.LOWBYTE,Raw.HIGHBYTE]' Read two temperature bytes, then end communications
return
here is a link to the article...
http://www.picbasic.co.uk/forum/cont...r-nine-of-them
good luck
Bookmarks