Advanced Topics - Siemens SIMATIC S7-200 System Manual

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual

Advanced Topics

This topic contains information for advanced users of the Modbus Master Protocol Library. Most
users of the Modbus Master Protocol Library should not need this information and should not
modify the default operation of the Modbus Master Protocol Library.
Retries
The Modbus Master instructions will automatically resend the request to the slave device if one of
the following errors is detected:
There is no response within the response timeout time (parameter Timeout on the
-
MBUS_CTRL) instruction (Error code 3).
The time between characters of the response exceeded the allowed value (Error code 3).
-
There is a parity error in the response from the slave (Error code 1).
-
There is a CRC error in the response from the slave (Error code 8).
-
The returned function did not match the request (Error code 7).
-
The Modbus Master will resend the request two additional times before setting the Done and Error
output parameters.
The number of retries can be changed by finding the symbol mModbusRetries in the Modbus
Master symbol table and changing this value after MBUS_CTRL has been executed. The
mModbusRetries value is a BYTE with a range of 0 to 255 retries.
Inter- -character timeout
The Modbus Master will abort a response from a slave device if the time between characters in
the response exceeds a specified time limit. The default time is set to 100 milliseconds which
should allow the Modbus Master Protocol to work with most slave devices over wire or telephone
modems. If this error is detected, the MBUS CTRL Error parameter will be set to error code 3.
There may be cases where a longer time between characters is required, either because of the
transmission medium (i.e. telephone modem) or because the slave device itself requires more
time. This timeout can be lengthened by finding the symbol mModbusCharTimeout in the
Modbus Master symbol table and changing this value after MBUS_CTRL has been executed.
The mModbusCharTimeout value is an INT with a range of 1 to 30000 milliseconds.
Single vs. Multiple Bit/Word Write Functions
Some Modbus slave devices do not support the Modbus functions to write a single discrete output
bit (Modbus function 5) or to write a single holding register (Modbus function 6). These devices
only support the multiple bit write (Modbus function 15) or multiple register write (Modbus function
16) instead. The MBUS_MSG instruction will return an error code 101 if the slave device does not
support the single bit/word Modbus functions.
The Modbus Master Protocol allows you to force the MBUS_MSG instruction to use the multiple
bit/word Modbus functions instead of the single bit/word Modbus functions. You can force the
multiple bit/word instructions by finding the symbol mModbusForceMulti in the Modbus Master
symbol table and changing this value after MBUS_CTRL has been executed. The
mModbusForceMulti value is a data type BOOL value and should be set to a 1 to force the use
of the multiple bit/word functions when a single bit/register is written.
362

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents