Added this program for Hippy
so he can read temperature too !
Uses the ds18b20
will display the range 0.F Fahrenheit
to
257.F Fahrenheit
if outside this range displays FFFF
uses the owin command
but anyone should be able to use the convert code with readtemp12
notes: when first powered on will display 185.F (85.0c) until first read updates
when sensor unplugged will display 32.F (0.0c)
so he can read temperature too !
Uses the ds18b20
will display the range 0.F Fahrenheit
to
257.F Fahrenheit
if outside this range displays FFFF
uses the owin command
but anyone should be able to use the convert code with readtemp12
notes: when first powered on will display 185.F (85.0c) until first read updates
when sensor unplugged will display 32.F (0.0c)
Code:
' -- -- -- -- -- -- -- --
'B.0-A | | | | Picake 20x2 ver C.0
'B.1-B
'B.2-C | | | | marks
'B.3-D -- -- -- -- -- --
'B.4-E | | | |
'B.5-F
'B.6-G | | | |
'B.7-dp -- -- -- -- o
'
'Display 1 2 3 4
'Common anode C.3 C.2 C.1 c.0
eeprom 0,(192,249,164,176,153,146,130,248,128,144,255) 'Display (0,1,2,3,4,5,6,7,8,9,blank)
main:
let dirsb = %11111111
let dirsc = %00111111
temp:
owout c.7,%1001,($CC,$44) 'reset(send skip rom ,send convert t)
pinsb=142 'Display FFFF if not within valid range
owout c.7,%0001,($CC,$BE) 'reset(send skip rom ,send read lsb msb)
owin c.7,%0000,(b2,b3) 'read in result Ds18b20
IF W1 > 2000 AND W1 < 65250 THEN temp ' skip if not within valid sensor range 0.F to 257.F
IF W1> 65251 THEN ' info 0.F - 32.F
W1=-W1
W1=W1*9/8-320
W1=-W1 ' info ie w1=10 Display 1.F
ELSE ' info 32.F - 257.F
W1 = W1*9/8+320 ' info ie w1=2570 Display 257.F
ENDIF
let dirsb = %11111111 'restore b pins after read
display:
for w15=1 to 400 'Temperaturedisplay time(6secs then updates)
b0=10 : if w1 < 1000 then dig1 'Display1 zero blanking
let b0 = w1 dig 3
Dig1: read b0,b16
let pinsb = b16 : low c.3 : pause 1 : high c.3 'Display1 temp
b0=10 : if w1 < 100 then dig2 'Display2 zero blanking
let b0 = w1 dig 2
Dig2: read b0,b17
let pinsb = b17 : low c.2 : pause 1 : high c.2 'Display2 temp
let b0 = w1 dig 1
Dig3: read b0,b18 let b18=b18-128 'Display3 d.p
let pinsb = b18 : low c.1 : pause 1 : high c.1 'Display3 temp
Dig4: let pinsb = 142 : low c.0 : pause 1 : high c.0 'Display4 F
next w15
goto temp
Attachments
-
188.8 KB Views: 90
Last edited: