Libraries
9.3 Modbus library instructions
S7-200 SMART
434 System Manual, 09/2015, A5E03822230-AC
●
Modbus RTU slave protocol:
Modbus communications uses a CRC (cyclic redundancy
check) to insure the integrity of the communications messages. The Modbus slave
protocol uses a table of pre-calculated values to decrease the time required to process a
message. The initialization of this CRC table requires about 11.3 milliseconds. This
initialization is done inside the MBUS_INIT instruction and is normally done in the first
scan of the user program after entering RUN mode. You are responsible for resetting the
watchdog timer, if the time required by the MBUS_INIT instruction and any other user
initialization exceeds the 500 millisecond scan watchdog time. The output module
watchdog timer is reset by writing to the outputs of the module.
The scan time is extended when the MBUS_SLAVE subroutine services a request. Since
most of the time is spent calculating the Modbus CRC, the scan time is extended by
about 40 microseconds for every byte in the request and in the response. A maximum
request/response (read or write of 120 words) extends the scan time by approximately
4.8 milliseconds.
Modbus addresses are normally written as 5 character values containing the data type and
the offset. The first character determines the data type and the last four characters contain
the value.
Modbus master instructions map the address to the correct functions to send to the slave
device. The following Modbus addresses are supported by the Modbus master instructions:
● 00001 to 09999 are discrete outputs (coils)
● 10001 to 19999 are discrete inputs (contacts)
● 30001 to 39999 are input registers (generally analog inputs)
● (40001 to 49999) and (400001 to 465535) are holding registers
All Modbus addresses are one-based, meaning that the first data value starts at address
one. The actual range of valid addresses will depend on the slave device. Different slave
devices will support different data types and address ranges.
The Modbus master device maps the addresses to the correct functions. The following
addresses are supported by the Modbus slave instructions:
● 00001 to 00256 are discrete outputs mapped to Q0.0 - Q31.7
● 10001 to 10256 are discrete inputs mapped to I0.0 - I31.7
● 30001 to 30056 are analog input registers mapped to AIW0 - AIW110
● 40001 to 49999 and 400001 to 465535 are holding registers mapped to V memory.