Modbus Master
Modbus Object/Data Types
- 00001 – 09999: Coils (read/write): 1 bit
- 10001 – 19999: Discrete Inputs (read only): 1 bit
- 30001 – 39999: Input Registers (read only): 16 bits
- 40001 – 49999: Holding Registers (read/write): 16 bits
Example – Using Modbus master protocol for connecting to field devices
Modbus Master – setup is easy
Use the fieldbus configurator to add the Modbus master protocol, then create ‘master ports’ for each device. Select TCP, UDP or serial for each port and then add ‘master request’ blocks to the port for each message/data type eg. read input bits, read or write coil bits, read input registers and read or write holding registers. The master request blocks include parameters for the slave address, message type, start address, number of items, message activation type and an option to declare variables. The message activation types include ‘Periodic’ eg. every 500ms, ‘On call’ eg. triggered by an associated logic variable, or ‘On change’. Triggering a message on change is a convenient way to manage the sending of messages for write types, such as holding registers and coils.
Modbus Master – advanced setup with function blocks in the logic application
The methods shown above for managing Modbus master messages are suitable for most applications, but if the messages need to be more ‘dynamic’ then Modbus master function blocks can be used in the logic application. The WorkSuite logic editor includes MODBUSMASTERRTU (serial) and MODBUSMASTERTCP (TCP/IP) function blocks that allow control of the message contents.