Specifications

Section 15. Alternate Telecoms Resource Library
15-5
ModbusSlave
Sets up a datalogger as a Modbus slave device.
Syntax
ModbusSlave (ComPort, BaudRate, ModbusAddr, DataVariable,
BooleanVariable)
MoveBytes
Moves binary bytes of data into a different memory location when translating
big endian to little endian data.
Syntax
MoveBytes | Dest | DestOffset | Source | SourceOffset | NumBytes
15.2.3.3 Addressing (ModbusAddr)
Modbus devices have a unique address in each network. Addresses range from
1 to 247. Address 0 is reserved for universal broadcasts. When using the
NL100, the Modbus address and the Pakbus address may need to be the same.
15.2.3.4 Supported Function Codes (Function)
Modbus protocol has many function codes. CSI datalogger commands support
the following.
01 Read Coil Status
02 Read Input Status
03 Read Holding Registers
04 Read Input Registers
05 Force Single Coil
15 Force Multiple Coils
16 Force Multiple Registers
15.2.3.5 Reading Inverse Format Registers (MoveBytes)
Some Modbus devices require reverse byte order words (CDAB vs. ABCD).
This can be true for either floating point, or integer formats. Since a slave
datalogger uses the ABCD format, either the master has to make an adjustment,
which is sometimes possible, or the datalogger needs to output reverse byte
order words. To reverse the byte order in the datalogger, use the MoveBytes
instruction as shown in the sample code below.
for i = 1 to k
MoveBytes(InverseFloat(i),2,Float(i),0,2)
MoveBytes(InverseFloat(i),0,Float(i),2,2)
next
In the example above InverseFloat(i) is the array holding the inverse byte
ordered word (CDAB). Array Float(i) holds the obverse byte ordered word
(ABCD).