Mbus_Ctrl / Mb_Ctrl2 Instruction (Initialize Master) - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

9.3.2.2

MBUS_CTRL / MB_CTRL2 instruction (initialize master)

MBUS_CTRL and MB_CTRL2 have identical behavior and parameters. MBUS_CTRL is for a
single Modbus RTU master. MB_CTRL2 is for a second Modbus RTU master.
Correspondingly, MBUS_MSG is for use with MBUS_CTRL and a single Modbus RTU
master. MB_MSG2 is for use with MB_CTRL2 and a second Modbus RTU master.
Table 9- 3
MBUS_CTRL and MB_CTRL2 instruction
LAD / FBD
STL
CALL MBUS_CTRL, Mode, Baud,
Parity, Port, Timeout, Done,
Error
CALL MB_CTRL2, Mode, Baud, Par-
ity, Port, Timeout, Done, Error
The program must call the MBUS_CTRL / MB_CTRL2 instruction every scan (including the
first scan) to allow it to monitor the progress of any outstanding messages initiated with the
MBUS_MSG / MB_MSG2 instruction. The Modbus master protocol does not operate
correctly unless the program executes MBUS_CTRL / MB_CTRL2 every scan.
Table 9- 4
Parameters for the MBUS_CTRL / MB_CTRL2 instruction
Parameter
Mode
Baud
Parity, Port
Timeout
Done
Error
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.
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
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
Description
The program calls the MBUS_CTRL / MB_CTRL2 in-
struction to initialize, monitor, or to disable Modbus com-
munications.
Before executing the MBUS_MSG / MB_MSG2 instruc-
tion, the program must execute the MBUS_CTRL /
MB_CTRL2 without errors. The instruction completes and
sets the Done bit ON before continuing to the next in-
struction.
This instruction executes on each scan when the EN
input is on.
Libraries
9.3 Modbus RTU library
481

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents