
B-1
Appendix B.
Example Programs
The following programs measure the pyranometer every 10 s and convert the
millivolt output to Wm
–2
and MJm
–2
. The scan interval is entered as a constant
at the beginning of the program. This way the user changes the constant when
they want to change their scan rate and it ripples through the program. Both
programs output an hourly average flux (Wm
–2
), and a daily total flux density
(MJm
–2
). Negative values are set to zero before being processed. Wiring for the
examples is given in TABLE
TABLE B-1. Wiring for Example Programs
CS300
Wire Colour
CS301
Wire Colour
Description
CR1000X
CR6
Red
White
Signal
SE 1
U1
Black
Black
Signal Ground
⏚
⏚
Clear
Clear
Shield
⏚
⏚
B.1 CR1000X Program
CRBasic Example B-1. CR1000X Program Measuring the CS300 or CS301
'CR1000X
'Declare Constants
't=scan rate in seconds
Const
t = 10
'Declare Variables and Units
Public
BattV
Public
PTemp_C
Public
SlrW
Public
SlrMJ
Units
BattV=Volts
Units
PTemp_C=Deg C
Units
SlrW=W/m²
Units
SlrMJ=MJ/m²
'Define Data Tables
DataTable
(Hourly,True,-1)
DataInterval
(0,60,Min,10)
Average
(1,SlrW,FP2,False)
EndTable
DataTable
(Daily,True,-1)
DataInterval
(0,1440,Min,10)
Minimum
(1,BattV,FP2,False,False)
Totalize
(1,SlrMJ,IEEE4,False)
EndTable
'Main Program
BeginProg
Scan
(t,Sec,1,0)
'Default Datalogger Battery Voltage measurement 'BattV'
Battery
(BattV)
'Default Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp
(PTemp_C,60)