I am using the Rev-Ed supplied RH sensor. See attached datasheet.
This my code for reading the sensor and calculating RH %.
Variable names with a "b" suffix = bytes, those with a "w" suffix = words.
I am getting some funny values. Could it be the code or could the sensor be faulty ?
Thanks for looking.
EDIT:
Sorry, datasheet now attached.
This my code for reading the sensor and calculating RH %.
Variable names with a "b" suffix = bytes, those with a "w" suffix = words.
Code:
ReadRh:
Tempw1=0
for Cntb1=1 to 3
readadc 3, AdcInW 'read RH adc value
tempw1=tempw1+AdcInW
next cntb1
AdcInW=tempw1/3
tempw1 = AdcInW * 198/10 + 0 max 5100 'calc mV from 8bit read ( reading * 19.8=mV value)
tempw2=tempw1 - 960 min 0 'subtract 0.96V = zero % offset value
tempw1 = tempw2*10/307 + 0 max 100 'divide by 30.7mV per 1% RH
Cntb1 = 0 + tempw1 max 100 'Rh=actual Rel.Hum.%
cntb2=tempw1//10
put 26,cntb1:put 27,cntb2
return
Thanks for looking.
EDIT:
Sorry, datasheet now attached.
Attachments
-
69.8 KB Views: 64
Last edited: