CRBasic programming
The RS-485 output can be directly read by a CR6-series, CR1000X-series, CR350-series, or Modbus RTU RS-485 network. Other Campbell Scientific data loggers can use an MD485 multidrop interface to read the RS-485 output.
A CR6, CR1000X-series, or CR350-series data logger programmed as a Modbus client can retrieve the values stored in the input registers (see Modbus register map). To do this, the CRBasic program requires the SerialOpen() instruction followed by ModbusClient() instruction.
ModbusClient() was formerly ModbusMaster(). Campbell Scientific, in conjunction with the Modbus Organization, is now using "client-server" to describe Modbus communications. The Modbus client(s) initiates communications and makes requests of server device(s). Server devices process requests and return an appropriate response (or error message). See https://modbus.org
for more information. Existing programs that use the old Modbus terminology will still compile in the data logger.
The SerialOpen instruction has the following syntax:
SerialOpen (ComPort, Baud, Format, TXDelay, BufferSize, Mode)
The Format parameter is typically set to logic 1 low; even parity, one stop bit, 8 data bits. The Mode parameter should configure the ComPort as RS-485 half-duplex, transparent.
The ModbusClient() instruction has the following syntax:
ModbusClient (Result, ComPort, Baud, Addr, Function, Variable, Start, Length, Tries, TimeOut, [ModbusOption])
The Addr parameter must match the sensor Modbus address.
See Example program for more information.