Specifications

Section 15. Alternate Telecoms Resource Library
15-10
15.2.6.2 Configuring the CR1000
The CRBASIC program has to include the instruction ModbusSlave, which
defines what variables are accessible and the Modbus address of the devise.
The ModbusSlave instruction does not need to be executed every time the
program runs but it must at least be placed between the 'Begin Program' and
'Scan' instructions (see program example below). The Modbus address and the
datalogger PakBus address must be identical. ComPort must be set for PakBus
or 0 as the option code. EXAMPLE 15.2-1 lists example CR1000 Modbus
slave c
ode.
EXAMPLE 15.2-1. CRBASIC Code Example: Modbus Slave
'Program for CR1000 Series Datalogger
'Declare Public Variables
preservevariables
Public PTempC, PTempF, Batt_Volts
Public Modbus(5)
Public modbdig(5) as Boolean
'Define Data Tables
DataTable (ModTest,1,-1)
DataInterval (0,1,Min,10)
Minimum (1,Batt_Volts,FP2,0,False)
Sample (1,PTempC,FP2)
sample (1,PTempF,FP2)
EndTable
'Main Program Array that holds
BeginProg
ModbusSlave (0,-115200,1,Modbus(),modbdig())
‘parameter 1 must be 0 for NL100 & 502 for NL115
‘parameter 3 matches the datalogger PakBus address -- recommended
‘parameter 4 Modbus registers array
‘parameter 5 Modbus coils array, if = 0 uses DL C1-C8
Scan (1,Sec,0,0)
PanelTemp (PTempC,250)
PTempF = PTempC * 1.8 + 32
Battery (Batt_Volts)
Modbus(1) = Batt_Volts
Modbus(2) = PTempC
Modbus(3) = PtempF
CallTable ModTest
NextScan
EndProg