Defining a Modbus Master Slave
Modbus
Master SlaveDefine
Modbus®
master slaves for existing Modbus
masters. A controller and a Modbus
master can have a maximum of 64 master slaves. When adding a master slave, this creates a link between the Modbus
master and slave device. Each master slave device represents a server. When configuring a Modbus
master, define general and messages properties.
IMPORTANT:
If the
Modbus
master is
configured for Modbus
TCP, only create one master slave link. If
reconfiguring Modbus
RTU master with multiple slave links to Modbus
TCP, keep only one master slave and delete the other links.Every
Modbus
master slave link contains a pair of holding registers: a control register and a slave register. The control register enables the application to control the link and port, while the status register retrieves the status information. Each register is found at a unique address and is defined using the Control Address
and Status Address
. Registers are optional. To use a register, declare a variable for the register in the application variables and the address must also be specified in the holding registers.General properties are:
Property | Description |
---|---|
Name | Name of the Modbus master slave. Possible values are any combination of alphanumeric characters and punctuation including spaces. |
Slave ID | Unique identifier for the Modbus master slave. When the protocol of the master is RTU, possible values range from 1 to 247; the default value is 1. When the protocol of the master is TCP, possible values range from 1 to 255; the default value is 255. |
Control Address | The address of a control register. When using a control variable, the Modbus address of the holding register. If a control variable address is unspecified, the link is automatically enabled once the controller starts. The application may write the control variable to switch the state of the master slave.0 = inactive, the slave link is disabled and the slave is not polled or pinged. 1 = standby, the slave is forced to operate in standby mode. Modbus continues to ping the slave to ensure communications are possible.2 = active, the slave is forced to operate in active mode and is polled for data. Possible values are 1 to 65536, or 0 to disable; the default value is 0. |
Status Address | The address of a status register (a holding register). The status register is a UINT returned by the Modbus driver to let the application monitor and act on faults. If a status register address is not specified, the master slave link does not report the status information to the application. 0 = healthy, the Modbus slave is operating normally; the link is active and no errors are reported.1 = initializing, the slave link is initializing. This value is also reported if the slave device has failed to respond to a ping on a standby link, if the Modbus master is in error, or if the master is set to inactive.2 = error, the last message to the slave resulted in an exception response. Possible values are 1 to 65536, or 0 to disable; the default value is 0. |
Slave Wait Interval (ms) | The minimum amount of time to wait from the start of one message to the beginning of the next message. Possible values range from 0 to 65535 milliseconds; the default value is 100 ms. |
Retries | The number of times the master tries to retransmit a message when receiving no response from the slave. This property is used in conjunction with the Modbus master Message Wait Interval value.Possible values range from 0 to 10; the default value is 3. |
Slave IP | For TCP connections, the network address used by master slave. Possible values range from 0.0.0.0 to 255.255.255.255.255; the default value is 0.0.0.0. |
Slave Port | For TCP connections, the port number on which the slave device is offering services. Possible values range from 0 to 65535; the default value is 502. Modbus slaves having the same Modbus master must use unique port numbers. |
Ping Mode | Tests the communications between the master and slave and determines the action the master takes if no response is received from the slave after the specified number of Retries. The AADvance controller supports a Function Code 08 ping mode for Modbus RTU slaves. Function Code 08 sends a diagnostic message to the operational slave. If supported by the slave, selectFunction Code 08 since it is a short message. Alternatively, the Read Holding Register mode reads data from the holding register. Also set a Do Not Ping setting for both protocols.For Modbus RTU, the possible values are Do Not Ping , Function Code 08 , and Read Holding Register . For Modbus TCP, the possible values are Do Not Ping or Read Holding Register . Read Holding Register is the only method available to ping a Modbus TCP slave. When the Ping Mode is Do Not Ping or Function Code 08 , the Ping Address property is disabled.It is not recommended to use the Do Not Ping mode since the master does not look for the slave after disconnection. When using Do Not Ping , communications only restart when there is a change to the control register of the master or slave. |
Ping Interval | The maximum time between each initiation of a Read Holding Register or Function Code 08 diagnostic message and specified individually for each master slave. Possible values range from 0 to 65535 milliseconds; the default value is 5000 ms. |
Ping Address | For use with the Read Holding Register ping mode and specified individually for each master slave; it is the Modbus address of the slave holding register. Possible values range from 1 to 65536, or 0 to disable; the default value is 0. |
Statistics Mode | Indicates the statistics reporting mode for the master slave. Possible values are:
|
Data Address | The holding register of the data variable. The data variable is reported in hundredths of a second. Possible values are 1 to 65536, or 0 to disable; the default value is 0. |
Reset Address | The holding register of the reset variable. Any non-zero value in the reset variable resets the data variable to zero. Possible values are 1 to 65536, or 0 to disable; the default value is 0. |
Comment | Plain text |
To define a
Modbus
master slave- In theCommunication View, expand the required controller, and then expand theMODBUSelement.TheMODBUS SlaveandMODBUS Masterelements are displayed.
- Expand theMODBUS Masterelement, right-click the existingModbusmaster, and then clickAdd New Master Slave.
- Double-click the master slave instance, and in theCommunicationproperty page, define the required properties and messages:
- On theGeneraltab, define the required general properties.
- On theMessagestab, specify the messages for the slave.
Provide Feedback