Hi All
I am working on a project which reads 3 DSB18B20 temp sensors to a single 7 Seg display, an idea I took from a post by manuka. The code and a timing diagram are attached.
The 7 seg flashes 3-1,s followed by the temp from sensor #1 then the 7 seg flashes 3-2,s followed by the temp from sensor #2 then the 7 seg flashes 3-3,s followed by the temp from sensor #3
The system works fine except I cannot reduce the delay between the 3 flashes and the temp readout as indicated by the “?” on the timing diagram. Not only cannot I reduce the delay, I don’t know why it is there in the first place.
Any explanations would be appreciated.
Thanks pilko
I am working on a project which reads 3 DSB18B20 temp sensors to a single 7 Seg display, an idea I took from a post by manuka. The code and a timing diagram are attached.
The 7 seg flashes 3-1,s followed by the temp from sensor #1 then the 7 seg flashes 3-2,s followed by the temp from sensor #2 then the 7 seg flashes 3-3,s followed by the temp from sensor #3
The system works fine except I cannot reduce the delay between the 3 flashes and the temp readout as indicated by the “?” on the timing diagram. Not only cannot I reduce the delay, I don’t know why it is there in the first place.
Any explanations would be appreciated.
Thanks pilko
Code:
temp28X:
readtemp 0,b0 'DS18B20 # 1 temp reading at 28X input 0
if b0>128 then gosub negtemps 'Sub zero temps value correction
b1= b0/10 'divide orig temp to get tens value
b2= b0//10 'divide orig temp so remainder yields units value
for b3 = 1 to 3:pins=%01100000:pause 200:pins=%00000000:pause 200:next b3 ' flash a "1" 3 times 'divide orig temp so remainder yields units value
on b1 gosub zero,one,two,three,four,five,six,seven,eight,nine 'tens
pause 400:pins=%00000000 'blanks all 7 segs
pause 400
on b2 gosub zero,one,two,three,four,five,six,seven,eight,nine 'units
pause 400:pins=%00000000 'blanks all 7 segs
pause 600
for b3 = 1 to 3:pins=%10110110:pause 200:pins=%00000000:pause 200:next b3 'flash a "2" 3 times
readtemp 1,b0 'DS18B20 # 2 temp reading at 28X input 1
if b0>128 then gosub negtemps 'Sub zero temps value correction
b1= b0/10 'divide orig temp to get tens value
b2= b0//10 'divide orig temp so remainder yields units value
on b1 gosub zero,one,two,three,four,five,six,seven,eight,nine 'tens
pause 400:pins=%00000000 'blanks all 7 segs
pause 400
on b2 gosub zero,one,two,three,four,five,six,seven,eight,nine 'units
pause 400:pins=%00000000
pause 600
for b3 = 1 to 3:pins=%10011110:pause 200:pins=%00000000:pause 200:next b3 'flash a "3" 3 times
readtemp 2,b0 'DS18B20 # 3 temp reading at 28X input 2
if b0>128 then gosub negtemps 'Sub zero temps value correction
b1= b0/10 'divide orig temp to get tens value
b2= b0//10 'divide orig temp so remainder yields units value
on b1 gosub zero,one,two,three,four,five,six,seven,eight,nine 'tens
pause 400:pins=%00000000 'blanks all 7 segs
pause 400
on b2 gosub zero,one,two,three,four,five,six,seven,eight,nine 'units
pause 400:pins=%00000000
pause 600
goto temp28X
zero: pins=%01111110:return '0 shows
one: pins=%01100000:return '1 shows
two: pins=%10110110:return '2 shows
three:pins=%10011110:return '3 shows
four: pins=%11001100:return '4 shows
five: pins=%11011010:return '5 shows
six: pins=%11111010:return '6 shows
seven:pins=%00001110:return '7 shows
eight:pins=%11111110:return '8 shows
nine: pins=%11001110:return '9 shows
negtemps:'DS18B20 subzero negative temps routine + flashing -ve alert
for b3 = 1 to 2:pins=%10000000:pause 200:pins=%00000000:pause 200:next b3
b0 = b0 - 127:return 'b0 now correctly able to show subzero temps
Attachments
-
24.1 KB Views: 20