Siemens SIMATIC S7-200 System Manual page 370

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

Advertisement

S7-200 Programmable Controller System Manual
MBUS_CTRL Instruction (Initialize Master)
The MBUS_CTRL instruction for S7-200 port 0 (or
MBUS_CTRL_P1 for port 1) is used to initialize, monitor, or
to disable Modbus communications. Before the
MBUS_MSG instruction can be used, the MBUS_CTRL
instruction must be executed without errors. The instruction
completes and the Done bit is set immediately before
continuing to the next instruction. This instruction is
executed on each scan when the EN input is on.
The MBUS_CTRL instruction must be called every scan
(including the first scan) to allow it to monitor the progress of
any outstanding messages initiated with the MBUS_MSG
instruction. The Modbus Master Protocol will not operate
correctly unless MBUS_CTRL is called every scan.
The value for the Mode input selects the communications
protocol. An input value of 1 assigns the CPU port to
Modbus protocol and enables the protocol. An input value
of 0 assigns the CPU port to PPI system protocol and
disables Modbus protocol.
The 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
-
2 -- even parity
-
The 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 through 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. Table 12-8 defines the error
conditions that could result from executing the MBUS_CTRL instruction.
Table 12-7
Parameters for the MBUS_CTRL Instruction
Parameter
Mode
Baud
Parity
Timeout
Done
Error
356
Data Type
Operands
BOOL
I, Q, M, S, SM, T, C, V, L
DWORD
VD, ID, QD, MD, SD, SMD, LD, AC, Constant, *VD, *AC, *LD
BYTE
VB, IB, QB, MB, SB, SMB, LB, AC, Constant, *VD, *AC, *LD
WORD
VW, IW, QW, MW, SW, SMW, LW, AC, Constant, *VD, *AC, *LD
BOOL
I, Q, M, S, SM, T, C, V, L
BYTE
VB, IB, QB, MB, SB, SMB, LB, AC, *VD, *AC, *LD

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents