You are on page 1of 4

Setting Up An RTU to be a Modbus Master Page 1 of 4

Setting Up An RTU to be a Modbus Master

• Add the Modbus RTU protocol to the RTU (RTU Configuration - Protocols). Alternatively Modbus TCP can
be used on an Ethernet port.
• Add serial port 2 to the RTU configuration (RTU Configuration - Ports).
• Edit serial port 2 (RTU Configuration - Ports). From the Settings tab of port 2, set Bits per second to 9600
and enable the Modbus RTU protocol.
• Create Modbus Variables to store the data polled from the Modbus Slave device (Dictionary - New Variables).
Example: MOD7H1001 to MOD7H1005 (Modbus device 7, Holding Registers 1001 to 1005). Note: Local
Registers (#Rx) polled from a PC-1, LP-x or CP-11/21 RTU start at 1001. Therefore to poll #R10, Modbus
holding register 1010 would be polled.
• Create local Modbus variables that correspond to the registers to be written to the Modbus Slave device.
Example: MODH1014 to MODH1016 (Modbus Holding registers 1014 to 1016). Please see the appendix RTU
Data - Protocols, Modbus Data for Modbus variable formats and addressing details. To read or write floating
point values using the Modbus protocol, please see the FPACK and FUNPACK function blocks.
• Configure a Modbus function block in an ISaGRAF TM logic program, using the appropriate variables or
constants for the inputs and output. An example is shown below.
• Download the Configuration and Logic to the RTU.

mk:@MSITStore:C:\PROGRA~1\KINGFI~1\TOOLBO~1\help.chm::/_187.htm 27/01/2011
Setting Up An RTU to be a Modbus Master Page 2 of 4

The logic below polls Local Registers R1 and R2 (Modbus holding registers 1001 and 1002 respectively) from
CP-11 RTU7 using the Modbus protocol every 10 seconds. The data is stored in MOD7H1001 and MOD7H1002.
ErrorStatus, MsgWaiting and PollRTU are BOOL variables. ModbusStatus is a DINT variable.

Note 1: by changing the DST setting above to 1, Local Registers R1 and R2 from RTU7 could be stored in
MOD7H1 and MOD7H2 instead of MOD7H1001 and MOD7H1002.
Note 2: When writing data to a PC-1, LP-x or CP-11/21 RTU using the Modbus protocol, data is stored in Local
Registers of the destination PC-1, LP-x or CP-11/21 RTU. The logic below writes the value from the local MODH1
variable to #R10 [Modbus address 41010] in CP-11 RTU7.

mk:@MSITStore:C:\PROGRA~1\KINGFI~1\TOOLBO~1\help.chm::/_187.htm 27/01/2011
Setting Up An RTU to be a Modbus Master Page 3 of 4

mk:@MSITStore:C:\PROGRA~1\KINGFI~1\TOOLBO~1\help.chm::/_187.htm 27/01/2011
Setting Up An RTU to be a Modbus Master Page 4 of 4

mk:@MSITStore:C:\PROGRA~1\KINGFI~1\TOOLBO~1\help.chm::/_187.htm 27/01/2011

You might also like