Instructions For The Modbus Protocol - Siemens SIMATIC S7-200 System Manual

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

Advertisement

Instructions for the Modbus Protocol

MBUS_INIT Instruction (Initialize Slave)
The MBUS_INIT instruction is used to enable and initialize,
or to disable Modbus communications. Before the
MBUS_SLAVE instruction can be used, the MBUS_INIT
instruction must be executed without errors. The instruction
completes and the Done bit is set immediately, before
continuing to the next instruction.
The instruction is executed on each scan when the EN
input is on.
The MBUS_INIT instruction should be executed exactly
once for each change in communications state. Therefore,
the EN input should be pulsed on through an edge
detection element, or executed only on the first scan.
The value for the Mode input selects the communications
protocol: an input value of 1 assigns port 0 to Modbus
protocol and enables the protocol, and an input value of 0
assigns port 0 to PPI and disables Modbus protocol.
The parameter Baud sets the baud rate at 1200, 2400,
4800, 9600, 19200, 38400, 57600, or 115200. Baud rates
57600 and 115200 are supported by S7-200 CPUs version
1.2 or later.
The parameter Addr sets the address at inclusive values
between 1 and 247.
Table 12-4
Parameters for the MBUS_INIT Instruction
Inputs/Outputs
Mode, Addr, Parity
Baud, HoldStart
Delay, MaxIQ, MaxAI, MaxHold
Done
Error
The parameter Parity is set to match the parity of the Modbus master. All settings use one stop bit.
The accepted values are:
0-no parity
-
1-odd parity
-
2-even parity
-
The parameter Delay extends the standard Modbus end-of-message timeout condition by adding
the specified number of milliseconds to the standard Modbus message timeout. The typical value
for this parameter should be 0 when operating on a wired network. If you are using modems with
error correction, set the delay to a value of 50 to 100 milliseconds. If you are using spread
spectrum radios, set the delay to a value of 10 to 100 milliseconds. The Delay value can be 0 to
32767 milliseconds.
The parameter MaxIQ sets the number of I and Q points available to Modbus addresses 0xxxx
and 1xxxx at values of 0 to 128. A value of 0 disables all reads and writes to the inputs and
outputs. The suggested value for MaxIQ is 128, which allows access to all I and Q points in the
S7-200.
Using the Modbus Protocol Library
Data Type
Operands
BYTE
VB, IB, QB, MB, SB, SMB, LB, AC, Constant, *VD, *AC,
*LD
DWORD
VD, ID, QD, MD, SD, SMD, LD, 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
Chapter 12
353

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents