CRBasic Example 1: CR1000X program for measuring the SR20-D2
EndTable
DataTable
(SR20D2_SensorID,1,100)
Sample
(1,SR20D2_SerialNumber,FP2)
Sample
(1,SR20D2_CalDate,Long)
Sample
(1,SR20D2_ScaleFactor_IRR,FP2)
Sample
(1,SR20D2_ScaleFactor_BodyTemp,FP2)
EndTable
BeginProg
SerialOpen
(ComC5,19200,2,0,50,4)
ModbusMaster
(ModbusResult_SN,ComC5,19200,53,4,SR20D2(1),41,1,1,100,3)
'Serial Number
SR20D2_SerialNumber = SR20D2(1)
ModbusMaster
(ModbusResult_CalDate,ComC5,19200,53,4,SR20D2(2),47,1,1,100,2)
'Cal Date
SR20D2_CalDate = SR20D2(2)
ModbusMaster
(ModbusResult_SFIRR,ComC5,19200,53,4,SR20D2(3),9,1,1,100,3)
'Scaling Factor IRR
SR20D2_ScaleFactor_IRR = SR20D2(3)
ModbusMaster
(ModbusResult_SRTemp,ComC5,19200,53,4,SR20D2(4),10,1,1,100,3)
'Scaling Factor Temp
SR20D2_ScaleFactor_BodyTemp = SR20D2(4)
ModbusMaster
(ModbusResult_ElecRes,ComC5,19200,53,4,SR20D2(10), _
8,1,1,100,1)
'Electrical Resistance
SR20D2_ElecResistance = SR20D2(10)/10
ModbusMaster
(ModbusResult_VoltOut,ComC5,19200,53,4,SR20D2(11), _
11,2,1,100,2)
'Voltage output
SR20D2_VoltageOut = SR20D2(11)
ModbusMaster
(ModbusResult_Humidity,ComC5,19200,53,4,SR20D2(13),99,1,1,100,3)
'Humidity
SR20D2_Humidity = SR20D2(13)/100
Scan
(1,Sec,0,0)
ModbusMaster
(ModbusResult_IRR_TC,ComC5,19200,53,4,SR20D2(5),3,2,1,100,2)
'Irradiance temperature compensated
SR20D2_IRR_TC = SR20D2(5)/SR20D2_ScaleFactor_IRR
ModbusMaster
(ModbusResult_IRR,ComC5,19200,53,4,SR20D2(7),5,2,1,100,2)
'Irradiance uncompensated
SR20D2_IRR = SR20D2(7)/SR20D2_ScaleFactor_IRR
ModbusMaster
(ModbusResult_BodyTemp,ComC5,19200,53,4,SR20D2(9),7,1,1,100,1)
'Body Temp
SR20D2_BodyTemp = SR20D2(9)/SR20D2_ScaleFactor_BodyTemp
CallTable
OneMin
NextScan
SlowSequence
Scan
(6,Hr,0,0)
ModbusMaster
(ModbusResult_ElecRes,ComC5,19200,53,4,SR20D2(10),8,1,1,100,1)
SR20-D2 ISO Spectrally Flat Class A (Secondary Standard) Pyranometer
7