Dave Carroll
New Member
Hi, Can anyone explain a problem I am seeing with the 28x1 internal timer, set for 4Mhz operation and using the 1sec interval variable. This works fine until I include a "readtemp" or "readtemp12" command to read a DS18B20 temperature sensor.....the timer appears to slow down. I am using 4 sensors in my application and find that the impact on the timer gets worse the more "readtemp" commands I execute. See the following code:
symbol x = b1
symbol hwc_hi_temperature = w11
symbol hwc_hi_sensor_pin = 5
x= 44
hwc_hi_temperature=0
settimer t1s_4 'settimer to 1 second ticks at 4MHz
go_again:
high 7
pause 700
if timer > 60 then gosub fast_flash
low 7
readtemp hwc_hi_sensor_pin,hwc_hi_temperature
pause 400
goto go_again
fast_flash:
for x = 0 to 20
high 7
pause 100
low 7
pause 80
next x
timer = 0
return
I look forward to hearing from you
symbol x = b1
symbol hwc_hi_temperature = w11
symbol hwc_hi_sensor_pin = 5
x= 44
hwc_hi_temperature=0
settimer t1s_4 'settimer to 1 second ticks at 4MHz
go_again:
high 7
pause 700
if timer > 60 then gosub fast_flash
low 7
readtemp hwc_hi_sensor_pin,hwc_hi_temperature
pause 400
goto go_again
fast_flash:
for x = 0 to 20
high 7
pause 100
low 7
pause 80
next x
timer = 0
return
I look forward to hearing from you