Chapter 4
Implementation details
Additional information about Modbus implementation in the REX Control System is gathered in this chapter.
- Do not change the Sync. time parameter unless necessary (default setting: 0). Only minor devices with slow CPU detect the packets incorrectly and need longer time between them.
- The Timeout period is measured from the end of the request to the end of the response. The time necessary to send the Modbus message is added to the timeout. Modbus message contains 10 to 16 bytes plus the values to transmit. Maximal length is 256 bytes.
- The Reconnect parameter is important only if there are multiple stations on one bus.
- The Modbus protocol uses only 16-bit registers or groups of successive 16-bit registers. The Register (32bit) and Register (float) thus occupy two 16-bit registers. If we use the address 100 for Register (float), we cannot use the address 101 as it is already occupied by the float register.
- It is recommended not to combine read and write operations on one signal. Use two strictly read-only and write-only signals pointing to the same register if you need both reading and writing the data.
- The Readable and Writable flags are always relative to the REX control algorithm running on the REX target device. It is intuitive for Modbus Master but it might be confusing for the Slave. The Modbus Master writes to the registers, which are configured as readable in the Slave.
- Only the address of the first item should be used when defining groups of signals ().
- The Refresh rate cannot be faster than reading and writing all signals. Use this parameter to avoid repetitive transmission of slowly changing signals and save the bandwidth for other signals. The real refresh rate can be displayed in the RexView program.
- The values are read/written in the same order as they are shown in the configuration dialog.
- Some Modbus configuration tools use register addresses starting from 40001 (or from 400001 in the case of 984-series devices) for holding registers. The REX Control System always uses the physical addresses starting from 0.
- The Modbus communication is asynchronous to the REX control algorithm. The
driver contains a cache for all signals. The Modbus Master cycles through all signals.
If the signal is blocked by the Refresh rate parameter or the corresponding station
is not responding, the signal is skipped. Otherwise the read query or write command
is issued. If there is no response within the timeout period, the Master marks the
corresponding station as Disconnected. The Modbus Slave only waits for requests
of the Master and returns the cached values or updates the cache. All possible
situations are described in the following table:
Master
Slave
read
reads the cached value (obtained in the previous cycle of the Modbus line)
reads the cached value (updated by the last write command on the Modbus line)
write
writes the value to cache (if it differs from the previous value, it is transmitted during the nearest Modbus cycle)
writes the value to the cache (Modbus Master receives the value as soon as it issues the read command)
read and write
cached value is read, standard write operation follows
cached value is read, standard write operation follows
[Previous] [Back to top] [Up] [Next]