Libraries
9.3 Modbus library instructions
Parameter Parity is set to match the parity of the Modbus slave device. All settings use one
start bit and one stop bit. The allowed values are: 0 (no parity). 1 (odd parity), and 2 (even
parity).
Parameter Port sets the physical communication port (0 = RS-485 integrated in CPU, 1 =
RS-485 or RS-232 located on the optional CM01 signal board).
Parameter Timeout is set to the number of milliseconds to wait for the response from the
slave. The Timeout value can be set anywhere in the range of 1 millisecond to 32767
milliseconds. A typical value would be 1000 milliseconds (1 second). The Timeout parameter
should be set to a value large enough so that the slave device has time to respond at the
selected baud rate.
The Timeout parameter is used to determine if the Modbus slave device is responding to a
request. The Timeout value determines how long the Modbus Master will wait for the first
character of the response after the last character of the request has been sent. The Modbus
master will receive the entire response from the Modbus slave device if at least one
character of the response is received within the Timeout time.
When the MBUS_CTRL instruction completes, the Done output is turned ON.
The Error output contains the result of executing the instruction.
See also Modbus master execution error codes (Page 442)
9.3.2.3
MBUS_MSG instruction
Table 9- 24
MBUS_MSG instruction
LAD / FBD
STL
CALL MBUS_MSG, First, Slave,
RW, Addr, Count, DataPtr,
Done, Error
The MBUS_MSG instruction initiates a master request to a Modbus slave when both the EN
input and the First inputs are ON. Sending the request, waiting for the response, and
processing the response usually requires several PLC scan times. The EN input must be ON
to enable the send request, and should remain ON until the Done bit is set ON.
438
Description
The MBUS_MSG instruction (or MBUS_MSG_P1 for port
1) is used to initiate a request to a Modbus slave and
process the response.
System Manual, 09/2015, A5E03822230-AC
S7-200 SMART