#PICAXE 08M ‘Sample HopeRF HH10D humidity module program for June 2009 SiChip ‘Ref resources => www.picaxe.orconhosting.net.nz/hopehum.htm ‘IO DEFINITIONS SYMBOL humid = 3 ‘ ‘ VARIABLE DEFINITIONS SYMBOL axefactr = b2 SYMBOL Soh = w2 ‘w2 = b5:b4 SYMBOL diff = w3 ‘w3 = b7:b6 SYMBOL RH = w4 ‘w4 = b9:b8 ‘ ‘ CONSTANTS -strictly need to be read via I2C for each module, but can be assumed close SYMBOL Offset = 7709 ‘HH10D offset calibration constant - a second module has 340 SYMBOL Sens = 341 ‘HH10D sensitivity calibration constant - a second module has 7762 ‘ ‘ MAIN PROGRAM Main: COUNT humid, 1000, Soh ‘read the frequency (ie cycles in 1 second) diff = Offset - Soh axefactr = diff / 19 + 1 ‘factor prevents number roll over error if >65535 RH = 10 * Diff / axefactr * Sens ‘int. result (x10 gives possible 0.1 resolution) axefactr = 4096 / axefactr ‘a factor to prevent number roll over error RH = RH / axefactr ‘final value for RH% RH = RH / 10 ‘divide by 10 (for now) as just whole integer RH% SEROUT 1, N2400, (“RH% = “, #RH) PAUSE 5000 ‘wait for 5 seconds until next reading GOTO Main