I have some code that refreshes servos at 50 Hz and reads some DS1620 slow temperature sensors - they take 400 - 1000 mSecs about the same as the DS1820 I think. I do it with a loopcounter and issue the conversion request in one pass then 1000 mSecs later read the result. SOmething like
MainLoop:
LoopCtr + 1
if LoopCtr > 50 then loopCtr = 0
if LoopCtr = 1 then TempConversion
if LoopCtr = 0 then ReadTemperature
ServoCodeHere:
Low ServoPin
Pulsout ServoPin, ServoWidth
Delay to give 20 mSec looptime
Goto MainLoop
TempConversion:
Issue code to start the temperature conversion - don't wait for result
Goto MainLoop
ReadTemperature:
Issue code to read most recent temperature conversion
Goto MainLoop
HTH
Brian
Bookmarks