1-Wire and interrupts don't get along very well together.
1-Wire has some pretty strict timing requirements, and interrupts like to mess that up.
You can get good readings, but you have to plan on bad data occasionally.
Which means verifying the CRC, and checking for all 0's in the packet. The CRC will pass (incorrectly) with all 0's
You can use the CRC routines from Tom Estes ... http://www.picbasic.co.uk/forum/showthread.php?t=1672
If the CRC fails, just go back and read the temperature again, no need to do another conversion.
That of course means you need to read the sensor as a Packet, instead of individual variables.
You also need to wait for the conversion to complete, either by PAUSE'ING the required amount of time, or polling the busy bit.
Currently, you are not waiting at all after a conversion command.
Bookmarks