B-1
Appendix B. Example Programs
B.1 Example Program Using Single-Ended
Measurement Instructions
The following example can be used directly with CR800 series, CR1000,
CR3000, and CR5000 dataloggers.
CRBasic Example B-1. Program Measuring the HC2S3 with Single-Ended Inputs
'Program measures HC2S3 with single-ended inputs once every 5 seconds and stores
'the average temperature and a sample of the relative humidity every 60 minutes.
'Wiring Diagram
'==============
'HC2S3
'Wire CR1000
'Color Function Terminal
'------ -------- --------
'Brown Temperature signal SE2
'White Relative Humidity signal SE1
'Yellow Signal Reference Ground Symbol
'Gray Power Ground Ground Symbol
'Clear Shield Ground Symbol
'Green Power 12V
Public
AirTC
Public
RH
DataTable
(Temp_RH,True,-1)
DataInterval
(0,60,Min,0)
Average
(1,AirTC,FP2,0)
Sample
(1,RH,FP2)
EndTable
BeginProg
Scan
(5,Sec,1,0)
PortSet
(9,1)
'Turn on switched 12V
Delay
(0,3,Sec)
'3-second delay
'HC2S3 Temperature & Relative Humidity Sensor measurements AirTC and RH:
VoltSE
(RH,1,mV2500,1,0,0,_60Hz,0.1,0)
VoltSe
(AirTC,1,mV2500,2,0,0,_60Hz,0.1,-40)
PortSet
(9,0 )
'Turn off switched 12V
If
RH>100
AND
RH<103
Then
RH=100
CallTable
(Temp_RH)
NextScan
EndProg