
Section 8. Operation
376
8.6.2.5 Modbus over IP
Modbus over IP functionality is an option with the CR3000. Contact Campbell
Scientific for details.
8.6.2.6 Modbus tidBytes
Q:
CanModbusbeusedoveranRS‐232link,7databits,evenparity,one
stopbit?
A:
Yes.PrecedeModBusMaster()/ModBusSlave()withSerialOpen()and
setthenumericformatoftheCOMportwithanyoftheavailable
formats,includingtheoptionof7databits,evenparity.SerialOpen()
andMo
dBusMaster()canbeusedonceandplacedbeforeScan().
ConcatenatingtwoModbuslong16‐bitvariablestooneModbuslong32
bitnumber.
8.6.2.7 Converting 16-bit to 32-bit Longs
ConcatenationoftwoModbuslong16‐bitvariablestooneModbuslong
32bitnumberisshowninthefollowingexample.
CRBasicExample68. ConcatenatingModbusLongVariables
'Requires CR800 OS v.3, CR1000 OS v.12, or CR3000 OS v.5 or higher
'CR3000 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.
Komentáře k této Příručce