CRBasic Example 1: CR1000X program using Modbus over RS-485 to measure the SR05
Public
MBResult_ElecRes
Public
MBResult_VoltOut
Units
SR05_IRR = W/m^2
Units
SR05_IRR_TC = W/m^2
Units
SR05_BodyTemp = DegC
Units
SR05_Humidity = %
Units
SR05_ElecResistance = Ohm
Units
SR05_VoltageOut = uV
DataTable
(OneMin,1,-1)
DataInterval
(0,1,Min,10)
Average
(1,SR05_IRR,IEEE4,False)
Average
(1,SR05_IRR_TC,IEEE4,False)
Maximum
(1,SR05_IRR_TC,IEEE4,False,False)
Minimum
(1,SR05_IRR_TC,IEEE4,False,False)
StdDev
(1,SR05_IRR_TC,IEEE4,False)
Average
(1,SR05_BodyTemp,IEEE4,False)
EndTable
DataTable
(SR05_MetaData,1,-1)
Sample
(1,SR05_ElecResistance,IEEE4)
Sample
(1,SR05_VoltageOut,IEEE4)
Sample
(1,SR05_Humidity,IEEE4)
EndTable
DataTable
(SR05_SensorID,1,100)
Sample
(1,SR05_SerialNumber,FP2)
Sample
(1,SR05_CalDate,Long)
Sample
(1,SR05_ScaleFactor_IRR,FP2)
Sample
(1,SR05_ScaleFactor_BodyTemp,FP2)
EndTable
BeginProg
SerialOpen
(ComC5,19200,2,0,50,4)
CheckSensorID = True
Scan (1,Sec,0,0)
If
CheckSensorID = True
Then
'Serial Number
ModbusMaster
(MBResult_SN,ComC5,19200,62,4,SR05(1),41,1,1,100,3)
SR05_SerialNumber = SR05(1)
'Cal Date
ModbusMaster
(MBResult_CalDate,ComC5,19200,62,4,SR05(2),47,1,1,100,2)
SR05_CalDate = SR05(2)
SR05 Second Class Pyranometer with Various Outputs
9