To get a better understanding what is going on, why don't you make a small change for debugging.
Instead of this...
Code:
for bits =39 to 0 step -1
tmr2=0
while (!dht_data)
wend
t2con=6
while ( dht_data)
wend
t2con=0
if ((tmr2>12)&&(tmr2<50)) then ' noise ?
if (tmr2 >31 ) then
dht.0[bits] = 1
endif
else
goto badread ' noise ?
endif
next
Do this instead...
Code:
for bits =39 to 0 step -1
tmr2=0
while (!dht_data)
wend
t2con=6
while ( dht_data)
wend
t2con=0
if tmr2 <= 12 then goto tooshort
if tmr2 => 50 then goto toolong
if (tmr2 >31 ) then
dht.0[bits] = 1
endif
next
Then create the 2 subs, tooshort and toolong and have each print a different error message.
Bookmarks