5 modbus over ip, 6 modbus tidbytes, 7 converting 16-bit to 32-bit longs – Campbell Scientific CR1000 Measurement and Control System User Manual
Page 371

Section 8. Operation
371
8.6.2.5 Modbus over IP
Modbus over IP functionality is an option with the CR1000. Contact Campbell
Scientific for details.
8.6.2.6 Modbus tidBytes
Q:
Can Modbus be used over an RS‐232 link, 7 data bits, even parity, one
stop bit?
A:
Yes. Precede ModBusMaster() / ModBusSlave() with SerialOpen() and
set the numeric format of the COM port with any of the available
formats, including the option of 7 data bits, even parity. SerialOpen()
and ModBusMaster() can be used once and placed before Scan().
Concatenating two Modbus long 16‐bit variables to one Modbus long 32
bit number.
8.6.2.7 Converting 16-bit to 32-bit Longs
Concatenation of two Modbus long 16‐bit variables to one Modbus long
32 bit number is shown in the following example.
CRBasic Example 67. Concatenating Modbus Long Variables
'Requires CR800 OS v.3, CR1000 OS v.12, or CR3000 OS v.5 or higher
'CR1000 uses Big-endien word order.
'Declarations
Public
Combo
As Long
'Variable to hold the combined 32-bit
Public
Register(2)
As Long
'Array holds two 16-bit ModBus long
'variables
'Register(1) = Least Significant Word
'Register(2) = Most Significant Word
Public
Result
'Holds the result of the ModBus master
'query
'Aliases used for clarification
Alias
Register(1) = Register_LSW
'Least significant word.
Alias
Register(2) = Register_MSW
'Most significant word.
BeginProg
'If you use the numbers below (un-comment them first)
'Combo is read as 131073 decimal
'Register_LSW=&h0001 'Least significant word.
'Register_MSW=&h0002 ' Most significant word.