symbol Tdry=w1 'b2b3
symbol Twet=w2 'b4 b5
symbol delta=w3 'b7b6
symbol trim=w9 'b19b18
symbol RH1=b9
symbol dry=b10
symbol diff =b11
symbol hum =b12
symbol RH=b13
symbol trim2=w14 ' b29b26
symbol point=b16
symbol err=b17
symbol Tempw=w7 'b15b14
symbol temp2 =w24
symbol RET= 13
symbol LFEED=10
symbol com = 44
let adcsetup = %0000000000000010
do
Readtemp12 A.3,Tdry
Tdry = Tdry * 25 / 4 ' info + ie w1=8500 display 85.00 C
BINTOASCII Tdry,b34,b33,b32,b31,b30'b8b7
IF b34 = "0" THEN : b34 = " " :ENDIF ' zero blanking b8
IF b34 = " " AND b33 = "0" THEN : b33 = " " :ENDIF ' zero blanking b7
Readtemp12 A.2,Twet 'read in result ds18b20
Twet = Twet * 25 / 4 ' info + ie w1=8500 display 85.00 C
BINTOASCII Twet,b24,b23,b22,b21,b20'b8b7
dry=b33-48*10 'Ascii back to decimal
dry=dry+b32-48 'Rounds up the decimal to give whole degree for tempreture block selection in lookup tables
IF b24 = "0" THEN : b24 = " " :ENDIF
IF b24 = " " AND b23 = "0" THEN : b23 = " " :ENDIF
'************* Above copied from Picaxe examples for Readtemp12 command
delta=Tdry-Twet 'Dry and wet bulb diffrence to 2 decimal places
if delta >64655 then
delta=-delta
endif
BINTOASCII delta,b44,b43,b42,b41,b40
diff=b42-48 'Ascii back to decimal giving the whole degree for tempreture diffrence between wet and dry
'in the lookup tables
Tempw=b41-48 'First decimal place of tempreture diffrence used to determin RH offset if dry greater than wet
temp2=b40-48 '2nd decimal place of tempreture diffrence
if temp2>= 5 then
tempw=tempw+1
endif
trim=b31-48 'Dry bulb 1st decimal place
temp2=b30-48 'second decimal place rounded up or down for dry bulb
if temp2>= 5 then 'used to determine if dry greater than wet
trim=trim+1 'if dry greater uses tempw value for offset for RH
else
trim=trim
endif
trim2=b21-48'wet bulb 1st decimal places
if trim=trim2 or trim2=trim then 'cancels out offset uses whole degree diffrence
trim=trim '
trim2=0
endif
'**********
if trim2>trim then 'shift the whole degree up 1 then add trim to take RH back up
diff=diff+1
trim=trim2
'0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9 degC
lookup trim,(0,1,1,2,3,3,4,4,5,6),RH1
err=1 'ERR=1 than RH=RH+RH1 adds wet bulb offset
'**********
elseif trim>trim2 then 'If humidity on the dry side minus the temp diff between wet and dry
trim=Tempw 'Uses tempw for determining offset RH=RH-RH1
lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
err=0 'ERR flag for minus of trims offset
endif
gosub offset
for b0= 0 to 9
readADC A.1, hum
hum=hum-42*100/157
Temp2=Temp2+hum
pause 80
next b0
hum=Temp2/10
temp2=0
gosub dis
tempw=0
if b55=5 then
'gosub wrt
endif
for b0 = 0 to 30
pause 2000
next b0
loop
dis:
SERTXD ("Sample=",32,#b55, CR, LF)
SERTXD ("Temp Dry ",32,b34,b33,b32,".",b31,b30,32,96,"C", CR, LF)
SERTXD ("Temp Wet ",32,b24,b23,b22,".",b21,b20,32,96,"C", CR, LF)
SERTXD ("Temp Diffrence ",32,b42,".",b41,b40,32,96,"C", CR, LF)
SERTXD ("Honeywell=",32,#hum,"%",32,"Picaxe=",32,#RH,32,"%", CR, LF)
SERTXD ("Diff=",32,#diff,32,"Dry=",32,#b10,32,"TempW=",32,#tempw, CR, LF)
SERTXD ("Trim=",32,#trim,32,"Trim2=",32,#trim2,32,"ERR=",32,#err,32,"RH1=",32,#RH1 ,CR, LF)
SERTXD ("Point= ",32,#point, CR, LF)
inc b55
return
offset:
'Determine whole degree tempreture block to use
if dry=18 then: point =0:endif
if dry =19 then: point=1:endif
if dry =20 then: point=2:endif
if dry =21 then: point=3:endif
if dry=22 then: point=4:endif
if dry =23 then: point=5:endif
if dry =24 then: point=6:endif
if dry =25 then: point=7:endif
if dry =26 then: point=8:endif
if dry =27 then: point=9:endif
if dry =28 then: point=10:endif
if dry =29 then: point=11:endif
if dry=30 then: point=12:endif
if dry=31 then: point=13:endif
if dry=32 then: point=14:endif
if dry=33 then: point=15:endif
if dry=34 then: point=16:endif
if dry=35 then: point=17:endif
if point<18 then
on point gosub n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17
endif
return
'Humidity at whole degree seperation for tempreture from 18 to 30 degC | 0 to 5 deg seperation
n0: '18 point0 {0,1,2,3,4,5} degC
lookup diff, (100,91,82,73,65,57),RH 'dry to wet bulb diffrence whole degree 1 to 5 diffrence
if err =0then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n1: '19 point1
lookup diff,(100,91,82,74,66,58),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n2:
lookup diff,(100,91,83,74,67,59),RH '20 point2
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n3: '21 p3
lookup diff,(100,91,83,75,67,60),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n4:' 22 p4
lookup diff,(100,92,83,76,68,61),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n5:' 23 p5
lookup diff,(100,92,84,76,69,62),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n6: '24 p6
lookup diff,(100,92,84,77,70,63),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n7: ' 25 p7
lookup diff,(100,92,85,77,70,63),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n8:' 26 p8
lookup diff,(100,92,85,78,71,64),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n9: ' 27 p9
lookup diff,(100,92,85,78,71,65),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n10: ' 28
lookup diff,(100,93,85,79,72,66),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n11: ' 29
lookup diff,(100,93,86,79,73,66),RH
'lookup trim,(0,1,2,3,4,4,5,6,7,8),RH1
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n12: ' 30
lookup diff,(100,93,86,79,73,67),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n13: ' 31
lookup diff,(100,93,86,80,74,68),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n14: ' 32
lookup diff,(100,93,87,80,74,68),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n15: ' 33
lookup diff,(100,93,87,81,75,69),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n16: ' 34
lookup diff,(100,93,87,81,75,69),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return
n17: ' 35
lookup diff,(100,94,87,81,75,70),RH
if err=0 then
RH=RH-RH1
elseif err=1 then
RH=RH+RH1
endif
return