Initialization And Execution Time For Modbus Protocol - Siemens SIMATIC S7-200 System Manual

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

Advertisement

The Modbus Slave Protocol instructions use the following resources from the S7-200:
Initializing the Modbus Slave Protocol dedicates Port 0 for Modbus Slave Protocol
-
communications.
When Port 0 is being used for Modbus Slave Protocol communications, it cannot be used
for any other purpose, including communications with STEP 7--Micro/WIN. The MBUS_INIT
instruction controls assignment of Port 0 to Modbus Slave Protocol or PPI.
The Modbus Slave Protocol instructions affect all of the SM locations associated with
-
Freeport communications on Port 0.
The Modbus Slave Protocol instructions use 3 subroutines and 2 interrupts.
-
The Modbus Slave Protocol instructions require 1857 bytes of program space for the two
-
Modbus Slave instructions and the support routines.
The variables for the Modbus Slave Protocol instructions require a 779-byte block of V
-
memory. The starting address for this block is assigned by the user and is reserved for
Modbus variables.
Tip
To change the operation of Port 0 back to PPI so that you can communicate with
STEP 7-Micro/WIN, you can do one of the following:
-- Use another MBUS_INIT instruction to reassign Port 0.
-- Set the mode switch on the S7-200 to STOP mode.
Either of these methods will set the parameters for Port 0 so that you can communicate with
STEP 7--Micro/WIN.

Initialization and Execution Time for Modbus Protocol

Modbus Master Protocol -- The Modbus Master Protocol requires a small amount of time every
scan to execute the MBUS_CTRL instruction. The time will be about 1.11 milliseconds when the
MBUS_CTRL is initializing the Modbus Master (first scan), and about 0.41 milliseconds on
subsequent scans.
The scan time is extended when the MBUS_MSB subroutine executes a request. Most of the time
is spent calculating the Modbus CRC for the request and the response. The CRC (Cyclic
Redundancy Check) insures the integrity of the communications message. The scan time is
extended by about 1.85 milliseconds for each word in request and in the response. A maximum
request/response (read or write of 120 words) extends the scan time to approximately 222
milliseconds. A read request extends the scan mainly when the response is received from the
slave, and to a lesser extent when the request is sent. A write request extends the scan mainly
when the data is sent to the slave, and to a lesser extent when the response is received.
Modbus Slave Protocol -- Modbus communications utilize a CRC (cyclic redundancy check) to
insure the integrity of the communications messages. The Modbus Slave Protocol uses a table of
precalculated values to decrease the time required to process a message. The initialization of this
CRC table requires about 240 milliseconds. This initialization is done inside the MBUS_INIT
subroutine and is normally done in the first scan of the user program after entering RUN mode.
You are responsible for resetting the watchdog timer and keeping the outputs enabled (if required
for expansion modules) if the time required by the MBUS_INIT subroutine and any other user
initialization exceeds the 500 millisecond scan watchdog. The output module watchdog timer is
reset by writing to the outputs of the module. See the Watchdog Reset Instruction in Chapter 6.
The scan time is extended when the MBUS_SLAVE subroutine services a request. Since most of
the time is spent calculating the Modbus CRC, the scan time is extended by about 420
microseconds for every byte in the request and in the response. A maximum request/response
(read or write of 120 words) extends the scan time by approximately 100 milliseconds.
Using the Modbus Protocol Library
Chapter 12
349

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents