The DS1820 takes 750 ms to do a conversion.
In this section here, you have the interrupts turned off the whole time while waiting 3/4 of a second for it to finish. Missing a few (75) interrupts.
Code:
Update_The_Temperature:
INTCON.7 = 0 ' Disables all interrupts
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]
'Gosub StartTimer
INTCON.7 = 1 ' Enables all unmasked interrupts
RETURN
Since you have the Elapsed timer going, maybe you could send the convert command, then go back 1 second later and read the results. "Quickly"
<br>
Bookmarks