Professional Documents
Culture Documents
1 2 3
This manual is part of the documentation package with the order number: 6ES7151-1AA00-8BA0
Edition 10/2001
A5E00124881-01
Safety Guidelines
This manual contains notices intended to ensure personal safety, as well as to protect the products and connected equipment against damage. These notices are highlighted by the symbols shown below and graded according to severity by the following texts:
! ! !
Danger
indicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken.
Warning
indicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken.
Caution
indicates that minor personal injury can result if proper precautions are not taken.
Caution
indicates that property damage can result if proper precautions are not taken.
Notice
draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation.
Qualified Personnel
Only qualified personnel should be allowed to install and work on this equipment. Qualified persons are defined as persons who are authorized to commission, to ground and to tag circuits, equipment, and systems in accordance with established safety practices and standards.
Correct Usage
Note the following:
Warning
This device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens. This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended.
Trademarks
SIMATIC, SIMATIC HMI and SIMATIC NET are registered trademarks of SIEMENS AG. Third parties using for their own purposes any other names in this document which refer to trademarks might infringe upon the rights of the trademark owners. Copyright W Siemens AG 2001 All rights reserved The reproduction, transmission or use of this document or its contents is not permitted without express written authority. Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved. Siemens AG Bereich Automatisierungs- und Antriebstechnik Geschaeftsgebiet Industrie-Automatisierungssysteme Postfach 4848, D- 90327 Nuernberg Siemens Aktiengesellschaft Disclaim of Liability We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed. Siemens AG 2001 Technical data subject to change. A5E00124881-01
Contents
1 2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Serial Interface Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 3 Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Brief Explanation of Commissioning the Serial Interface Module . . . . . . . Block Diagram with Terminal Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . RS-232C Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RS-422/485 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Principles of Serial Data Transmission . . . . . . . . . . . . . . . . . . . . . . . . Data Transmission With the 3964(R) Procedure . . . . . . . . . . . . . . . . . . . . . Data Transmission with the ASCII Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuring and Parameterizing the Serial Interface Module . . . . . . . . . . . Communication Using Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Startup Features and Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reference Data for Masters Other than S7-PROFIBUS . . . . . . . . . . . . . . . Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Technical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 2-1 2-2 2-6 2-14 2-20 2-21 2-22 2-32 2-41 2-52 2-58 2-76 2-79 2-92 2-99 3-1 3-2 3-5 3-5 3-10 3-13 3-14 3-14 3-14 3-15 3-15 3-16 3-16 3-18 3-18 3-18 3-27 3-30
Modbus/USS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 3.2 3.2.1 3.2.2 3.2.3 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.4 3.4.1 3.4.2 3.4.3 3.4.4 Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Terminal Assignment Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Terminal Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RS-232C Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RS-422/485 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modbus Transmission Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Message Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slave Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Master and Slave Function Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Field DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Message End and CRC Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exception Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modbus Master Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Usable Interfaces and Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Transfer for ET 200S Modbus Master . . . . . . . . . . . . . . . . . . . . . . . . . Configuring and Setting Parameters for the Modbus Master . . . . . . . . . . . Function Codes Used by the Modbus Master . . . . . . . . . . . . . . . . . . . . . . . .
iii
Contents
3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.4.10 3.4.11 3.4.12 3.4.13 3.4.14 3.4.15 3.4.16 3.5 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.5.10 3.5.11 3.5.12 3.5.13 3.5.14 3.5.15 3.5.16 3.5.17 3.5.18 3.5.19 3.5.20 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.7 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9
Function Code 01 - Read Output Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 02 - Read Input Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 03 - Read Output Registers . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 04 - Read Input Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 05 - Force Single Coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 06 - Preset Single Register . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 07 - Read Exception Status . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 08 - Loop Back Diagnostic Test . . . . . . . . . . . . . . . . . . . . . . Function Code 11 - Fetch Communications Event Counter . . . . . . . . . . . . Function Code 12 - Fetch Communications Event Log . . . . . . . . . . . . . . . . Function Code 15 - Force Multiple Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 16 - Preset Multiple Registers . . . . . . . . . . . . . . . . . . . . . . . Modbus Slave Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Components of the Modbus Slave Data Link . . . . . . . . . . . . . . . . . . . . . . . . Data Transfer for ET 200S Modbus Slave . . . . . . . . . . . . . . . . . . . . . . . . . . Data Areas in the SIMATIC CPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuring the Parameters for the Data Link . . . . . . . . . . . . . . . . . . . . . . . Slave Function Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 01 - Read Coil (Output) Status . . . . . . . . . . . . . . . . . . . . . . . Function Code 02 - Read Input Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 03 - Read Output Registers . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 04 - Read Input Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 05 - Force Single Coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 06 - Preset Single Register . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 08 - Loop Back Diagnostic Test . . . . . . . . . . . . . . . . . . . . . . Function Code 15 - Force Multiple Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . Function Code 16 - Preset Multiple Registers . . . . . . . . . . . . . . . . . . . . . . . Bit-Oriented Function Code Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . Register-Oriented Function Code Conversions . . . . . . . . . . . . . . . . . . . . . . Enable/ Disable Write Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conversion of Modbus Addresses for Bit Functions . . . . . . . . . . . . . . . . . . Conversion of Modbus Addresses for Register Functions . . . . . . . . . . . . . Limits for Write Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Diagnostic Information of the Status LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . Structure of the Function Block Diagnostic Messages . . . . . . . . . . . . . . . . PROFIBUS Slave Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Modbus Slave Diagnostic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . USS Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . USS Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuration and Parameterization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Functional Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FC17 S_USST: Transmitting Data to a Slave . . . . . . . . . . . . . . . . . . . . . . . . FC18 S_USSR: Receiving Data from a Slave . . . . . . . . . . . . . . . . . . . . . . . FC19 S_USSI: Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Net Data DB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parameter Sets DB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Communication Processor DB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-31 3-32 3-33 3-33 3-34 3-35 3-36 3-36 3-37 3-38 3-39 3-40 3-41 3-41 3-42 3-43 3-45 3-48 3-49 3-52 3-55 3-58 3-61 3-63 3-65 3-66 3-68 3-71 3-71 3-73 3-74 3-79 3-82 3-84 3-84 3-85 3-94 3-94 3-96 3-99 3-99 3-100 3-101 3-103 3-106 3-109 3-112 3-118 3-120
iv
Contents
Start-up Characteristics and Operating Modes of the ET 200S Serial Interface Modbus/USS Driver . . . . . . . . . . . . . . . . . . . . . . . Loading the Configuration and Parameter Assignment Data . . . . . . . . . . . Operating Modes of the ET 200S Serial Interface Modbus/USS Module . Start-up Characteristics of the ET 200S Serial Interface Modbus/USS Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Behavior of the ET 200S Serial Interface Modbus/USS Module on Operating Mode Transitions of the CPU . . . . . . . . . . . . . . . . . . . . . . . . .
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1
Contents
vi
Overview
Index
The index contains keywords that come up in the manual.
1-1
Overview
1-2
Chapter Overview
This chapter describes the ET 200S serial interface module, the communication protocols supported by the module, the parameter assignment of the module and its integration in the ET 200S distributed I/O system. This document covers the following topics:
Section 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 Product Overview
Description
Page 2-2 2-6 2-14 2-20 2-21 2-22 2-32 2-41 2-52 2-58 2-76 2-79 2-92 2-99
Brief Explanation of How to Commission the Serial Interface Module Block Diagram with Terminal Assignment RS-232C Interface RS-422/485 Interface Basic Principles of Serial Data Transmission Data Transmission with the 3964(R) Procedure Data Transmission with the ASCII Driver Configuring and Parameterizing the Serial Interface Module Communication Using Function Blocks Startup Features and Modes Reference Data for Masters Other than S7 PROFIBUS Diagnostics Technical Specifications
You will find detailed information on the hardware configuration, setup, wiring, commissioning, diagnostics, and the technical specifications of the ET 200S distributed I/O system in the Distributed I/O Device manual.
2-1
2.1
Product Overview
Order Number
6ES7 138-4DF00-0AB0
Product Description
The ET 200S serial interface module is a plug-in module belonging to the ET 200S product series. It provides access to serial communication by means of three hardware interfaces (RS-232C, RS-422, and RS-485) and two software protocols (ASCII and 3964(R)). You can use the ET 200S interface module to exchange data between programmable logic controllers or computers by means of a point-to-point connection. All communication occurs by means of serial asynchronous transfers. You select the type of communication when you parameterize the module in the STEP 7 hardware configuration program or in another configuration application. The following four versions of the module are displayed in the hardware catalog: ASCII (8B) ASCII (4B) 3964R (8B) 3964R (4B) 8-byte data transmission increases the throughput but requires more I/O memory on the ET 200S rack. Four-byte data transmissions require less I/O memory on the ET 200S rack, but offer lower throughput. The module variant is based on your application requirements.
2-2
2-3
Communication
The ET 200S serial interface module permits point-to-point connection with different Siemens modules and non-Siemens products including: SIMATIC S5 by means of the 3964(R) driver with the corresponding interface module on the S5 side Siemens data acquisition terminals of the ES 2 family by means of the 3964(R) driver MOBY I (ASM 420/421, SIM), MOBY L (ASM 520), and ES 030K by means of the 3964(R) driver SIMOVERT and SIMOREG (USS protocol) by means of the ASCII driver (ET 200S SI RS 422/485) with the corresponding protocol adjustment with a STEP 7 program PCs by means of the 3964(R) procedure (there are development tools for this for programming on a PC: PRODAVE DOS 64R (6ES5 897-2UD11) for MS-DOS, PRODAVE WIN 64R (6ES5 897-2VD01) for Windows or ASCII driver) Barcode readers by means of the 3964(R) driver or ASCII driver Non-Siemens programmable logic controllers by means of the 3964(R) drivers or ASCII driver Additional devices with simple protocol structures by means of the corresponding protocol adjustment with the ASCII driver Additional devices that also have a 3964(R) driver
LEDs
The following status LEDs are on the front panel of the ET 200S interface module: SF TX RX (red) Error LED
The modes and errors indicated by these LEDs are described in Section 2.13.
2-4
Front Panel
Figure 2-1 shows the labeling on the front panel of the ET 200S SI interface module.
SERIAL INTERFACE SF
RS232 MODE 1 TXD 2 RTS 3 DTR 4 DCD 5 RXD 6 CTS 7 DSR 8 PE RS422 MODE 1 TXD(B) 2 TXD(A) 5 RXD(B) 6 RXD(A) 8 PE RS485 MODE 1 T/RXD(A) 2 T/RXD(B) 8 PE
X2 3 4 TX RX
6ES7 1384DF00-0AB0
Figure 2-1 Labeling on the Front Panel of the ET 200S Serial Interface Module
2-5
2.2
Introduction
Using an example, this brief explanation tells you how to send and receive data between serial interface modules, how to set up a functioning application, how the basic operations of the serial interface module (hardware and software) work, and how to test the hardware and software. In this example we run two ET 200S serial interface modules in RS-232C ASCII mode.
Requirements
The following requirements must be met: You have to commission an ET 200S station on an S7 station with a DP master. You will need the following components: Two TM-E15S24-01 terminal modules Two ET 200S serial interface modules The necessary wiring material
2-6
SERIAL INTERFACE SF
SERIAL INTERFACE SF
TX
RX
6ES7 1384DF00-0AB0
TX
RX
6ES7 1384DF00-0AB0
2-7
Configuration
You begin by adapting the hardware configuration to your existing ET 200S station. 1. Open the corresponding project in SIMATIC Manager, and call up the configuration table in HWCONFIG. 2. Select the ET 200S serial interface module (6ES7 138-4DF00-0AB0 ASCII (8B)) in the hardware catalog, and drag this number to the slot at which you have installed your first module. 3. Double-click this number to open the DP Slave Properties dialog box. 4. Open the Address/ID tab. You will find the start address here for the slot in which you have inserted the module. Make a note of this address for subsequent programming. 5. Repeat this step for the second module. 6. Open the Parameter Assignment tab. You will find the default settings for the module. Assign parameters to the two modules in accordance with Table 2-2. 7. Download the configuration to the CPU in STOP mode by choosing the PLC Download menu command.
Table 2-2 Parameter Assignment for the Sample Application Parameters Group diagnosis Interface Receive line initial state Transmission rate Data bits Stop bits Parity Data flow control (default setting) Indicator for end of receive message frame Character delay time (ms) End-of-text character 1 End-of-text character 2 Number of characters received Dynamic Message frame buffer Prevent message frame buffer overwrite Delete receive buffer at startup Disable RS232-C R(A)5V / R(B)0V 4800 8 1 None None Expiration of character delay time 10 3 0 100 Disable Yes Yes Value
2-8
2-9
DB3 FB3 EN M0.0 M0.1 256 14 2 24 M1.0 REQ R LADDR DB_NO DBB_NO LEN M1.1 S M4.6 S MOVE ENO OUT MW16 ENO DONE ERROR STATUS M1.0 M4.5 MW10
M4.5
DB2 FB2 EN M0.0 M0.1 264 15 0 M1.2 EN_R R LADDR DB_NO DBB_NO M1.3 S M4.4 S MOVE ENO OUT MOVE ENO OUT MW20 MW18 ENO NDR ERROR LEN STATUS M1.2 M4.3 MW12 MW14
M4.3
EN MW14 IN
2-10
2-11
5. Switch to online by choosing the PLC Connect to Configured CPU menu command. 6. Switch monitoring on by choosing the Variable Monitor menu command. 7. Switch the CPU to RUN mode. 8. Reset the following bits in the Modify Value column to 0: Transmission terminated (M1.1) Send error (M4.6) Receive new data (M1.3) Receive error (M4.4) 9. Change the following bits in the Change Value column in the specified order: 1) Bit for reset M0.1 = set 1 2) Bit for reset M0.1 = reset 0 3) Bit for send/receive job M0.0 = reset 0 (if not already at 0) 4) Bit for send/receive job M0.0 = set 1
2-12
You Can Now: See that the bit for transmission terminated (M1.1) and the bit for receiving new data (M1.3) are set. See that the two error bits have been reset and that the two status words are at 0. See that DB15 contains the expected characters in DBW0..DBW22 and that the expected receive length is 24 (W#16#18).
2-13
2.3
Wiring Rules
The cables (terminals 1 to 8) must be shielded. The shield must be supported at both ends. Use shield contact elements to do this (see the section on ET 200S accessories in the ET 200S Distributed I/O Device manual).
Remarks Mode: half-duplex and full-duplex TXD RXD RTS CTS DTR DSR PE Transmitted Data Received Data Request To Send Clear To Send Data Terminal Ready Data Set Ready Ground
6 3 7 4 8
2-14
Remarks Mode: half-duplex Terminals 1 5 2 6 8 TXD (B) RXD (B) TXD (A) RXD (A) PE Ground
PE
R/T (B)
PE
2-15
Terminal Assignment of the RS-232C Connecting Cable for the 9-pin Connector
Figure 2-4 shows the cable connections for RS-232C point-to-point communication between the ET 200S serial interface module and a communication partner with a 9-pin D connection socket. On the ET 200S side, the signal wires are connected to the correspondingly numbered terminals. Use a 9-pin subminiature D connection socket on the communication partner.
ET 200S SI Communication partner with 9-pin connection
RXD
TXD
TXD
RXD
2 6 7 3 4 8
8 7 4 6 1 5
Shield contact
Housing shield
Figure 2-4 Terminal Assignment of the RS-232C Connecting Cable for the 9-pin Connector
2-16
Terminal Assignment of the RS-232C Connecting Cable for the 25-pin Connector
Figure 2-5 shows the cable connections for RS-232C point-to-point communication between the ET 200S serial interface module and a communication partner with a 25-pin D connector. On the ET 200S side, the signal wires are connected to the correspondingly numbered terminals. Use a 25-pin subminiature D connector on the communication partner.
ET 200S SI
RXD
TXD
TXD
RXD
2 6 7 3 4 8
5 4 20 6 8 7
Shield contact
Housing shield
Figure 2-5 Terminal Assignment of the RS-232C Connecting Cable for the 25-Pin Connector
2-17
Terminal Assignment of the RS-422 Connecting Cable for the 15-Pin Connector
Figure 2-6 shows the cable connections for RS-422 point-to-point communication between the ET 200S serial interface module and a communication partner with a 15-pin D connector. On the ET 200S side, the signal wires are connected to the correspondingly numbered terminals. Use a 15-pin subminiature D connector on the communication partner.
ET 200S SI
2 1 Sender 6 5 Recipient 8
4 11 Recipient 2 9 Sender 8
RXD(A) RXD(B)
TXD(A) TXD(B)
PE
GND
Shield LIYCY 3 x 2 x 0.14 cable type. (Belden 8103 or equivalent) T(A)/T(B) and R(A)/R(B) twisted pair Housing shield
Shield contact
Figure 2-6 Terminal Assignment of the RS-422 Connecting Cable for the 15-Pin Connector
Note Add a terminating resistor of approx. 330 (see Figure 2-6) to ensure problemfree data transfer. The maximum length of this type of cable at 19.200 bps is 1200 m.
2-18
Terminal Assignment of the RS-485 Connecting Cable for the 15-Pin Connector
Figure 2-7 shows the cable connections for RS-485 point-to-point communication between the ET 200S serial interface module and a communication partner with a 15-pin D connector. On the ET 200S side, the signal wires are connected to the correspondingly numbered terminals. Use a 15-pin subminiature D connector on the communication partner.
ET 200S SI
Communication partner with 15-pin connector 1 2 T(A) T(B) R(A) R(B) PE R(A) R(B) GND
Shield LIYCY 3 x 2 x 0.14 cable type. (Belden 8102 or equivalent) R(A)/R(B) twisted pair Housing shield
T(A) T(B)
2 9 Sender 4 11 Recipient 8
Sender 1 2 Recipient 8
Shield contact
Figure 2-7 Terminal Assignment of the RS-485 Connecting Cable for the 15-Pin Connector
Note Add a terminating resistor of approx. 330 (see Figure 2-6) to ensure problemfree data transfer. The maximum length of this type of cable at 19.200 bps is 1200 m.
2-19
2.4
RS-232C Interface
Definition
The RS-232C interface is a voltage interface used for serial data transmission in compliance with the RS-232C standard.
Features
The RS-232C interface has the following features:
Type: Front connector: RS-232C signals: Transmission speed: Cable length: Standards: Degree of protection:
Voltage interface 8-pin standard terminal connector of the ET 200S TXD, RXD, RTS, CTS, DTR, DSR, DCD, GND Maximum 19.2 kbps (3964(R) procedure) Maximum 19.2 kbps (ASCII driver) Maximum 15 m, LIYCY 7 x 0.14 DIN 66020, DIN 66259, EIA RS-232C, CCITT V.24/V.28 IP 20
RS-232C Signals
The table below describes the RS-232C signals.
Meaning Transmit data; transmit line is held in the idle state on logic 1. Receive data; receive line must be held on logic 1 by the communication partner. ON: ET 200S SI is clear to send. OFF: ET 200S SI is not sending. The communication partner can receive data from the ET 200S. The interface module is expecting this as a response to RTS (ON). ON: The ET 200S SI is energized and ready for operation. OFF: The ET 200S SI is deenergized and not ready for operation.
DTR
DSR
ON: The communication partner is energized and ready for operation. OFF: The communication partner is deenergized and not ready for operation.
DCD
2-20
2.5
RS-422/485 Interface
Definition
The RS-422/485 interface is a differential voltage interface used for serial data transmission in compliance with the RS-422/485 standard.
Features
The RS-422/485 interface has the following features:
Type: Front connector: RS-422 signals: RS-485 signals: Transmission speed: Cable length: Standards: Degree of protection:
Differential voltage interface 8-pin standard terminal connector of the ET 200S TXD (A), RXD (A), TXD (B), RXD (B), GND R/T (A), R/T (B), GND Maximum 19.2 kbps (3964(R) procedure) Maximum 19.2 kbps (ASCII driver) Maximum 1200 m, LIYCY 7 x 0.14 EIA RS-422/485, CCITT V.11/V.27 IP 20
2-21
2.6
Point-to-Point Connection
For the exchange of data between two or more communication partners, various networking possibilities are available. The simplest form of data interchange is via a point-to-point connection between two communication partners. In a point-to-point connection the serial interface module forms the interface between a programmable controller and a communication partner. Data is transmitted serially using the ET 200S serial interface module.
2-22
Table 2-8
Data Transfer Modes for the ET 200S Serial Interface Module Data Transfer RS-232C Yes Yes RS-422 Yes Yes RS-485 Yes Not possible
Half-duplex Full-duplex
Agreements
Agreements must be made reached between the two communication partners before serial data transmission can take place. These include: Transmission rate (baud rate) Character and acknowledgment delay times Parity Number of data bits Number of stop bits Number of setup and transmission attempts Sections 2.7 and 2.8 describe the role played by these agreements in the various transmission procedures, and how they are parameterized.
Character Frame
The data between the ET 200S serial interface module and a communication partner is transferred via the serial interface in a 10-bit or 11-bit character frame. Three data formats are available for each character frame. You can parameterize the required format in STEP 7.
2-23
7 data bits: 1 start bit, 7 data bits, 2 stop bits Signal state 1 1 Signal state 0
1 start bit 2 stop bits 7 data bits
9 10
7 data bits: 1 start bit, 7 data bits, 1 parity bit, 1 stop bit Signal state 1 1 Signal state 0
1 parity bit 1 start bit 7 data bits 1 stop bit 1 stop bit Serial Interface Module ET 200S A5E00124881-01
9 10
8 data bits: 1 start bit, 8 data bits, 1 stop bit Signal state 1 1 Signal state 0
1 start bit 8 data bits
9 10
2-24
7 data bits: 1 start bit, 7 data bits, 1 parity bit, 2 stop bits Signal state 1 1 Signal state 0
1 start bit 1 parity bit 1 parity bit 7 data bits 2 stop bits 2 stop bits 1 stop bit
9 10 11
8 data bits: 1 start bit, 8 data bits, 1 parity bit, 1 stop bit Signal state 1 1 Signal state 0
1 start bit 8 data bits
9 10 11
8 data bits: 1 start bit, 8 data bits, 2 stop bits Signal state 1 1 Signal state 0
1 start bit 8 data bits
9 10 11
2-25
Signal
nth character
2-26
Protocol
When data is transmitted, all communication partners involved must follow fixed rules for handling and implementing the data traffic. Such rules are called protocols. A protocol defines the: Mode Half-duplex or full-duplex mode Initiative Which communication partners can initiate data transmission and under what conditions? Control characters Which control characters are to be used for data transmission? Character frame Which character frame is to be used for data transmission? Data backup The data backup procedure to be used Character delay time The time period within which an incoming character must be received Transmission speed Defined in bits per second (bps)
2-27
2-28
Transmission Integrity
Transmission integrity plays an important role in the transmission of data and in selection of the transmission procedure. Generally speaking, the more layers of the reference model are applied, the greater the transmission integrity.
Supported Protocols
Figure 2-11 shows how the ASCII and 3964(R) protocols supported by the ET 200S serial interface module fit into the ISO reference model.
Layer 2
The data bytes are transmitted with 3964(R). Start and stop bits are added; in the event of an error the transmission may be repeated.
Layer 1
Figure 2-11 How the Supported Protocols Fit into the ISO Reference Model
ASCII driver
Physical layer
3964(R)
2-29
2-30
2-31
2.7
Control Characters
During data transmission, the 3964(R) procedure adds control characters to the user data (data link layer). These control characters allow the communication partner to check whether the data has arrived complete and without errors. The 3964(R) procedure analyzes the following control characters: STX Start of Text; Start of the character string to be transmitted DLE Data Link Escape; Data transmission changeover ETX End of Text; End of the character string to be transmitted BCC NAK Block Check Character (only with 3964R); Negative Acknowledge;
Note If DLE is transmitted as an information string, it is sent twice so that it can be distinguished from the control character DLE during connection setup and cleardown on the send line (DLE duplication). The recipient then reverses the DLE duplication.
Priority
With the 3964(R) procedure, one communication partner must be assigned a higher priority and the other partner a lower priority. If both partners issue a send job at the same time, the partner with the lower priority defers its send job.
2-32
Block Checksum
In the case of the 3964R transmission protocol, data integrity is increased by the additional sending of a block check character (BCC) (see Figure 2-12).
02H 30H 31H 32H 10H 03H 20H 30 31 XOR 32 XOR 10 XOR 03 XOR BCC Figure 2-12 Block Checksum = = = = = = = = = 0011 0011 0000 0011 0011 0001 0010 0000 0010 2 0000 0001 0001 0010 0011 0000 0011 0011 0000 0
The block checksum is the even longitudinal parity (EXOR logic operation of all data bytes) of a sent or received block. It starts with the first user data byte (first byte of the message frame) after connection setup, and ends after DLE ETX at connection cleardown.
Note If DLE duplication occurs, the DLE character is accounted for twice in the BCC calculation.
2-33
ET 200S SI
Communication partner
Start ID (02H) Pos. acknowledgement (10H) 1st data byte 2nd data byte
Connection setup
S S
S S
User data
nth data byte End code (10H) End code (03H) 3964(R) only Pos. acknowledgement (10H)
Connection cleardown
Figure 2-13 Data Traffic when Sending with the 3964(R) Procedure
Send Data
If a connection is successfully established, the user data contained in the output buffer of the ET 200S is sent to the communication partner with the selected transmission parameters. The partner monitors the intervals between incoming characters. The interval between two characters must not exceed the character delay time.
2-34
Communication partner
Connection setup STX DLE 1st byte 2nd byte
ET 200S SI
Start ID (02H) Pos. acknowledgement (10H) 1st data byte 2nd data byte
User data
S S
S S
nth data byte End code (10H) End code (03H) 3964R only Pos. acknowledgement (10H)
Connection cleardown
Figure 2-14 Data Traffic When Receiving with the 3964(R) Procedure
2-35
Receiving Data
If the procedure receives the STX character and it has an empty receive buffer available, it responds with DLE. Incoming receive characters are now stored in the receive buffer. If two consecutive DLE characters are received, only one of these is stored in the receive buffer. After each receive character, the procedure waits out the character delay time for the next character. If this period expires before another character is received, an NAK is sent to the communication partner. The system program reports the error to the P_RCV function block (STATUS output parameter). If no empty receive buffer is available during a connection setup with STX, a wait time of 400 ms is started. If there is still no empty receive buffer after this time has elapsed, the system program reports the error (error message at the STATUS output of the FB). The procedure sends an NAK and returns to idle mode. Otherwise, the procedure sends a DLE and receives the data as described above.
2-36
2-37
Communication partner
Receiving data Start ID (02H) Pos. acknowledgement (10H) STX DLE
ET 200S SI
Connection setup
1st byte
S S S
S S S
nth byte
User data
End code (10H) End code (03H) 3964R only Pos. acknowledgement (15H)
Connection setup
When DLE, ETX, and BCC are received, the ET 200S module compares the BCC of the communication partner with its own internally calculated value. If the BCC is correct and no other receive errors occur, the ET 200S modules responds with DLE. Otherwise, the module responds with NAK and waits for a new attempt for the block wait time (T) of 4 seconds. If, after the parameterized number of transmission attempts, the block cannot be received, or if no further attempt is made within the block wait time, the ET 200S aborts the receive operation.
2-38
Initialization Conflict
Figure 2-16 shows the transmission sequence during an initialization conflict.
S S
S S
User data
nth data byte End code (10H) End code (03H) 3964(R) only Pos. acknowledgement (10H) 2nd setup attempt
Connection cleardown
STX DLE
Connection setup
If a device responds to the communication partners send request (character STX) within the acknowledgment delay time (ADT) by sending the character STX instead of the acknowledgment DLE or NAK, an initialization conflict occurs. Both devices want to execute a send job. The device with the lower priority withdraws its send job and responds with the character DLE. The device with the higher priority sends its data in the manner described above. Once the connection has been cleared down, the lower-priority device can execute its send job. To be able to resolve the initialization conflict, you must parameterize the communication partners with different priorities.
2-39
Procedure Error
The procedure detects both errors which are caused by the communication partner and errors caused by faults on the line. In both cases, the procedure makes repeated attempts to send/receive the data block correctly. If this is not possible within the maximum number of retries set (or if a new error status occurs), the procedure aborts send or receiving. It reports the error number of the first detected error and returns to idle mode. These error messages are displayed in the STATUS output of the FB. If the system program regularly reports an error number at the STATUS output of the FB for send and receive repetitions, this indicates that there are occasional problems affecting the data traffic. The large number of retries compensates for this, however. In this case you are advised to check the transmission line for possible sources of interference, because frequent repetitions reduce the user-data rate and integrity of the transmission. The disturbance could also be caused, however, by a malfunction on the part of the communication partner. When there is a break in the receive line, a BREAK status (BREAK indication by means of the diagnostic interrupt of the ET 200S module) is reported (see Section 2.13). No repeat is started. The BREAK status is automatically reset as soon as the connection is restored on the line. For every detected transmission error (lost character, frame or parity error), a standard number is reported, regardless of whether the error was detected during sending or receiving of a data block. The error is only reported, however, following unsuccessful repetitions.
2-40
2.8
Introduction
The ASCII driver controls data transmission by means of a point-to-point connection between the ET 200S SI module and a communication partner. This driver contains the physical layer (layer 1 of the ISO reference model.) The structure of the message frames is left open because the S7 user passes on the complete send message frame to the ET 200S SI module. For the receive direction, the end criterion of a message must be parameterized. The structure of the send message frames may differ from that of the receive message frames. The ASCII driver allows data of any structure (all printable ASCII characters as well as all other characters from 00 through FFH (in the case of character frames with 8 data bits) or from 00 through 7FH (in the case of character frames with 7 data bits)) to be sent and received.
Note When XON/XOFF flow control is parameterized, the user data must not contain any of the parameterized XON or XOFF characters. The default settings are DC1 = 11H for XON and DC3 = 13H for XOFF.
2-41
Send Data
Figure 2-17 shows the sequence during the send operation.
The amount of data to be sent is taken from the LEN parameter on the P_SEND FB.
2-42
Code Transparency
The code transparency of the procedure depends on the selection of the parameterized end criterion and the flow control: With one or two end-of-text characters Not code-transparent When the end criterion is the character delay time or a fixed message frame length Code-transparent Code-transparent operation is not possible when XON/XOFF flow control is used. Code-transparent means that any character combination can occur in the user data without the end criterion being detected.
Transmission Rate 19,200 9600 4800 2400 1200 600 300 110
2-43
Character arrived
Figure 2-18 Sequence of Receive Operation with End Criterion Expiration of Character Delay Time
2-44
Character arrived
Error receiving data Message frame complete Wait for valid end code Enter message frame in receive buffer Character delay time expired Enter error in receive buffer
Figure 2-19 Sequence of Receive Operation with End-of-Text Character End Criterion
2-45
Character arrived
Enter message frame in receive buffer Character delay time expired Enter error in receive buffer
Figure 2-20 Sequence of Receive Operation with End Criterion Fixed Message Frame Length
2-46
Note If the constant reading out of the receive data in the user program is interrupted for a while, you may find that when the receive data is requested again, the CPU receives an old message frame from the ET 200S module first before it receives the most recent one. The old message frame is the one that was on its way between the ET 200S SI and CPU or that had already been received when transmission was interrupted.
2-47
After the ET 200S modules has been powered up, the output signals are OFF (inactive). You can parameterized the way in which the DTR/DSR and RTS/CTS control signals are used with the parameterization interface or with functions (FCs) in the user program.
Note When automatic operation of the RS 232C auxiliary signals is parameterized, neither data flow control using RTS/CTS or control of RTS and DTR using the V24_SET FB is possible. When data flow control with RTS/CTS is parameterized, it is not possible to control RTS using the V24_SET FB. On the other hand, it is always possible to read all the RS 232C auxiliary signals using the V24_STAT FB.
The following sections explain the main principles of controlling and evaluating the RS-232C auxiliary signals.
2-48
Note When automatic operation of the RS 232C auxiliary signals is parameterized, neither data flow control using RTS/CTS or control of RTS and DTR using the V24_SET FB is possible.
2-49
Timing Diagram
Figure 2-21 illustrates the timing of a send job.
RTS
ON OFF ON OFF 1 0 t Request to send: RTS = ON Partner: CTS = ON Data output waiting time expired: Send Data output waiting time Sending ended RTS transfer time expired Partner: CTS = OFF
CTS
TXD
Figure 2-21 Timing Diagram for the Automatic Operation of RS-232C Auxiliary Signals
2-50
2-51
2.9
Specify whether the module should gene- No rate a diagnostic interrupt if a serious error Yes occurs. Specify the electrical interface to be used (see Sections 2.4 and 2.5).
RS-232C RS-232C RS-422 (full-duplex) RS-485 (half-duplex) R(A) 5V / R(B) 0V R(A) 0V / R(B) 5V R(A) 5V / R(B) 0V
Half duplex and full duplex Receive line initial state Data flow control (with preset parameters; change defaults in the user program)
Specify the initial state of the receive line in RS-422 and RS-485 modes. Not in RS-232C mode. You can send and receive data with data flow control. Data transmission is synchronized using data flow control, if one communication partner works faster than the other. Select the type of data flow control and set the corresponding parameters (see Section 2.8). Note: Data flow control with the RS 485 interface is not possible. Data flow control with RTS/CTS and automatic handling of the V24 signals is only possible with the RS-232C interface.
None
2-52
Table 2-10
Parameters for the ASCII Driver, continued Description Value Range 110 300 600 1200 2400 4800 9600 19200 7 8 1 2 Default Value 9600
Parameters
Transmission rate Select the speed of data transmission in bits per second.
Select the number of bits to which a character is mapped. Select the number of stop bits appended during transmission to every character to be sent to indicate the end of the character. The sequence of the data bits can be extended by one character, so that the parity bit can be accepted. The additional value (0 or 1) puts the value of all the bits (data bits and parity bit) in a defined state. None: Data is sent without the parity bit. Odd: The parity bit is set so that the overall number of data bits (including the parity bit) is odd along with the signal state 1. Even: The parity bit is set so that the overall number of data bits (including the parity bit) is even along with the signal state 1. Any: The signal state of the parity bit is not relevant. Parity is not checked when data is received, but it is always set to 0 when data is sent.
8 1
Parity
Even
2-53
Table 2-10
Parameters for the ASCII Driver, continued Description If data is transmitted with the ASCII driver, the end of the receive message frame can be recognized in three different ways. You can select one of the three transmission modes here and enter the specific parameters. Note: If the character delay time expires while data is being received, the receive operation is prematurely aborted in all three modes. The message frame is discarded except in Expiration of character delay time mode. Expiration of character delay time The end of the message frame is detected when the parameterized character delay time expires. On receipt of end-of-text character: The end of the message frame is detected when the defined end-of-text character(s) are received. On receipt of fixed number of characters The end of the message frame is detected by the parameterized message frame length. All the message frames that are to be received, have the same length. The maximum interval between two characters being received. 1 You can define a maximum of two end-oftext characters to receive data with endof-text characters. The selected end-oftext characters limit the length of the message frame. You can define a maximum of two end-oftext characters to receive data with endof-text characters. The selected end-oftext characters limit the length of the message frame. Second end code, if specified. Value Range Default Value
Expiration of charac- Expiration of chater delay time racter delay time On receipt of end-oftext character On receipt of fixed number of characters
4 to 65535 ms
4 ms
With 7 data bits:3 1 to 7FH With 8 data bits:3 1 to FFH With 7 data bits:3 0 to 7FH With 8 data bits:3 0 to FFH
End-of-text character 2 2
Specify the frame length if data with fixed 1 to 200 bytes number of characters is to be received. The frame length must correspond exactly to the number of data bytes to be received by the communication partner.
100
2-54
Table 2-10
Parameters for the ASCII Driver, continued Description Value Range Default Value Activated
When receiving messages, you can speActivated cify whether only one message should be Disabled backed-up or whether the messages should be dynamically backed-up. Activating dynamic message frames will allow the module to back-up several messages of varying lengths. The buffer concerned is a cyclic buffer. If the buffer is full, the oldest message is overwritten unless the parameter for preventing the overwriting of the buffer is activated. In this case the most recent message is discarded. In both cases a diagnostic interrupt indicates that data has been lost. This parameter prevents back-up mesNo sage frames from being overwritten, if the Yes module receives a new message frame, but the contents of the receive buffer have not yet been deleted. This parameter prevents old message frames being deleted. Specify whether the receive buffer of the module should be automatically deleted when the CPU changes from STOP to RUN (CPU startup). In this way, you can make sure that the receive buffer of the module only receives message frames that were received after CPU startup. No Yes
Yes
Yes
1 2 3 4
The shortest character delay time is based on the transmission rate. See Table 2-9 (Page 2-43). Can only be set if the end criterion is an end-of-text character. Depending on the parameterization of the character frame (7 or 8 data bits). Can only be set if the end criterion is a fixed message frame length.
Specify whether the module should gene- No rate a diagnostic interrupt if a serious error Yes occurs. Specify the electrical interface to be used (see Sections 2.4 and 2.5.) Specify the initial state of the receive line in RS-422 mode. Not in RS-232C mode. RS-232C RS-422 R(A) 5V / R(B) 0V R(A) 0V / R(B) 5V
2-55
Table 2-11
Driver Parameters for the 3964(R) Protocol, continued Description Value Range Default Value Block check
Specify whether the data should be sent No block check with a block character check (BCC) to inBlock check crease data integrity. The block check character is the even longitudinal parity (EXOR logic operation of all data bytes) of a sent or received block. If a communication partner detects a block check character when receiving the data, it compares the BCC with the internally calculated longitudinal parity. If the block check character is faulty, there is a wait of 4 seconds (block wait time), and data transmission is then repeated. If, after the parameterized number of transmission attempts, the data block cannot be received, or if no further attempt is made within the block wait time, the receive operation is aborted. 110 300 600 1200 2400 4800 9600 19200 7 8 1 2
Transmission rate Select the speed of data transmission in bits per second.
9600
Select the number of bits to which a character is mapped. Select the number of stop bits appended during transmission to every character to be sent to indicate the end of the character. A character can be added to the sequence of data bits so that the parity bit can be included. The additional value (0 or 1) puts the value of all the bits (data bits and parity bit) in a defined state. None: Data is sent without the parity bit. Odd: The parity bit is set so that the total number of data bits (including the parity bit) with the signal state 1 is odd. Even: The parity bit is set so that the total number of data bits (including the parity bit) along with the signal state 1 is even. Any: The signal state of the parity bit is not relevant. Parity is not checked when data is received, but it is always set to 0 when data is sent.
8 1
Parity
Even
2-56
Table 2-11
Driver Parameters for the 3964(R) Protocol, continued Description The maximum interval between the receipt of two characters. Set the shortest character delay time for your application. Remember that the character delay time must have a certain minimum value, depending on the transmission rate. Value Range 20 to 655350 ms in 10 ms increments Default Value 220 ms
Specify the maximum time that can expire 10 to 655350 ms in before an acknowledgment is received 10 ms increments from the communication partner when the connection is set up and cleared. Remember that the acknowledgment delay time must have a certain minimum value, depending on the transmission rate. Specify the number (n) of attempts made to set up a connection. (After n failed attempts, the function is aborted and the error is displayed in the STATUS output of the P_SEND function block.) Specify the number (n) of attempts made to transmit a message frame. (After n failed attempts at sending the message frame without errors, the function is aborted, and the error is displayed in the STATUS output of the P_SEND function block.) Possible reasons for abortion: Parity error BCC error, parity error Different parameter assignment of the communication partners (transmission rate, Parity, character frame, block check character, different protocols, for example) 1 to 255
Setup attempts
Transmission attempts
1 to 255
Priority
If both partners issue a send job at the High same time, the partner with the lower prio- Low rity will defer its send job. You must assign one communication partner a higher priority and the other partner a lower priority in data transmission. Specify whether the receive buffer of the module should be automatically deleted when the CPU changes from STOP to RUN (CPU startup). In this way, you can make sure that the receive buffer of the module only receives message frames that were received after CPU startup. No Yes
Low
Yes
2-57
2.10
Overview
Communication between the CPU, ET 200S SI, and a communication partner takes place by means of the function blocks and the protocols of the ET 200S SI module. (You will find information on communicating with non-Siemens CPUs (non-S7) in Section 2.12.) The function blocks form the software interface between the CPU and the ET 200S SI serial interface module. They must be called cyclically from the user program.
2-58
Function Blocks of the ET 200S SI Module Meaning The P_RCV function block allows you to receive data from a communication partner and store it in a data block. The P_SEND function block allows you to send all or part of a data block to a communication partner.
V24_STAT The V24_STAT function block allows you to read the signal states at the RS-232C interface of the ET 200S SI module. V24_SET F_XON F_RTS F_V24 The V24_SET function block allows you to set/reset the outputs of the RS-232C interface of the ET 200S SI module. The F_XON function block allows you to set additional parameters if the module was parameterized for XON/XOFF flow control. The F_RTS function block allows you to set additional parameters if the module was parameterized for the RTS/CTS flow control. The F_V24 function block allows you to set additional parameters if the module was parameterized for the automatic operation of V.24 signals.
FB3 P_SEND:
The P_SEND FB transmits a data block from a data block, specified by the DB_NO, DBB_NO, and LEN parameters, to the ET 200S SI module. The P_SEND FB is called cyclically and statically (without conditions) for data transmission or alternatively in a time-controlled program. The data transmission is initiated by a positive edge at the REQ input. A data transmission operation can run over several calls (program cycles), depending on the amount of data involved. The P_SEND FB can be called cyclically with the signal state 1 at the R parameter input. This terminates transmission to the ET 200S SI and resets the P_SEND FB to its initial state. Data that has already been received by the ET 200S SI is still sent to the communication partner. If the signal state 1 is at the R input statically, this means that sending is deactivated. The address of the ET 200S SI module to be addressed is specified in the LADDR parameter. The DONE output indicates that the job has been completed without errors. ERROR indicates whether an error has occurred. In the event of an error, the corresponding event number is displayed in STATUS (see Section 2.13). If no error has occurred, STATUS has the value 0. DONE and ERROR/STATUS are also output at RESET of the P_SEND FB (see Figure 2-22 on page 2-62). In the event of an error, the binary result BR is reset. If the block is terminated without errors, the binary result has the status 1.
2-59
Note The P_SEND function block does not have a parameter check. If there are invalid parameters, the CPU branches to STOP mode. Before an initiated job can be processed by the ET 200S SI module after the CPU has changed from STOP to RUN, the CPU startup mechanism of the ET 200S module for the P_PRINT FB must be completed (see Page 2-58). Any jobs initiated in the meantime do not get lost. It is transferred to the ET 200S SI module on completion of startup coordination.
FB3 Call
STL Representation CALL P_SEND, I_SEND REQ: = R: = LADDR: = DB_NO: DBB_NO: LEN: DONE: ERROR: STATUS: = = = = = = LAD Representation I_SEND P_SEND EN REQ R LADDR DB_NO DBB_NO LEN ENO DONE ERROR STATUS
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
Note Exception: In the event of an error, STATUS == W#16#1E0F, you can consult the SFCERR variable for more details of the error (see Section 2.13). This error variable can only be loaded via symbolic access to the instance DB.
2-60
FB3: Parameters of P_SEND Type INPUT INPUT INPUT INPUT INPUT INPUT OUTPUT OUTPUT OUTPUT Data Type BOOL BOOL INT INT INT INT BOOL BOOL WORD Description Initiates job at positive edge Aborts job Base address of the ET 200S SI module Data block number Data byte number Data length Job completed without errors Job completed with errors Error specification Current job is aborted. Sending is blocked. The base address is taken from STEP 7. Send DB no.: CPU-specific (zero is not permitted) 0 v DBB_NO v 8190 send data as of data word 1 v LEN v 200, specified in number of bytes STATUS parameter == 16#00 STATUS parameter contains error information If ERROR == 1, STATUS parameter contains error information Permitted Values, Comment
DONE parameter is available for one CPU cycle after a correct send job.
2-61
REQ
DONE
ERROR Completion without errors Error Completion without errors Error Completion with errors 1st /n. part of SEND RESET transmitted RESET transmitted
Note The REQ input is edge-triggered. A positive edge at the REQ input is sufficient. It is not necessary for the RLO (result of logical operation) to be at 1 during the whole transmission.
2-62
Send job
Note The P_RCV function block does not have a parameter check. If there are invalid parameters, the CPU switches to STOP mode. Before an initiated job can be received by the ET 200S SI module after the CPU has changed from STOP to RUN, the CPU startup mechanism of the ET 200S module for the P_RCV FB must be completed (see page 2-58).
2-63
FB 2 Call
STL Representation CALL P_RCV, I_RCV EN_R: = R: = LADDR: = DB_NO: DBB_NO: NDR: ERROR: LEN: STATUS: = = = = = = LAD Representation I_RCV P_RCV EN EN_R R LADDR DB_NO DBB_NO ENO NDR ERROR LEN STATUS
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
Note Exception: In the event of an error, STATUS == W#16#1E0D, you can consult the SFCERR variable for more details of the error (see Section 2.13). This error variable can only be loaded via symbolic access to the instance DB.
2-64
FB2: Parameters of the P_RCV Type INPUT INPUT INPUT INPUT INPUT OUTPUT OUTPUT OUTPUT OUTPUT Data Type BOOL BOOL INT INT INT BOOL BOOL INT WORD Description Enables reading of data Aborts job Base address of the ET 200S SI module Data block number Data byte number Job completed without errors, data accepted Job completed with errors Length of message frame received Error specification Current job is aborted. Receiving is disabled. The base address is taken from STEP 7. Receive DB No.: CPU-specific, zero is not allowed 0 v DBB_NO v 8190 receive data as of data word STATUS parameter == 16#00 STATUS parameter contains error information 1 v LEN v 200, specified in number of bytes If ERROR == 1, STATUS parameter contains error information Permitted Values, Comment
DONE parameter is available for one CPU cycle after a correct receive job!
2-65
EN_R
NDR
ERROR
LEN (length)
Note The EN_R input must be set statically to 1. During the entire receive job, the EN_R parameter must be supplied with RLO 1 (result of logic operation).
2-66
Receiving disabled
Enable receipt
No receipt
Receiving
Receiving
Functions for the Parameter Assignment of Options for Data Flow Control
If you use the ET 200S serial interface module with an S7 CPU and configure the module with the STEP 7 hardware configuration program, you can select a method for data flow control from the following options: None XON/XOFF RTS/CTS Automatic operation of the V.24 signals Additional parameters can be set for each of these options. These additional parameters have default values that are typical and appropriate for most applications. You can, however, change these parameters using the user program and the following function blocks.
FB6 F_XON:
The F_XON function block allows you to set additional parameters (see Table 2-15) if the module was parameterized for XON/XOFF flow control.
LAD Representation I_XON F_XON EN REQ R LADDR ENO DONE ERROR STATUS
2-67
Note Exception: In the event of an error, STATUS == W#16#1E0D, you can consult the SFCERR variable for more details of the error (see Section 2.13). This error variable can only be loaded via symbolic access to the instance DB.
FB6 Parameters
Table 2-15 lists the parameters of FB6.
Table 2-15 Name REQ R LADDR XON XOFF WAIT_FOR _XON DONE1 ERROR1 STATUS1 FB6: Parameters of F_XON Type INPUT INPUT INPUT INPUT INPUT INPUT OUTPUT OUTPUT OUTPUT Data Type BOOL BOOL INT BYTE BYTE TIME BOOL BOOL WORD Description Initiates job at positive edge Aborts job Base address of the ET 200S SI module XON character XOFF character Waiting time for XON to XOFF Job completed without errors Job completed with errors Error specification Current job is aborted. Sending is blocked. The base address is taken from STEP 7. 0 to 7FH (7 data bits) 0 to FFH (8 data bits) 0 to 7FH (7 data bits) 0 to FFH (8 data bits) 20 ms to 10 min 55 s 350 ms STATUS parameter == 16#00; STATUS parameter contains error information If ERROR == 1, STATUS parameter contains error information 11 (DC1) 13 (DC3) 2s Permitted Values, Comment Default
1 The
DONE parameter is available for one CPU cycle after a correct job.
2-68
FB7 F_RTS:
The F_RTS function block allows you to set additional parameters (see Table 2-16) if the module was parameterized for RTS/CTS flow control.
LAD Representation I_RTS F_RTS EN REQ R LADDR WAIT_FOR_CTS ENO DONE ERROR STATUS
Note Exception: In the event of an error, STATUS == W#16#1E0D, you can consult the SFCERR variable for more details of the error (see Section 2.13). This error variable can only be loaded via symbolic access to the instance DB.
2-69
FB7 Parameters
Table 2-16 lists the parameters of FB7.
Table 2-16 Name REQ R LADDR WAIT_FOR _CTS DONE1 ERROR1 STATUS1 FB7: Parameters of F_RTS Type INPUT INPUT INPUT INPUT OUTPUT OUTPUT OUTPUT Data Type BOOL BOOL INT TIME BOOL BOOL WORD Description Initiates job at positive edge Aborts job Base address of the ET 200S SI module Waiting time for CTS = ON Job completed without errors Job completed with errors Error specification Current job is aborted. Sending is blocked. The base address is taken from STEP 7. 20 ms to 10 min 55 s 350 ms STATUS parameter == 16#00; STATUS parameter contains error information If ERROR == 1, STATUS parameter contains error information 2s Permitted Values, Comment Default
1 The
DONE parameter is available for one CPU cycle after a correct job.
FB8 F_V24: Setting the Parameters for Automatic Operation of the RS-232C Auxiliary Signals
The F_V24 function block allows you to set additional parameters (see Table 18) if the module is parameterized for automatic operation of the RS-232C auxiliary signals.
LAD Representation I_V24 F_V24 EN REQ R LADDR TIME_RTS_OFF DATA_WAIT_TIME ENO DONE ERROR STATUS
2-70
Note Exception: In the event of an error, STATUS == W#16#1E0D, you can consult the SFCERR variable for more details of the error (see Section 2.13). This error variable can only be loaded via symbolic access to the instance DB.
FB8 Parameters
Table 2-17 lists the parameters of FB8.
Table 2-17 Name REQ R LADDR TIME_RTS _OFF FB8 Parameters of F_V24 Type INPUT INPUT INPUT INPUT Data Type BOOL BOOL INT TIME Description Initiates job at positive edge Aborts job Base address of the ET 200S SI module Time that has to elapse before RTS is deactivated Time that has to be waited until the partner sets CTS = ON after RTS has been set. Job completed without errors Job completed with errors Error specification Current job is aborted. Sending is blocked. The base address is taken from STEP 7. 0 ms to 10 min 55 s 350 ms 10 ms Permitted Values, Comment Default
TIME
0 ms to 10 min 55 s 350 ms
10 ms
STATUS parameter == 16#00; STATUS parameter contains error information If ERROR == 1, STATUS parameter contains error information
1 The
DONE parameter is available for one CPU cycle after a correct job.
2-71
FB4 Call
STL Representation CALL V24_STAT, I_STAT REQ: = R: = LADDR: = DONE: ERROR: STATUS: DTR_OUT: DSR_IN: RTS_OUT: CTS_IN: DCD_IN: = = = = = = = = LAD Representation I_STAT V24_STAT EN REQ R LADDR ENO DONE ERROR STATUS DTR_OUT DSR_IN RTS_OUT CTS_IN DCD_IN
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
2-72
Note A minimum pulse duration is required to detect a change in signal. The relevant variables are the CPU cycle time, the update time to the ET 200S SI module, and the response time of the communication partner.
DTR_OUT1
OUTPUT
BOOL
Data terminal ready, ET 200S SI is ready for operation. Data set ready, communication partner is ready for operation. Request to send, ET 200S SI is clear to send. Clear to send, communication partner can receive data from the ET 200S SI module (response to RTS = ON of the ET 200S SI) Data carrier detect
DSR_IN1
OUTPUT
BOOL
RTS_OUT1 CTS_IN1
OUTPUT OUTPUT
BOOL BOOL
DCD_IN1
1 The
OUTPUT
BOOL
DONE parameter is available for one CPU cycle after a correct job.
2-73
STL Representation CALL REQ R LADDR: RTS: DTR: DONE: ERROR: STATUS: V24_SET, I_SET = = = = = = = =
LAD Representation I_SET V24_SET EN REQ R LADDR RTS DTR ENO DONE ERROR STATUS
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to the signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
2-74
(Output ET 200S SI) STATUS parameter contains error information If ERROR == 1, STATUS parameter contains error information
DONE parameter is available for one CPU cycle after a correct job.
2-75
2.11
2-76
2-77
2-78
2.12
The ET 200S SI module transfers data to the CPU in the following way: Byte 0 1 2 S S S S N Contents Coordination byte Data byte 0 Data byte 1 S S S S Data byte
Figure 2-24 Data Transfer Between the CPU and the ET200S SI Module
2-79
Byte Segment Output byte written by the CPU Bit 7 Job code Execution number
Reserved Set by the CPU to initiate a job Send job: Incremented by the CPU by 1 when the CPU sends another segment to the ET 200S SI module...or Receive job: Accepted each time by input byte 0 of the CPU when the CPU receives a new segment in the correct order from the interface module. Indicates the last valid execution number when the error bit is set. (The value goes from 1 to 7.)
Error
Set by the CPU to indicate that a segment was not received in the correct order. The execution number field indicates the last valid execution number. Bit 7 Res. 6 5 Job code 4 3 Error 2 1 0 Execution number
Job byte written by the ET 200S SI module Bit 7 Job code Execution number
Reserved Accepted by the ET 200S SI module to acknowledge that the job has been accepted. Send job: Accepted each time by output byte 0 of the module when the module receives a new segment in the correct order from the CPU. Indicates the last valid execution number when the error bit is set. Receive job: Incremented by the module by 1, when the module sends another segment to the CPU. (The value goes from 1 to 7.)
Error
Set by the module to indicate that a segment was not received in the correct order. The execution number field indicates the last valid execution number.
2-80
2-81
Byte
0 00H
3 xxH
4 xxH
5 xxH Irrelevant
6 xxH
7 xxH
nnnnH Status
Job ackn.
CPU writes send job: Byte 0 1 2 10H Job 2nd xxH xxH
3 xxH
4 xxH
5 xxH
6 xxH
7 xxH
Irrelevant
nnnnH Status
xxH
xxH
xxH Irrelevant
xxH
xxH
CPU repeats send job: 10H Job 3rd xxH xxH xxH xxH xxH xxH xxH
Irrelevant
nnnnH Status
xxH
xxH
xxH Irrelevant
xxH
xxH
CPU sends 1st segment: 11H Job 0016H Send length a b c Data d e
2-82
Example of Sending, continued CPU Writes to ET 200S SI User program reads the following response of the 10H xxH module (send and execution numbers are still Job ackn. at 0, which indicates the latency time of the module response): CPU Reads ET 200S SI
xxH
xxH
xxH
xxH
xxH
xxH
Irrelevant
CPU sends 2nd segment since no error was indicated: 12H Job 5th User program reads the following response of the module: f g h i Data j k l
xxH
xxH
xxH
xxH Irrelevant
xxH
xxH
xxH
CPU sends 3rd segment since no error was indicated and the execution is correct: 13H Job 6th User program reads the following response of the module: m n o p Data q r s
xxH
xxH
xxH
xxH Irrelevant
xxH
xxH
xxH
CPU sends 4th segment since no error was indicated and the execution is correct: 14H Job 7th t u Data v xxH xxH xxH xxH
Irrelevant
xxH
xxH
xxH
xxH Irrelevant
xxH
xxH
xxH
CPU waits at 4th segment for acknowledgement: 14H Job t u Data v xxH xxH xxH xxH
Irrelevant
2-83
Example of Sending, continued CPU Writes to ET 200S SI User program reads the following response of the module: CPU Reads ET 200S SI
xxH
xxH
xxH
xxH Irrelevant
xxH
xxH
xxH
CPU sends nothing new (outputs remain the same) and waits for the last acknowledgment of the module; it is indicated that the message was sent to the communication partner.
u Data
xxH
xxH
xxH
xxH
Irrelevant
Several CPU cycles later the user program sees the 74H following response of the module: Job ackn.
nnnnH Status
xxH
xxH
xxH Irrelevant
xxH
xxH
CPU writes the idle code to the job and terminates the job.
The user program reByte 0 1 2 3 4 5 6 7 ads the idle code of the 00H nnnnH xxH xxH xxH xxH xxH module in several cycles until the status Job ackn. Status Irrelevant indicates that a received message is 0000H = no received message available Status: 0001H = received message available available: 0B01H = receive buffer is more than two-thirds full. CPU writes receive job: Byte 0 1 2 20H Job xxH xxH 3 xxH 4 xxH 5 xxH 6 xxH 7 xxH
Irrelevant
2-84
Next cy- User program reads the cle (n + 1) following response of the module (module acknowledges receipt, responds with the first 21H segment, and increments the execution Job ackn. number):
0006H Length
c Data
CPU writes job to acknowledge the 1st segment: 21H Job Next cy- User program reads the cle (n + 2) 2nd segment of the module: xxH xxH xxH xxH xxH xxH xxH
Irrelevant
22H
xxH
xxH
xxH
xxH
xxH
xxH
Irrelevant
CPU writes job to acknowledge the 2nd segment: 22H Job xxH xxH xxH xxH xxH xxH xxH
Irrelevant
Next cy- Module returns to idle cle (n + 3) state after the first 00H nnnnH receive transaction is completed. Job ackn. StatusUS CPU terminates the job.
xxH
xxH
xxH Irrelevant
xxH
xxH
2-85
Example of Reading the V.24 Signal Status CPU writes to ET 200S SI User program reads the idle code of the module: CPU reads ET 200S SI
Byte
0 00H
3 xxH
4 xxH
5 xxH Irrelevant
6 xxH
7 xxH
nnnnH Status
Job ackn.
CPU writes the job to read the V.24 signal status: Byte 0 1 2 3 4 5 6 30H Job 2nd User program reads the following response of the module: xxH xxH xxH xxH xxH xxH
7 xxH
Irrelevant
nnnnH Signals
xxH
xxH
xxH Irrelevant
xxH
xxH
CPU writes the acknowledgement and accepts the execution number. 31H Job 3rd xxH xxH xxH xxH xxH xxH xxH
Irrelevant
Module returns to idle state after the first 00H transaction is completed. Job ackn. CPU terminates the job.
nnnnH Status
xxH
xxH
xxH Irrelevant
xxH
xxH
2-86
Example of Writing V.24 Signals CPU writes to ET 200S SI User program reads the idle code of the module: CPU reads ET 200S SI
Byte
0 00H
3 xxH
4 xxH
5 xxH Irrelevant
6 xxH
7 xxH
nnnnH Status
Job ackn.
CPU writes the job to write the V.24 signals: Byte 0 1 2 3 4 5 40H Job nnnnH
Signal states MSB 00
6 xxH
7 xxH
xxH
xxH
xxH Irrelevant
2nd
nnnnH Status
xxH
xxH
xxH Irrelevant
xxH
xxH
CPU writes the idle state to the output byte: 00H Job 3rd xxH xxH xxH xxH xxH xxH xxH
Irrelevant
User program reads the following response of the module (module returns to 00H the idle state at the end of the operation). Job ackn.
nnnnH Status
xxH
xxH
xxH Irrelevant
xxH
xxH
CPU writes the idle code to the job and terminates the job.
2-87
Table 2-26
Parameters for Data Flow Control Parameter Value Range for Data Flow Control with XON/XOFF
Description Parameter block number Length XON character XOFF character Waiting time for XON to XOFF 20H 0004H
Value Range
Default Value
0 to 127 (7 data bits) 0 to 255 (8 data bits) 0 to 127 (7 data bits) 0 to 255 (8 data bits) 20 to 655350 in 10 ms increments
Parameter Value Range for Data Flow Control with RTS/CTS Byte 1 2 and 3 4 and 5 Description Parameter block number Length Waiting time for CTS = ON 21H 0002H 20 to 655350 in 10 ms increments 0002H 200 (2000 ms) Value Range Default Value
Parameter Value Range for the Automatic Operation of RS-232C Auxiliary Signals Byte 1 2 and 3 4 and 5 6 and 7 Description Parameter block number Length Time for RTS = OFF after the transfer Waiting time for CTS = ON after RTS = ON 22H 0004H 0 to 655350 in 10 ms increments 0 to 655350 in 10 ms increments 0004H 1 (10 ms) 1 (10 ms) Value Range Default Value
2-88
Sample Sequence for XON/XOFF CPU writes to ET 200S SI User program sees the following idle code of the module: Byte 0 00H Job ackn. Byte 0 50H Job 1 xxH 2 xxH Irrelevant 3 xxH Job: Send parameter code (1 0 1 or 5H) plus execution number 0 50H Job ackn. CPU sends 1st segment because the job has been accepted. 51H Job 20H Data flow 0004H Send length Job: Continue the parameters and increment the execution number Data flow: code for data flow parameters 51H Job ackn. CPU sends 2nd segment since no error was indicated: 52H Job 0BH DC1 0DH DC3 00H Waiting time for XON to XOFF - msB xxH xxH Irrelevant xxH xxH xxH Irrelevant xxH CPU reads ET 200S SI 1 nnnnH Status 2 3 xxH Irrelevant
2nd
3rd
4th
xxH
xxH Irrelevant
xxH
CPU sends 3rd segment since no error was indicated: 53H Job C8H Waiting time for XON to XOFF - LSB xxH xxH
Irrelevant
2-89
Sample Sequence for XON/XOFF, continued CPU writes to ET 200S SI User program sees the following response of the module: CPU reads ET 200S SI
xxH
xxH Irrelevant
xxH
CPU repeats 3rd segment and waits for job acknowledgment. 53H Job C8H Waiting time for XON to XOFF - LSB xxH xxH
Irrelevant
6th
nnnnH Status
xxH Irrelevant
CPU writes the idle code to the job and terminates the job. 00H Job xxH xxH Irrelevant xxH
Error Conditions
The serial interface module issues an error in response to the following conditions: If the send job is longer than 200 bytes, the module responds with a job end acknowledgment, and the status word contains the error code. The CPU then writes an idle code to the job and terminates the job. If a receive job has been sent to the module, and the received message contains an error, the module accepts the receive job code with the execution number zero, and the status word contains the error code. The CPU then writes an idle code to the job and terminates the job. If a receive job has been sent to the module and no received message is available, the module accepts the receive job code with the execution number zero, and the status word contains the value 0101H. This isnt an error condition but it does prevent the module being disabled in receive job mode and waiting for a receive message, thus enabling send jobs to be executed. The CPU writes an idle code to the job and terminates the job.
2-90
Exceptions
As already mentioned, a particular operation (a send job, for example) cannot be initiated in the user program before the module is in the idle state. After a job has been sent, the operation must wait until the module has accepted the job code before the operation in question can be executed. In the case of operations with segmenting during execution, the following exceptions may occur:
Note In the following descriptions of a send or parameter assignment operation, the sender refers to the CPU and the recipient to the serial interface module. In the case of a receive operation, the sender refers to the serial interface module and the recipient to the CPU.
Error: The sender monitors the error bit of the recipient for a segmented operation. If the error bit is set, the sender sends the segments again, starting with the next segment after the number reported by the recipient. Execution number not in the correct order: If the recipient receives a segment during a segmented operation with an execution number that is not the previous execution number + 1, it must report an error and the last execution number received in the response. Modified job code: If the recipient receives a segment with a job code that differs from the code with which the segmented operation began, and if it is not 000 or 111, the recipient ignores the other code and discards the associated data. If the recipient receives a segment with the job code of the idle state during a segmented operation, the operation is aborted and the idle state is adopted without an error bit being set. If the recipient receives a segment with the job code of the job end acknowledgment during a segmented operation, the operation is aborted and the idle state is adopted without an error bit being set. If during a segmented operation the sender receives a response with another job code, the message must be aborted. The idle code is then set again, the module must go into the idle state, and the operation must be executed again.
2-91
2.13
Diagnostics
Overview
The diagnostic functions of the ET 200S SI module permit you to locate errors quickly even during operation. The following diagnostic options are available: Diagnosis via the status LEDs on the front panel of the ET 200S SI module Diagnosis via the STATUS output of the function blocks Diagnosis via PROFIBUS slave diagnosis
Hardware fault Firmware error Parameter assignment error Wire break or loose cable between the module and the communication partner Only detected in the case of RS-422 interface connections when the initial state of the receive line is R(A) 5V/R(B) 0V. Communication error (parity, frame error, buffer overflow)
2-92
Example: Figure 2-26 shows the contents of the STATUS parameter in the event of a job being aborted for a cold restart, warm restart or rest (1EH event class, event number 0DH).
In the event of a job being aborted due to a cold restart, warm restart or reset 24 STATUS X X X 1 1 1 1 20 27 0 0 0 0 0 1 1 0 20 1
Reserve
Figure 2-26 Example: STATUS Parameter for Event Class 1EH, Event 0DH
Event Class 5 (05H): Error while processing CPU job Event Number (05) 02H Event The job is not permitted in this mode of the ET 200S SI module (the device interface is not parameterized, for example). Invalid message frame length What to Do Evaluate the diagnostic interrupt, and eliminate the error accordingly. The message frame is longer than 200 bytes. The rest of the message frame (> 200 bytes) is still being received by the ET 200S SI module, and the first segment of the message frame is therefore discarded. Select a smaller message frame length. Either change the parameters of the function block (FB6 F_XON, FB7 F_RTS, FB8 F_V24) or change the data flow control of the ET 200S SI module in the hardware configuration so that they correspond.
(05) 0EH
(05) 50H
The request to update the parameters is invalid for the current data flow control of the ET 200S SI module.
2-93
Diagnostic Messages in the STATUS Parameter, continued Event Frame execution error in communication between the ET 200S SI module and the programmable logic controller. The error occurred when a received message frame of the ET 200S SI module was transferred to the programmable logic controller. With 3964(R) only: Error during connection setup: After STX was sent, NAK or any other code (except for DLE or STX) was received. With 3964(R) only: Acknowledgment delay time exceeded: After STX was sent, no response came from the partner within acknowledgment delay time. With 3964(R) only: Termination by partner: During the current send operation, one or more characters were received by the partner. What to Do The module and the programmable logic controller have aborted the transfer. Repeat the receive job; the ET 200S SI module sends the received message again.
Event Class 7 (07H): Send Error (07) 02H Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line. The partner device is too slow or not ready to receive, or there is a break in the transmission line, for example. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line. Check whether the partner is also indicating an error, possibly because not all the transmission data has arrived (e.g. due to a break in the send line) or due to serious faults or because the partner device has malfunctioned. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line. Check whether the partner is also indicating an error, possibly because not all the transmission data has arrived (e.g. due to a break in the send line) or due to serious faults or because the partner device has malfunctioned. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line. Check whether the partner is also indicating an error, possibly because not all the transmission data has arrived (e.g. due to a break in the send line) or due to serious faults or because the partner device has malfunctioned. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line.
(07) 03H
(07) 04H
(07) 05H
(07) 06H
With 3964(R) only: Error at end of connection: Partner rejected message frame at end of connection with NAK or a random string (except for DLE), or Acknowledgment code (DLE) received too early.
2-94
Table 2-28
Event Class 7 (07H): Send Error (07) 07H With 3964(R) only: Acknowledgment delay time exceeded at end of connection or response monitoring time exceeded after send message frame: After connection cleardown with DLE ETX, no response received from partner within acknowledgment delay time. With ASCII driver only: The waiting time for XON or CTS = ON has elapsed. With 3964(R) only: Initialization conflict cannot be solved because both partners have high priority. With 3964(R) only: Initialization conflict cannot be solved because both partners have low priority. With 3964(R) only: Error during connection setup: In idle mode, one or more random codes (other than NAK or STX) were received, or After an STX was received, the partner sent more codes without waiting for the response DLE. After power on of the partner: While the partner is being activated, the module receives an undefined code. With 3964(R) only: Logical error during receiving: After DLE was received, a further random code (other than DLE or ETX) was received.
Partner device faulty or too slow. If necessary, use an interface test device switched into the transmission line to check.
(07) 08H
The communication partner has a fault, is too slow or is switched offline. Check the communication partner or, if necessary, change the parameterization. Change the parameterization.
(07) 0BH
(07) 0CH
Event Class 8 (08H): Receive Error (08) 02H Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line.
(08) 05H
Check whether the partner DLE in the message frame header and in the data string is always in duplicated or the connection is cleared down with DLE ETX. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line. Partner device faulty or too slow. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line.
(08) 06H
Character delay time exceeded: Two successive characters were not received within the character delay time, or With 3964(R) only: 1st character after sending of DLE during connection setup was not received within the character delay time. With 3964(R) only: Impermissible message frame length: A message frame of length 0 was received.
(08) 07H
Receipt of a message frame of length 0 is not an error. Check why the communication partner is sending frames without user data.
2-95
Table 2-28
Event Class 8 (08H): Receive Error (08) 08H With 3964(R) only: Error in block check character (BCC) Internally calculated value of BCC does not match BCC received by partner at end of connection. With 3964(R) only: The number of repeat attempts must be set immediately. Check whether the connection is subject to serious disturbances; in this case, you may also occasionally see error codes. Check for malfunctioning of the partner device, possibly using an interface test device (FOXPG) switched into the transmission line. Parameterize the same block wait time in the communication partner as in the module. Check for malfunctioning of the communication partner, possibly by using the interface test device switched into the transmission line. The P_RCV FB must be called more frequently.
(08) 09H
(08) 0AH
There is no free receive buffer available: No empty receive buffer was available to receive the data.
Event Class 8 (08H): Receive Error (08) 0CH Transmission error: Transmission error (parity error, stop bit error, overflow error) detected. With 3964(R) only: If this occurs during a send or receive operation, repetitions are initiated. If a faulty character is received in idle mode, the error is reported immediately so that disturbances on the transmission line can be detected early. If the SF LED (red) is on, there is an interruption on the connecting cable between the two communication partners. BREAK: The receive line to the partner is interrupted. With ASCII driver only: Parity error If the SF LED (red) is on, there is an interruption on the connecting cable between the two communication partners. With ASCII driver only: Character frame error If the SF LED (red) is on, there is an interruption on the connecting cable between the two communication partners. With ASCII driver only: More characters were received after the module had sent XOFF or set CTS to OFF Disturbances on the transmission line cause message frame repetitions, thus lowering user data throughput. Danger of an undetected error increases. Correct fault by changing system setup or line installation. Check the connecting cable of the communication partners, or check whether both devices have the same setting for the transmission rate, parity, and number of stop bits.
Reestablish the connection, or switch the partner on. Check the connecting cable of the communication partners, or check whether both devices have the same setting for the transmission rate, parity, and number of stop bits. Correct by changing system setup or line installation. Check the connecting cable of the communication partners, or check whether both devices have the same setting for the transmission rate, parity, and number of stop bits. Correct fault by changing system setup or line installation. Reparameterize the communication partner, or read the data of the module more quickly.
(08) 11H
(08) 12H
2-96
Table 2-28
Event Class 8 (08H): Receive Error (08) 18H With ASCII driver only: DSR = OFF or CTS = OFF The DSR or CTS signals are switched to OFF by the partner before or during a send operation. Check the control of the RS-232C auxiliary signals at the partner.
Event Class 30 (1EH): Errors in Communication Between the Module and the CPU (1E) 0DH (1E) 0EH Job aborted due to a cold restart, warm restart, or reset Static error during the call of the DP_RDDAT SFC. You can evaluate the return value (RET_VAL) of the SFC in the SFCERR variable in the instance DB. Static error during the call of the DP_WRDAT SFC. You can evaluate the return value (RET_VAL) of the SFC in the SFCERR variable in the instance DB. Load the SFCERR variable from the instance DB.
(1E) 0FH
(1E) 10H
Static error when the RD_LGADR SFC was Load the SFCERR variable from the instance called. The return value RET_VAL of the SFC DB. is available made for evaluation in the SFCERR variable in the instance DB. Parameter out of range. Change the input of the function block so that it is within the valid range.
Impermissible number of bytes set in the LEN Keep to the value range of 1 to 200 bytes. parameter of the FBs.
Event Class 11 (0BH): Warning (0B) 01H Receive buffer is more than two-thirds full.
2-97
Buffer overflow; message length over- The P_RCV FB must be called more flow frequently. 3964(R) only: Message with a length of 0 sent. Internal module error occurred. Parameters have not been assigned to the module. Frame error, parity error Check why the communication partner is sending frames without user data. Replace the module. Correct the parameter assignment. Check the communication settings.
2-98
2.14
Technical Specifications
Protocol drivers supplied Transmission rates with 3964(R) protocol Transmission rates with ASCII drivers Character frame (10 bits or 11 bits)
3964(R) driver ASCII driver 110, 300, 600, 1200, 2400, 4800, 9600, 19,200 bits per second (half-duplex) 110, 300, 600, 1200, 2400, 4800, 9600, 19,200 bits per second (full-duplex) Number of bits per character: 7 or 8 Number of start/stop bits: 1 or 2 Parity: none, even, odd, any
Technical Specifications of the RS-232C Interface Interface RS-232C signals RS-232C, 8 terminals TXD, RXD, RTS, CTS, DTR, DSR, DCD, PE All the above are electrically separated from the internal power supply of the ET 200S module. Maximum transmission distance 15 m
Technical Specifications of the RS-422/485 Interface Interface RS-422 signals RS-485 signals RS-422, 5 terminals RS-485, 3 terminals TXD (A), RXD (A), TXD (B), RXD (B), PE R/T (A), R/T (B), PE All the above are electrically separated from the internal power supply of the ET 200S module. Maximum transmission distance 1200 m
2-99
Technical Specifications
Dimensions and Weight Dimensions W H T (in mm) Weight 15 x 81 x 52 Approx. 50 g Data for Specific Modules RS-232C Status, Interrupts, Diagnostics Status display Diagnostic functions Green LED (TX) Green LED (RX)
For capacitive load Short-circuit protection Short-circuit current Voltage on the outputs or inputs to PE (ground)
Voltage, Currents, Potentials Rated supply voltage of the electronics (L+) 24 VDC Yes
External protection equipment is required in the input wiring of the user voltage: Lightning conductor, standard top-hat rail adapter Lightning conductor, protective module type KTAD-24V
Yes Yes
No Yes
500 VDC
500 VAC
2-100
Modbus/USS
3
Description Product Overview Terminal Assignment Diagrams Modbus Transmission Protocol Modbus Master Driver Modbus Slave Driver Diagnostics USSMaster Start-up Characteristics and Operating Modes of the ET 200S Serial Interface Modbus/USS Driver Technical Specifications Page 3-2 3-5 3-14 3-18 3-41 3-84 3-99 3-121 3-125
Chapter Overview
Section 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9
You will find detailed information on the hardware configuration, setup, wiring, commissioning, diagnostics, and the technical specifications of the ET 200S distributed I/O system in the Distributed I/O Device manual.
3-1
Modbus/USS
3.1
Product Overview
Description
The ET 200S Serial Interface Modbus/USS Module is a plug-in module in the ET 200S family and provides serial communication access using three hardware interfaces (RS-232C, RS-422, and RS-485) and two software protocols: Modbus USS Master The ET 200S Serial Interface Modbus/USS module allows you to exchange data between programmable controllers (PLCs) or computers by means of a point-to-point connection. All communications occur by way of serial asynchronous transfers. You select the communication mode when you assign the module parameters within the Hardware Configuration of STEP 7 or your non-S7 configuration application. The module appears in the hardware catalog in the following six versions: Modbus Master (8 Byte) Modbus Master (4 Byte) Modbus Slave (8 Byte) Modbus Slave (4 Byte) USS Master (8 Byte) USS Master (4 Byte) Eight-byte data transfers maximize throughput efficiency but take up more I/O space on the ET 200S rack. Four-byte data transfers take up less I/O space on the ET 200S rack but provide less throughput efficiency. The choice of module version depends upon your application requirements.
3-2
Modbus/USS
SF
RS232 MODE 1 TXD 2 RTS 3 DTR 4 DCD 5 RXD 6 CTS 7 DSR 8 PE RS422 MODE 1 TXD(B) 2 TXD(A) 5 RXD(B) 6 RXD(A) 8 PE RS485 MODE 1 T/RXD(A) 2 T/RXD(B) 8 PE
X2 3 4 TX RX
6ES7138-4DF10 -0AB0
The ET 200S Serial Interface Modbus/USS Module provides the following functions: Integrated serial interface according to RS-232C, RS-422, or RS-485 Transmission rate up to 38.4 Kbaud, half-duplex Integration of the following transmission protocols in the module firmware: Modbus Master driver Modbus Slave driver USS Master driver
3-3
Modbus/USS
Module parameterization determines the functionality of the drivers. Table 3-1 lists the functions of each selected driver interface.
Table 3-1 Functions of the Modbus/USS Module Drivers Function Modbus drivers Automatic use of RS 232C signals USS Master driver RS-232C Yes Yes No RS-422 Yes No No RS-485 Yes No Yes
3-4
Modbus/USS
3.2
3.2.1
Terminal Assignment
Wiring Guidelines
The cables (terminals 1 through 8) must be shielded and the shield must be supported at both ends. Use the shield contact elements for this purpose. For information about these elements, refer to the ET 200S Accessories section in the ET 200S Distributed I/O Device Manual .
Remarks Mode: Full-duplex TXD RXD RTS CTS DTR DSR PE Transmitted data Received data Request to send Clear to send Data terminal ready Data set ready Ground
6 3 7 4 8
3-5
Modbus/USS
1 5 2 6 8
PE
1 2 8
R/T (B)
PE
3-6
Modbus/USS
RXD
TXD
TXD
RXD
2 6 7 3 4 8
8 7 4 6 1 5
Shield contact
Casing shield
Figure 3-2
3-7
Modbus/USS
RXD
TXD
TXD
RXD
2 6 7 3 4 8
5 4 20 6 8 7
Shield contact
Casing shield
Figure 3-3
3-8
Modbus/USS
2 1 Sender 6 5 Receiver 8
TXD(A) TXD(B)
RXD(A) RXD(B)
4 11 Receiver 2 9 Sender 8
RXD(A) RXD(B)
TXD(A) TXD(B)
PE
GND
Shield Cable type LIYCY 3 x 2 x 0.14. (Belden 8103 or equivalent) T(A)/T(B) and R(A)/R(B) twisted-pair Casing shield
Shield contact
Figure 3-4
Note For cables longer than 50m, attach a terminating resistor of approximately 330 , for trouble-free data traffic. See Figure 2-4. The maximum length of this cable type at 38400 baud is 1200m.
3-9
Modbus/USS
1 2 Sender 1 2 Receiver 8
T(A) T(B)
Shield contact
Casing shield
Figure 3-5
Note For cables longer than 50m, attach a terminating resistor of approximately 330 , for trouble-free data traffic. See Figure 2-5. The maximum length of this cable type at 38400 baud is 1200m.
3.2.2
RS-232C Interface
The RS-232C interface is a voltage interface used for serial data transmission in compliance with the RS-232C standard. Table 2-4 shows the properties for RS-232C.
3-10
Modbus/USS
Table 3-6
Signals of the RS-232C Interface Description Voltage interface Standard ET 200S 8-position terminal connector TXD, RXD, RTS, CTS, DTR, DSR, DCD, GND Up to 38.4 Kbaud Up to 15m, cable type LIYCY 7 x 0.14 DIN 66020, DIN 66259, EIA RS-232C, CCITT V.24/V.28 IP 20
Property Type Front connector RS-232C signals Transmission Rate Cable Length Standards Protection
RS-232C Signals
The Modbus/USS module supports the RS-232C signals (see Table 2-5).
Table 3-7 Signal TXD RXD RTS CTS Signals of the RS-232C Interface Designation Transmitted Data Received Data Request To Send Clear To Send Meaning Transmission line is held on logic 1 in idle state. Receive line must be held on logic 1 by communications partner. On: Module is ready to send. Off: Module does not send. Communication partner can receive data from ET 200S. Serial Interface module expects the signal as a response to RTS On. On: Module is active and ready for operation. Off: Module is not active and not ready for operation. DSR Data Set Ready On: Comm partner is active and ready for operation. Off: Comm partner is not active and not ready for operation. DCD Data Carrier Detect Carrier signal when connecting a modem.
DTR
3-11
Modbus/USS
Automatic Use of the Secondary Signals The automatic use of the RS-232C secondary signals on the module is implemented as follows: As soon as the module is switched by means of parameterization to an operating mode with automatic use of the RS-232C secondary signals, it switches the RTS line to OFF and the DTR line to ON (module ready for use). Message frames cannot be sent and received until the DTR line is set to ON. As long as DTR remains set to OFF, no data is received via the RS-232C interface. If a send request is made, it is aborted with an error message. When a send request is made, RTS is set to ON and the parameterized data output waiting time starts. When the data output time elapses and CTS = ON, the data is sent via the RS-232C interface. If the CTS line is not set to ON within the data output time so that data can be sent, or if CTS changes to OFF during transmission, the send request is aborted and an error message generated. After the data is sent, the RTS line is set to OFF after the parameterized time to RTS OFF has elapsed. The ET 200S does not wait for CTS to change to OFF. Data can be received via the RS-232C interface as soon as the DSR line is set to ON. If the receive buffer of the module threatens to overflow, the module does not respond. A send request or data receipt is aborted with an error message if DSR changes from ON to OFF.
Note Automatic use of the RS-232C secondary signals is only possible in half-duplex mode.
Note The time to RTS OFF must be set in the parameterization interface so that the communication partner can receive the last characters of the message frame in their entirety before RTS, and thus the send request, is taken away. The data output waiting time must be set so that the communication partner can be ready to receive before the time elapses.
3-12
Modbus/USS
Time Diagram for Secondary Signals Figure 2-5 illustrates the chronological sequence of a send request:
RTS
ON OFF ON OFF 1 0 t Send request: RTS = ON Partner: CTS = ON Data output waiting time elapsed: Send Data output waiting time Transmission terminated Time to RTS OFF elapsed Partner: CTS = OFF Time to RTS OFF
CTS
TXD
Figure 3-6 Time Diagram for Automatic Use of the RS-232C Secondary Signals
3.2.3
RS-422/485 Interface
The RS-422/485 interface is a voltage-difference interface used for serial data transmission in compliance with the RS-422/485 standard. Table 2-6 shows the properties for the RS-422/485 interface.
Table 3-8 RS 422/485 Interface Properties Description Voltage-difference interface Standard ET 200S 8-position terminal connector TXD (A) , RXD (A) , TXD (B), RXD (B), GND R/T (A), R/T (B), GND Up to 38.4 Kbaud Up to 1200m, cable type LIYCY 7 x 0.14 EIA RS-422/485, CCITT V.11/V.27 IP 20
Property Type Front connector RS-422 signals RS-485 signals Transmission Rate Cable Length Standards Protection
Serial Interface Module ET 200S A5E00124881-01
3-13
Modbus/USS
3.3
3.3.1
Message Structure
The data exchange Master-Slave and/or Slave-Master begins with the Slave Address and is followed by the Function Code. Then the data are transferred. The data exchange Master-Slave and/or Slave-Master has the following elements: SLAVE ADDRESS FUNCTION CODE DATA CRC CHECK Modbus Slave Address Modbus Function Code Message Data: Byte_Count, Coil_Number, Data Message Checksum
The structure of the data field depends on the function code used. The CRC check is transmitted at the end of the message. Table 3-1 shows the components of the message structure.
Table 3-9 Message Structure FUNCTION Byte DATA n Byte CRC CHECK 2 Byte
ADDRESS Byte
3.3.2
Slave Address
The slave address can be within the range 1 to 255. The address is used to address a defined slave on the bus.
Broadcast Message The master uses slave address zero to address all slaves on the bus.
Note Broadcast Messages are only permitted in conjunction with Function Codes 05, 06, 15, and 16.
3-14
Modbus/USS
3.3.3
3.3.4
3-15
Modbus/USS
3.3.5
3.3.6
Exception Responses
On recognition of an error in the request message from the master (such as Register Address Illegal), the slave performs the following actions: The slave sets the highest value bit in the function code of the reply message. The slave transmits one byte of error code (Exception Code) to describe the reason for the error.
3-16
Modbus/USS
Upon receipt of an error code reply message by the driver, the current job is completed with error. An error number corresponding to the received error code (Exception Code 1-7) is also entered in the SYSTAT area. No entry is made in a S_RCV destination data block. Table 3-4 lists the error codes that are sent by the module.
Table 3-12 Error Codes Exception Code 01 02 Description Illegal Function Illegal Data Address Possible Cause Illegal function code received Access to a SIMATIC area which is not enabled (see parameter assignment -areas, limitation) Length greater 2040 bits or 127 registers, data field not FF00 or 0000 for FC05, diagnostics subcode <> 0000 for FC08. Initialization by Modbus communications FB not yet carried out or FB reports error Error during data transfer module CPU (for example, DB does not exist, maximum transferable data length exceeded (block size CPU <->module)
03
04
3-17
Modbus/USS
3.4
3.4.1
3.4.2
3-18
Modbus/USS
S_SEND REQ
S_SEND DONE
S_RCV EN_R
S_RCV NDR
The data transmission is initiated by a positive edge at the REQ input. A data transmission operation can run over several calls (program cycles), depending on the amount of data involved. The S_SEND FB can be called in the cycle with the signal state 1 at the parameter input R. This aborts the transmission to the module and sets the S_SEND FB back to its initial state. Data that has already been received by the module is still sent to the communication partner. If the R input is statically showing the signal state 1, this means that sending is deactivated. The LADDR parameter specifies the address of the ET 200S Serial Interface to be addressed. The DONE output shows request completed without errors. ERROR indicates whether an error has occurred. If there was an error, the corresponding event number is displayed in STATUS. If there were no errors, STATUS has the value 0. DONE and ERROR/STATUS are also output when the S_SEND FB is reset. In the event of an error, the binary result BR is reset. If the block is terminated without errors, the binary result has the status 1. Table 4-1 shows the STL and LAD representations of FB3 S_SEND.
3-19
Modbus/USS
Note The function block S_SEND does not have a parameter check. If there are invalid parameters, the CPU branches to the STOP mode. Before the module can process an activated request after the CPU has changed from STOP to RUN mode, the ET 200S-CPU start-up mechanism of the S_SEND FB must be completed. Any requests initiated in the meantime are not lost, but are transmitted once the start-up coordination with the module is finished.
Calling FB3
Table 3-13 STL and LAD representations of FB3 S_SEND
STL Representation CALL REQ: R: LADDR: DB_NO: DBB_NO: LEN: DONE: ERROR: STATUS: S_SEND, I_SEND = = = = = = = = =
R
LADDR DB_NO DBB_NO LEN
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
Assignment in the Data Area The S_SEND FB works with an instance DBI_SEND, whose number is specified in the call. The data in the instance DB cannot be accessed.
3-20
Modbus/USS
Note Exception: If the error STATUS==W#16#1E0F occurs, you can consult the SFCERR variable for more information on the error. This error variable can only be loaded via a symbolic access to the instance DB.
FB3 S_SEND Parameters Table 4-2 lists the parameters of S_SEND (FB3).
Table 3-14 FB3: S_SEND Parameters Name REQ R Type INPUT INPUT Data Type BOOL BOOL Description Initiates request with positive edge Aborts request Current request is aborted and sending is blocked. The basic address is taken from STEP 7. Send DB No.; CPU-specific, (zero is not allowed) 0 DBB_NO 8190 Transmitted data as of data word LEN INPUT INT Data length 1 LEN 200, specified in number of bytes STATUS parameter = = 16#00 STATUS parameter contains error details If ERROR = = 1, STATUS parameter contains error details Permitted Values, Comment
LADDR DB_NO
INPUT INPUT
INT INT
DBB_NO
INPUT
INT
Request completed without errors Request completed with errors Error Specification
1 After
a correct send request, this parameter is available for one CPU cycle.
3-21
Modbus/USS
Time Sequence Chart for FB3 S_SEND Figure 4-2 illustrates the behavior of the parameters DONE and ERROR, depending on how the REQ and R inputs are wired.
REQ
DONE
ERROR Completion with error 1st/nth part of SEND RESET transmitted RESET transmitted Completion without error Completion without error
Sending request
Figure 3-8
Note The REQ input is edge-triggered. A positive edge at the REQ input is adequate. It is not required that the RLO (result of logical operation) is 1 during the whole transmission procedure.
3-22
Modbus/USS
FB2 S_RCV: Receiving Data from a Communication Partner The S_RCV FB transmits data from the module to an S7 data area specified by the parameters DB_NO and DBB_NO. The S_RCV FB is called statically (without conditions) for data transmission in the cycle or alternatively in a time-controlled program. With the (static) signal state 1 at parameter EN_R, the software checks whether data can be read by the ET 200S Serial Interface. An active transmission can be aborted with signal state 0 at the EN_R parameter. The aborted receive request is terminated with an error message (STATUS output). Receiving is deactivated as long as the EN_R parameter shows the signal state 0. A data transmission operation can run over several calls (program cycles), depending on the amount of data involved. If the function block recognizes signal state 1 at the R parameter, then the current transmission request is aborted and the S_RCV FB is set to the initial state. Receiving is deactivated as long as the R parameter shows the signal state 1. If signal state 0 returns, the aborted message frame is received again from the beginning. The LADDR parameter defines the ET 200S Serial Interface to be addressed. The NDR output shows request completed without errors/data accepted (all data read). ERROR indicates whether an error has occurred. If there was an error, the corresponding error number is displayed under STATUS when the receive buffer is more than 2/3 full. STATUS contains a warning after each S_RCV call when ERROR is not set. If there were no errors or warnings, STATUS has the value of 0. NDR and ERROR/STATUS are also output when the S_RCV FB is reset (parameter LEN = = 16#00). In the event of an error, the binary result BR is reset. If the block is terminated without errors, the binary result has the status 1. Table 4-3 shows the STL and LAD representations of FB2 S_RCV.
Note The function block S_RCV does not have a parameter check. If there are invalid parameters, the CPU can branch to STOP mode. Before the module can receive a request after the CPU has changed from STOP to RUN mode, the ET 200S-CPU start-up mechanism of the S_RCV FB must be completed.
3-23
Modbus/USS
STL Representation CALL S_RCV, I_RCV EN_R: R: LADDR: DB_NO: DBB_NO: NDR: ERROR: LEN: STATUS: = = = = = = = = =
LAD Representation I_RCV S_RCV EN EN_R R LADDR DB_NO DBB_NO ENO NDR ERROR LEN STATUS
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
Assignment in the Data Area The S_RCV FB works with an instance DBI_RCV, whose number is specified in the call. The data in the instance DB cannot be accessed. Table 4-4 shows the parameters for FB2 S_RCV.
Note Exception: If the error STATUS = = W#16#1E0D occurs, you can consult the SFCERR variable for more details of the error. This error variable can only be loaded via a symbolic access to the instance DB.
3-24
Modbus/USS
Table 3-16 FB2: S_RCV Parameters Name EN_R R LADDR DB_NO Type INPUT INPUT INPUT INPUT Data Type BOOL BOOL INT INT Description Enables data read Aborts request Basic address of ET 200S Serial Interface Data block number Active request is aborted and receiving is blocked. The basic address is taken from STEP 7. Receive DB No.; CPU-specific, (zero is not allowed) 0 DBB_NO 8190 Received data as of data word NDR1 OUTPUT BOOL Request completed without errors, data accepted Request completed with errors Length of message frame received Error Specification STATUS parameter = 16#00 STATUS parameter contains error details 1 LEN 200, specified in number of bytes If ERROR = = 1, STATUS parameter contains error details = Permitted Values, Comment
DBB_NO
INPUT
INT
ERROR1 LEN1
OUTPUT OUTPUT
BOOL INT
STATUS1
OUTPUT
WORD
1 After
a correct receive request, this parameter is available for one CPU cycle.
3-25
Modbus/USS
Time Sequence Chart for FB2 S_RCV Figure 4-3 illustrates the behavior of the parameters NDR, LEN and ERROR, depending on how the EN_R and R inputs are wired.
EN_R
NDR
ERROR
LEN (length)
Receiving deactivated
Figure 3-9
Note The EN_R must be set to statical 1. During the receive request, the EN_R parameter must be supplied with RLO 1 (result of logic operation).
3-26
Enable receive
No receive
Receiving
Receiving
Modbus/USS
3.4.3
Interface Type
3-27
Modbus/USS
Table 3-17 Modbus Master Driver Parameters, continued Parameter Transmission Rate Description Select the speed of data transmission in bits per second. Value Range 110 300 600 1200 2400 4800 9600 19200 38400 1 2 None Odd Even Even Default Value 9600
Stop Bits
Select the number of stop bits that are appended to each character to signal the end of a character transmission. The sequence of the data bits can be extended to include another bit, the parity bit. The addition of its value (0 or 1) brings the value of all the bits (data bits and parity bit) up to a defined status. None: Data is sent without a parity bit. Odd: The parity bit is set such that the total number of data bits (including the parity bit) with signal state 1 is odd. Even: The parity bit is set such that the total number of data bits (including the parity bit) with signal state 1 is even.
Parity
Response Time
The time allowed for the reply from the slave. Normal Operation Interference Suppression
2,000 ms
Operating Mode
Normal
1 Yes
Delete Serial Specify whether the receive buffer of Interface Receive the Serial Interface is to be deleted Buffer during Startup automatically when the CPU changes from STOP -> RUN mode (CPU start-up). You can thus ensure that in the Serial Interface receive buffer only message frames which were received after the CPU start-up can be fetched.
3-28
Modbus/USS
Half-Duplex (RS422) Four-Wire Operation In this operating mode, data are sent via the transmission line T(A),T(B) and received via the receiving line R(A),R(B). Error handling is carried out in accordance with the function set at the Driver Operating Mode parameter (Normal or Interference Suppression). Half-Duplex (RS485) Two-Wire Operation In this operating mode, the driver switches the 2-wire receiving line R(A),R(B) of the interface from send to receive operation. In this operating mode, all recognized transmission errors and/or BREAK before and after receive messages are ignored. BREAK level during message pauses is also ignored. The beginning of the receive message from the slave is recognized by means of the correctly-received slave address. The setting R(A) 0V, R(B) 5V (High) is recommended as the preset for the receiving line. Half-Duplex Receive Line Initial State This parameter specifies the initial state of the receive line for RS-422 and RS-485 modes. It is not used for RS-232C mode. Presetting of the Receiving Line: Presetting R(A) 5V, R(B) 0V (BREAK) The two-wire line R(A),R(B) is preset by the module as follows: R(A) --> +5V, R(B) --> 0V (VA - VB +0.3V).
This means that BREAK level occurs on the module in the event of a line break. Presetting R(A) 0V, R(B) 5V (High) The two-wire line R(A),R(B) is preset by the module as follows: R(A) --> 0V, R(B) --> +5V (VA - VB -0.3V).
This means that HIGH level occurs on the module in the event of a line break (and/or when it is idle, that is, when no slave is transmitting). The line status BREAK cannot be recognized. Transmission Rate The maximum transmission rate is the speed of data transmission in bits per second (bps). The maximum transmission rate of the module is 38400 bps in half-duplex operation. Data Bits The amount of data bits describes how many bits represent a character to be transmitted. The setting must always be 8 data bits. An 11-bit character frame must always be used; if you select none parity, then you must select 2 stop bits. Stop Bits The amount of stop bits defines the smallest possible time interval between two characters to be transmitted. An 11-bit character frame must always be used; if you select none parity, then you must select 2 stop bits. Parity The parity bit is for data safety. Depending on parameter assignment, it completes the amount of transmitted data bits to either an even or an odd number. If none parity is selected, then no parity bit is transmitted. This reduces the safety of data transmission. An 11-bit character frame must always be used. If you select none parity, then you must select 2 stop bits.
3-29
Modbus/USS
Response Time The reply monitoring time is the time the master spends waiting for a reply message from the slave after output of a request message. Normal Operation In this operating mode, all recognized transmission errors and/or BREAK before and after receive messages from the slave result in an appropriate error message. Interference Suppression If BREAK is recognized on the receiving line at the start of the receive message, or if the module interface block notices transmission errors, the driver considers the received message to be faulty and ignores it. The start of the receive message from the slave is recognized by the correctly received slave address. Transmission errors and/or BREAK are also ignored when they occur after the end of the receive message (CRC code). Character Delay Multiplier If a link partner cannot meet the time requirements of the Modbus specification, it is possible to multiply the character delay time tZVZ by means of multiplication factor fMUL. The character delay time should only be adjusted if the link partner cannot meet the required times. The resulting character delay time tZVZ is calculated as follows: tZVZ = tZVZ_TAB tZVZ_TAB fMUL
* fMUL
3.4.4
3-30
Modbus/USS
Table 3-18 Modbus Master Driver Parameters, continued Function Code 07 08 11 12 15 Description Read exception status Loop back diagnostic test Fetch communications event counter Fetch communications event log Force multiple coils Function in SIMATIC S7 Read bit-by-bit Read 2 words Read 70 bytes Write bit-by-bit (1...2040 bits) Write bit-by-bit (1...2040 bits) 16 Preset Multiple Registers Write word-by-word (1...127 registers) 8 bits status Event status and counter Event log Memory bits M Outputs Q Data block DB
3.4.5
3-31
Modbus/USS
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 Name data[1] Type WORD Actual Value W#16#1701 Comment Data
The driver enters the data of the reply message into the destination DB word by word. The first received byte is entered as the Low Byte of the first word data[1], the third received byte as the Low Byte of the second word data[2] and so on. If a quantity of less than 9 bits was read or if only one Low Byte was read, the value 00H is entered into the remaining High Byte of the last word.
3.4.6
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 Name data[1] data[2] Type WORD WORD Actual Value W#16#2604 W#16#0048 Comment Data Data
The driver enters the data of the reply message into the destination DB word by word. The first received byte is entered as the Low Byte of the first word data[1], the third received byte as the Low Byte of the second word data[2], and so on. If a quantity of less than 9 bits was read or if only one Low Byte was read, the value 00H is entered into the remaining High Byte of the last word.
3-32
Modbus/USS
3.4.7
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 Name data[1] data[2] Type WORD WORD Actual Value W#16#2123 W#16#2527 Comment Data Data
3.4.8
3-33
Modbus/USS
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 +4.0 Name data[1] data[2] data[3] Type WORD WORD WORD Actual Value W#16#2123 W#16#2527 W#16#3536 Comment Data Data Data
3.4.9
The slave must return the request message to the master unchanged (Echo).
3-34
Modbus/USS
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +1.0 +2.0 +4.0 Name Address Function Bit Address Bit State BYTE BYTE WORD WORD Type Actual Value B#16#5 B#16#5 W#16#0019 W#16#FF00 Comment Slave Address Function Code Bit Address Bit Status
3.4.10
3-35
Modbus/USS
3.4.11
The driver enters the individual bits of the reply message into the High Byte in the destination DBdata[1]. The Low Byte of data[1] remains unchanged. Value 1 is displayed as the length in parameter. The receive length will always be one.
3.4.12
3-36
Modbus/USS
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +1.0 +2.0 +4.0 Name Address Function Diag Code Test Value BYTE BYTE WORD WORD Type Actual Value B#16#5 B#16#8 B#16#0000 B#16#A5C3 Comment Slave Address Function Code Diagnostic Code Test Value
3.4.13
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 Name data[1] data[2] Type WORD WORD Actual Value W#16#FEDC W#16#0108 Comment Status Word Event Counter
3-37
Modbus/USS
3.4.14
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 +4.0 +6.0 +7.0 : +68.0 +69.0 Name data[1] data[2] data[3] bytedata[1] bytedata[2] : bytedata[63] bytedata[64] BYTE BYTE B#16#C2 B#16#D3 Type WORD WORD WORD BYTE BYTE Actual Value W#16#8765 W#16#0108 W#16#0220 B#16#01 B#16#12 Comment Status Word Event Counter Message Counter Event Byte 1 Event Byte 2 : Event Byte 63 Event Byte 64
3-38
Modbus/USS
3.4.15
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +1.0 +2.0 +4.0 Name Address Function Bit Address Bit Amount BYTE BYTE WORD INT Type Actual Value B#16#5 B#16#F W#16#0058 10 Comment Slave Address Function Code Bit Address Amount of Bits
The driver sends the data from the source destination DB word-by-word. The High Byte (byte 1) of the DB word location EF will be sent first then the Low Byte (byte 0) of the DB word location CD. If an odd number of bytes are sent then the last byte is the High Byte (byte 1).
3-39
Modbus/USS
3.4.16
3-40
Modbus/USS
3.5
3.5.1
Data Structures
Prior to project configuration of your S7 data structures, you should ensure that they are compatible with the user programs of the Modbus Master systems.
3-41
Modbus/USS
3.5.2
3-42
Modbus/USS
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
3.5.3
0.0
aaaaa
WORD W#16#0
Modbus Address Start Modbus Address End M Memory Modbus Address Start Modbus Address End Q output Modbus Address Start Modbus Address End Timer Memory
2.0
bbbbb
WORD W#16#0
W#16#7F7
4.0 6.0
uuuuu ccccc
W#16#1F4 W#16#7F8
01
8.0
ddddd
WORD W#16#0
W#16#FEF
10.0 12.0
ooooo eeeee
W#16#15 W#16#FF0
01
14.0
fffff
WORD W#16#0
W#16#17E7
16.0
ttttt
WORD W#16#0
W#16#28
3-43
Modbus/USS
Address
Name
Type
Initial Value
Comment
18.0
ggggg
WORD W#16#0
Modbus Address Start Modbus Address End Counter Memory Modbus Address Start Modbus Address End M Memory Modbus Address Start Modbus Address End I Input DB
20.0
hhhhh
WORD W#16#0
W#16#1FDF
22.0 24.0
zzzzz kkkkk
W#16#28 W#16#1FE0
02
26.0
lllll
WORD W#16#0
W#16#27D7
02
28.0 30.0
vvvvv nnnnn
W#16#320 W#16#27D8
02 02
32.0
rrrrr
WORD W#16#0
W#16#2FCF
02
34.0 36.0
W#16#11 W#16#6
02 03, 06, 13
38.0 40.0
W#16#2 W#16#1
DB Min. DB Number Used Max. DB Number Used Min. M Memory Used Max. M Memory Used Min. Q Memory Used Max. Q Memory Used
04 Limits
42.0
DB_Max
WORD W#16#0
W#16#6
Limits
44.0
M_Min
WORD W#16#0
W#16#1F4
Limits
46.0
M_Max
WORD W#16#0
W#16#4B0
Limits
48.0
Q_Min
WORD W#16#0
W#16#0
Limits
50.0
Q_Max
WORD W#16#0
W#16#64
Limits
3-44
Modbus/USS
3.5.4
Interface Type
3-45
Modbus/USS
Table 3-20 Modbus Slave Driver Parameters, continued Parameter Transmission Rate Description Select the speed of data transmission in bits per second. Value Range 110 300 600 1200 2400 4800 9600 19200 38400 1 2 None Odd Even Even Default Value 9600
Stop Bits
Select the number of stop bits that are appended to each character to signal the end of a character transmission. The sequence of the data bits can be extended to include the parity bit. The addition of its value (0 or 1) brings the value of all the bits (data bits and parity bit) up to a defined status. None: Data is sent without a parity bit. Odd: The parity bit is set such that the total number of data bits (including the parity bit) with signal state 1 is odd. Even: The parity bit is set such that the total number of data bits (including the parity bit) with signal state 1 is even.
Parity
222 Normal
1 Yes
Delete Serial Specify whether the receive buffer of Interface Receive the Serial Interface is to be deleted Buffer during Startup automatically when the CPU changes from STOP -> RUN mode (CPU start-up). You can thus ensure that in the Serial Interface receive buffer only message frames which were received after the CPU start-up can be fetched.
1
The shortest possible character delay time depends on the baud rate.
3-46
Modbus/USS
Transmission Rate The transmission rate is the speed of data transmission in bits per second (bps). The transmission rate of the module is 38400 bps in half-duplex operation. Data Bits The number of data bits describes how many bits represent a character to be transmitted. The setting must always be 8 data bits for this driver. An 11-bit character frame must always be used; if you select none parity, then you must select 2 stop bits. Stop Bits The number of stop bits defines the smallest possible time interval between two characters to be transmitted. An 11-bit character frame must always be used; if you select none parity, then you must select 2 stop bits. Parity The parity bit is for data safety; depending upon parameter assignment, it completes The number of transmitted data bits to either an even or an odd number. If None parity is selected, then no parity bit is transmitted. This reduces the safety of data transmission. An 11-bit character frame must always be used; if you select none parity, then you must select 2 stop bits. Slave Address Here you can specify the Modbus Slave address, to which the module should reply. The module only replies to messages where the received slave address is identical to the parameterized slave address. Messages to other slaves are not checked and not replied to. Normal Operation In this operating mode, all recognized transmission errors and/or BREAK before and after receive messages from the slave result in an appropriate error message. Interference Suppression If BREAK is recognized on the receiving line at the start of the receive message, or if the module interface block notices transmission errors, the driver considers the received message to be faulty and ignores it. The start of the receive message from the slave is recognized by means of the correctly-received slave address. Transmission errors and/or BREAK are also ignored when they occur after the end of the receive message (CRC code). Character Delay Multiplier If a link partner cannot meet the time requirements of the Modbus specification, it is possible to multiply the character delay time tZVZ by means of multiplication factor fMUL. The character delay time should only be adjusted if the link partner cannot meet the required times. The resulting character delay time tZVZ is calculated as follows: tZVZ tZVZ_TAB fMUL = tZVZ_TAB
* fMUL
3-47
Modbus/USS
3.5.5
All Modbus addresses listed in Table 5-3 refer to the transmission message level and do not refer to the user level in the Modbus master system.This means that the Modbus addresses in the transmission messages begin with 0000 Hex.
3-48
Modbus/USS
3.5.6
start_address
The Modbus bit address start_address is interpreted by the driver. For example, the FB81(S_MODB) checks that start_address is located within one of the areas which were specified in the conversion DB for FC 01, 05, 15 (from/to : Memory Bits, Outputs, Timers, Counters).
If Modbus bit address start_address is located in area From aaaaa to bbbbb From ccccc to ddddd From eeeee to fffff From ggggg to hhhhh Access is made to the following SIMATIC memory area Commence at memory bit Commence at output Commence at timer Commence at counter M uuuuu.0 Q ooooo.0 T ttttt C zzzzz
The address calculation for access (address conversion) is carried out as follows:
Access beginning with SIMATIC Memory byte Output byte Timer Counter Conversion Formula =((start_address- aaaaa) =((start_address- ccccc) =((start_address- eeeee) =((start_address- ggggg) / 8) / 8) / 16) / 16) + uuuuu + ooooo + ttttt + zzzzz
Access to Memory Bits and Outputs When accessing SIMATIC areas Memory Bits and Outputs, the remaining Rest Bit_Number is calculated and used to address the relevant bit within the first/last memory or output byte Access to Timers and Counters With the address calculation, it must be possible to divide the result either (start_address - eeeee) or (start_address - ggggg) by 16 without having a remainder (access word-by-word only starting from word limit).
3-49
Modbus/USS
bit_number
Values between 1 and 2040 are permitted as the bit_number (number of coils). This number of bits is read. When accessing SIMATIC areas Timers and Counters, it must be possible to divide the bit_number by 16 (access word-by-word only).
Application Example
Example for Conversion of Modbus Addressing:
Conversion of Modbus Addressing for Function Codes FC 01, 05, 15 Modbus address in transmission message From From From From 0 to 2048 to 4096 to 4608 to 2047 2559 4607 5119 SIMATIC memory area Commence at memory bit Commence at output Commence at timer Commence at counter M 1000.0 Q 256.0 T 100 C 200
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 Name Data[1] Type WORD Actual Value W#16#1701 Comment Data
The driver enters the data of the reply message into the destination DB word-by-word. The first received byte is entered as the Low Byte of the first word Data[1], the third received byte as the Low Byte of the second word Data[2], and so on. If a quantity of less than 9 bits was read or if only one Low Byte was read, the value 00H is entered into the remaining High Byte of the last word.
3-50
Modbus/USS
Address Calculation: The Modbus address start_address 0040 Hex (64 decimal) is located in the Memory Bit area:
Memory byte =((start_address- aaaaa) =((64 =1008; - 0) / 8) / 8) + uuuuu + 1000
Access is made starting from bit M 1008.0 up to and including M 1011.7. Number of Bits: The number of Modbus bits bit_number 0020 Hex (32 decimal) means that 32 Bits = 4 Bytes should be read. Table 5-3 shows additional examples for accessing data.
Table 3-22 Additional Examples for Accessing Data start_address Hex Decimal 0000 0021 0400 0606 0840 09E4 1010 10C0 1200 13E0 0 33 1024 1542 2112 2532 4112 4288 4608 5088 Mem. bit Mem. bit Mem. bit Mem. bit Output Output Timers Timers Counters Counters Access Calculation ((0 -0) ((33 ((1024 ((1542 ((2112 ((2532 ((4112 ((4288 ((4608 ((5088 - 0) -0) -0) / 8) +1000 / 8) +1000 / 8) +1000 / 8) +1000 Address ->M1000.0 ->M1004.1 ->M1128.0 ->M1192.6 ->Q264.0 ->Q316.4 ->T 101 ->T112 ->C200 ->C230
-2048) / 8) +256 -2048) / 8) +256 -4096) / 16) +100 -4096) / 16) +100 -4608) / 16) +200 -4608) / 16) +200
3-51
Modbus/USS
3.5.7
start_address
The Modbus bit address start_address is interpreted by the driver as follows: The driver checks whether start_address is located within one of these areas, which was entered in the Conversion DB for FC 02 (from / to : memory bits, inputs).
If Modbus bit address start_address is located in area From kkkkk to lllll From nnnnn to rrrrr access is made to the following SIMATIC memory area Commence at memory bit Commence at input M vvvvv.0 I sssss. 0
The address calculation for access (address conversion) is carried out as follows:
Access beginning with SIMATIC Memory byte Input byte Conversion Formula =((start_address- kkkkk) =((start_address- nnnnn) / 8) / 8) + vvvvv + sssss
Access to Memory bits and Inputs When accessing SIMATIC areas Memory Bits and Inputs, the remaining Rest Bit_Number is calculated and used to address the relevant bit within the first/last memory or input byte.
bit_number
Any value from 1 to 2040 is allowed as the bit_number (number of coils). This number of bits is read.
3-52
Modbus/USS
From 4096 to
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 Name Data[1] Type WORD WORD Actual Value W#16#2604 W#16#0048 Comment Data Data
Data[2]
The driver enters the data of the reply message into the destination DB word-by-word. The first received byte is entered as the Low Byte of the first word Data[1], the third received byte as the Low Byte of the second word Data[2], and so on. If a quantity of less than 9 bits was read or if only one Low Byte was read, the value 00H is entered into the remaining High Byte of the last word.
3-53
Modbus/USS
Address Calculation: The Modbus address start_address 1030 Hex (4144 decimal) is located in the area inputs:
Input byte =((start_address- nnnnn) =((4144 =134; - 4096) / 8) / 8) + sssss + 128
- 4096 ) %
Access is made starting from input I 134.0 up to and including I 136.7. Number of bits: The number of Modbus bits bit_number 0018 Hex (24 decimal) means that 24 bits = 3 bytes should be read. Table 5-4 shows additional examples for accessing data.
Table 3-23 Additional Examples for Accessing Data start_address Hex decimal 0000 0071 0800 0D05 1000 10A4 0 113 2048 3333 4096 4260 Mem. bit Mem. bit Mem. bit Mem. bit Input Input ((0 ((113 Access Calculation -0) -0) / 8) +2000 / 8) +2000 / 8) +2000 / 8) +2000 Address ->M2000.0 ->M2014.1 ->M2256.0 ->M2416.5 ->I 128.0 ->I 148.4
3-54
Modbus/USS
3.5.8
Byte_count n
start_address
The Modbus register address start_register is interpreted by the driver as follows:
For further address generation, the FB81(S_MODB) uses the base DB number (from DB xxxxx) entered in the Conversion DB for FC 03, 06, 16. The address calculation for access (address conversion) is carried out in two steps as follows:
Access to SIMATIC Data block DB (resulting DB) Data word DBW Conversion Formula =(base DB number xxxxx+start_register offset_DB_No.) =(start_register word_No. *2
This is based on even numbered data word numbers only. register_number Any value from 1 to 127 is permitted as the register_number (number of registers). This Number of registers is read.
3-55
Modbus/USS
Application Example
Conversion of Modbus Addressing for Function Codes FC 03, 06, 16 Modbus Address in Transmission Message 0 SIMATIC Memory Area Commencing at data block (base DB number) DB 800
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 Name Data[1] Data[2] Type WORD WORD Actual Value W#16#2123 Comment Data Data
W#16#2527
Address Calculation: The Modbus address start_register 0050 Hex (80 decimal) is interpreted as follows:
3-56
Modbus/USS
Access is made to DB 800, data word DBW 160. Number of Registers: The number of Modbus registers register_number 0002 Hex (2 decimal) means 2 registers = 2 data words are read. Table 5-5 shows additional examples for accessing data.
Table 3-24 Additional Examples for Accessing Data start_register start_register Hex 0000 01F4 0200 02FF 0300 03FF 0400 Base DB_No. Offset DB_No. Word Number Hex 000 1F4 000 0FF 100 1FF 000 Decimal 0 500 0 255 256 511 0 Result DB Decimal 800 800 801 801 801 801 802 DBW Decimal 0 1000 0 510 512 1022 0
Decimal Decimal Decimal 0 500 512 767 768 1023 1024 800 800 800 800 800 800 800 0 0 1 1 1 1 2
3-57
Modbus/USS
3.5.9
start_address
The Modbus register address start_register is interpreted by the driver as follows:
For further address generation, the FB81(S_MODB) uses the base DB number (from DB xxxxx) entered in the Conversion DB for FC 04. The address calculation for access (address conversion) is carried out in two steps as follows:
Access to SIMATIC Data block DB (resulting DB) Data word DBW Conversion Formula =(base DB number xxxxx offset_DB_No.) =(start_register word_No. +start_register *2)
Providing the resulting DB to be read is known, the Modbus address start_register required in the master system can be calculated in accordance with the following formula: start_register = ((resulting DB - base DB number) * 512) + (data word_DBW / 2)
This is based on even-numbered data word numbers only. register_number Any value from 1 to 127 is permitted as the register_number (number of registers). This Number of registers is read.
3-58
Modbus/USS
Application Example
Conversion of Modbus Addressing for Function Codes FC 04 Modbus Address in Transmission Message 0 SIMATIC Memory Area commencing at data block (base DB number) DB 900
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +2.0 +4.0 Name Data[1] Data[2] Data[3] Type WORD WORD WORD Actual Value W#16#2123 W#16#2527 W#16#3536 Comment Data Data Data
3-59
Modbus/USS
Address Calculation: The Modbus address start_register 02C0 Hex (704 decimal) is interpreted as follows:
Access is made to DB 901, data word DBW 384. Number of Registers: The number of Modbus registers register_number 0003 Hex (3 decimal) means 3 registers = 3 data words are read. Table 5-6 shows additional examples for accessing data.
Table 3-25 Additional Examples for Accessing Data
start_register start_register Hex 0000 0064 00C8 0190 1400 1464 14C8 Base DB_No. Offset DB_No. Word Number Hex 000 064 0C8 190 000 064 0C8 Decimal 0 100 200 400 0 100 200 Result DB Decimal 900 900 900 900 910 910 910 DBW Decimal 0 200 400 800 0 200 400
Decimal Decimal Decimal 0 100 200 400 5120 5220 5320 900 900 900 900 900 900 900 0 0 0 0 10 10 10
3-60
Modbus/USS
3.5.10
ADDR
FUNC
coil_address
DATAon/off
CRC
coil_address
The Modbus bit address coil_address is interpreted by the driver as follows: The FB81(S_MODB) checks whether coil_address is located within one of these areas, which was entered in the Conversion DB for FC 01, 05, 15 (from / to : memory bits, outputs, timers, counters).
If Modbus bit address start_address is located in area from aaaaa to bbbbb from ccccc to ddddd access is made to the following SIMATIC memory area commencing from memory bit commencing from output M uuuu.0 Q oooo.0
The address calculation for access (address conversion) is carried out in two steps as follows:
Access beginning with SIMATIC Memory byte Output Byte Conversion Formula =((start_address- ccccc) =((start_address aaaaa) / 8) / 8) + ooooo + uuuuu
Access to Memory bits and Outputs When accessing SIMATIC areas memory bits and outputs, the remaining Rest Bit_number is calculated and used to address the relevant bit within the memory or output byte. Access to Timers and Counters Access to SIMATIC areas timers and counters is not permitted with function code FC 05 and is rejected by the driver with an error message. DATA on/off
The following two values are permitted as DATA on/off: FF00H = set bit. 0000H = delete bit.
3-61
Modbus/USS
Application Example
Conversion of Modbus Addressing for Function Codes FC 01, 05, 15 Modbus Address in Transmission Message from from 0 to 2048 to 2047 2559 SIMATIC memory area Commencing at memory bit Commencing at output M 1000.0 Q 256.0
The slave must return the request message to the master unchanged (Echo).
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +1.0 +2.0 +4.0 Name Address Function Bit Address Bit State BYTE BYTE WORD WORD Type Actual Value B#16#5 B#16#5 W#16#0019 W#16#FF00 Comment Slave Address Function Code Bit Address Bit Status
Address Calculation: The Modbus address coil_address 0809 Hex (2057 decimal) is located in the area outputs:
Output byte =((coil_address- ccccc) =((2057 =257 - 2048) / 8) / 8) + ooooo + 256
Access is made to output Q 257.1. Further Examples For further access examples to memory bits and outputs, please refer to FC 01.
3-62
Modbus/USS
3.5.11
ADDR
FUNC
start_register
CRC
start_register The Modbus register address start_register is interpreted by the driver as follows:
For further address generation, the FB81(S_MODB) uses the base DB number (commencing at DB xxxxx) entered in the Conversion DB for FC 03, 06, 16. The address calculation for access (address conversion) is carried out in two steps as follows:
Access to SIMATIC Data Block DB (resulting DB) Data Word DBW Conversion Formula =(Base DB Number xxxxx+start_registerOffset_DB_no.) =(start_register-word_No.*2)
Providing the resulting DB to be read is known, the Modbus address start_register required in the master system can be calculated in accordance with the following formula: start_register =((resulting DB - base DB number) * 512) + (data word_DBW / 2) This is based on even-numbered data numbers only. DATA Value Any value can be used as the DATA value (register value). Application Example for Parameter Assignment:
Conversion of Modbus Addressing for Function Codes FC 03, 06, 16 Modbus Address in Transmission Message 0
Serial Interface Module ET 200S A5E00124881-01
3-63
Modbus/USS
Address Calculation The Modbus address start_register 0180 Hex (384 decimal) is interpreted:
Data Block DB
(resulting DB)
Further Examples
For further access examples please, refer to FC 03.
3-64
Modbus/USS
3.5.12
Function
Request Message Reply Message Diagnostic Code Test Data LEN in Bytes
ADDR
FUNC
CRC
RCV Destination DB
Contents of RCV Destination Area:
Address +0.0 +1.0 +2.0 +4.0 Name Address Function Diag Code Test Value BYTE BYTE WORD WORD Type Actual Value B#16#5 B#16#8 B#16#0000 B#16#A5C3 Comment Slave Address Function Code Diagnostic Code Test Value
3-65
Modbus/USS
3.5.13
start_address
CRC
>6
start_address The Modbus bit address start_address is interpreted by the driver as follows: The FB81(S_MODB) checks if start_address is located within one of the areas which were entered in the Conversion DB for FC 01, 05, 15 (from/to : memory bits, outputs, timers, counters).
If Modbus bit address start_address is located in area From aaaaa to bbbbb From ccccc to ddddd access is made to the following SIMATIC memory area Commencing from memory bit Commencing at output M uuuu.0 Q ooooo.0
The address calculation for access (address conversion) is carried out as follows:
Access beginning with SIMATIC Memory byte Output byte Conversion Formula =((start_address- ccccc) =((start_address- aaaaa) / 8) / 8) +ooooo + uuuuu
Access to Memory Bits and Outputs When accessing SIMATIC areas memory bits and outputs, the remaining Rest Bit_Number is calculated and used to address the relevant bit within the memory or output byte. Access to Timers and Counters Access to SIMATIC areas timers and counters is not permitted with function code FC 15 and is rejected by the driver with an error message. Quantity Any value between 1 and 2040 is permitted as the quantity (Number of bits).
3-66
Modbus/USS
DATA
Bit status (any values) are contained in the DATA field.
Application Example
Conversion of Modbus Addressing for Function Codes FC 01, 05, 15 Modbus Address in Transmission Message From From 0 to 2048 to 2047 2559 SIMATIC memory area Commencing at memory bit Commencing at output M 1000.0 Q 256.0
Action The Modbus master system wants to write the following bit status on to memory bits M 1144.0 ... M 1144.7 and M 1145.0 ... M 1145.3:
Memory bit M 1144 7 ON 6 ON 5 OFF 4 OFF 3 ON 2 ON 1 OFF 0 Bit ON
7 -
6 -
5 -
4 -
3 ON
2 OFF
1 OFF
0 Bit ON
3-67
Modbus/USS
Address Calculation The Modbus address coil_address 0480 Hex (1152 decimal) is located in the memory bit area:
Memory byte =((start_address- aaaaa) =((1152 =1144; - 0) / 8) / 8) + uuuuu + 1000
Further Examples For further access examples to memory bits and outputs, please refer to FC 01.
3.5.14
ADDR
FUNC
start_register
>6
3-68
Modbus/USS
start_register The Modbus register address start_register is interpreted by the driver as follows:
For further address generation, the FB81(S_MODB) uses the Base DB number (commencing at DB xxxxx) entered in the Conversion DB FC 03, 06, 16 during parameter assignment. The address calculation for access (address conversion) is carried out in two steps as follows:
Access to SIMATIC Data block DB (resulting DB) Data word DBW Conversion Formula =(Base DB Number xxxxx +start_registerOffset_DB_No.) =(start_register word_No.* 2)
Providing the resulting DB to be written to is known, the Modbus address start_register required in the master system can be calculated in accordance with the following formula: start_register ((resulting DB - base-DB-number) * 512) + (data word_DBW / 2) This is based on even-numbered data word numbers only. Quantity Any value between 1 and 127 is permitted as the quantity (Number of registers). =
3-69
Modbus/USS
Address Calculation The Modbus Address start_register 0032 Hex (50 decimal) is interpreted:
3-70
Modbus/USS
3.5.15
Function Code 02
The bit-oriented function code 02 permits read-only access to the SIMATIC memory areas memory bits, and inputs. You can use the Conversion DB to specify from/to which Modbus address access is made to memory bits and inputs. Furthermore, it is possible to assign a certain data element at which access in the SIMATIC memory area is to commence. The Modbus address areas and SIMATIC memory areas of FC 02 may be selected independently from those of FC 01, 05, and 15.
Table 3-26 Address Areas Modbus Address in Transmission Message From kkkkk To lllll From nnnnn To rrrr Inputs Memory bits SIMATIC Memory Area Commence at M vvvv.0 Commence at I sssss.0
3.5.16
3-71
Modbus/USS
Resulting DB Number The resulting DB number which is then accessed is calculated as follows: Base DB number + Offset DB number. This means that it is possible to access a data block area consisting of 128 consecutive data blocks within the entire addressable data block area (65535 DBs).
Word Number in DB
Via the word number it is possible to address the area from DBW 0 to DBW 1022 within each data block. The DBs which are normally organized in bytes are in this instance interpreted by the driver word-by-word as follows.
Function Code 04
The register-orientated function code 04 permits read-only access to the SIMATIC memory area data blocks. The mode and operation of this access is described in function codes 03, 06, and 16. Function code 04 has its own base DB number available for free parameter assignment with the conversion DB. This will enable you to select a second independent area consisting of 128 DBs. These DBs have read-only access.
3-72
Modbus/USS
3.5.17
42.0
DB_Max
WORD W#16#0
W#16#6
44.0
M_Min
WORD W#16#0
W#16#1F4
46.0
M_Max
WORD W#16#0
W#16#4B0
48.0
Q_Min
WORD W#16#0
W#16#0
50.0
Q_Max
WORD W#16#0
W#16#64
3-73
Modbus/USS
3.5.18
3-74
Modbus/USS
Conversion of Modbus Addressing for FC 01, 05, 15 Modbus Address in transmission message (Bit Number) SIMATIC memory area Counter (Counter number) From gggg To hhhh Commence at C zzzzz from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus Address Including this Modbus Address Commence at this counter (= 16 bit word)
3-75
Modbus/USS
Conversion of Modbus Addressing for FC 01, 05, 15 Modbus Address in transmission message (Bit number) SIMATIC memory area Outputs (Output byte number) SIMATIC Area Timers Modbus Address in transmission message (Bit Number) SIMATIC memory area Timers (Timer Number) SIMATIC Area Counters Modbus Address in transmission message (Bit Number) SIMATIC memory area Counter (Counter number) from 4256 to 4415 commence at C 120 from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus Address Including this Modbus Address Commence at this counter (= 16 bit word) From 4096 To 4255 Commence at T 100 from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus Address Including this Modbus Address Commence at this timer (= 16 bit word) From 2048 To 2559 Commence at Q 256.0 from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus Address Including this Modbus Address Commence at this output byte
The Modbus addresses from 0 to 2047 access the SIMATIC memory bits commencing at memory bit M 1000.0; in other words, length of area = 2048 bits = 256 bytes, which means last memory bit = M 1255.7. The Modbus addresses from 2048 to 2559 access the SIMATIC outputs commencing at output Q 256.0; in other words, length of area = 512 bits = 64 bytes, which means last output bit = Q 319.7. The Modbus addresses from 4096 to 4255 access the SIMATIC timers commencing at timer T 100; in other words, length of area = 160 bits = 10 words, this means last timer = T 109. The Modbus addresses from 4256 to 4415 access the SIMATIC counters commencing at counter C 120; in other words, length of area = 160 bits = 10 words, this means last counter = C 129.
3-76
Modbus/USS
Overview of FC02
Conversion of Modbus Addressing for FC 02 Parameter DB SIMATIC Area Memory Bits Modbus address in transmission messages (Bit number) SIMATIC memory area memory bits SIMATIC Area Inputs Modbus address in transmission message (Bit number) SIMATIC memory area Inputs (Input byte number) From To Commence at I from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus address Including this Modbus address Commence at this input byte Commence at From from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus address Including this Modbus address Commence at this memory byte Input Meaning
To
3-77
Modbus/USS
Example of FC 02
Conversion of Modbus Addressing for FC 02 Parameter DB SIMATIC Area Memory Bits Modbus address in transmission messages (Bit number) SIMATIC memory area memory bits SIMATIC Area Inputs Modbus address in transmission message (Bit number) SIMATIC memory area Inputs (Input byte number) From 4096 To 5119 Commence at I 128.0 from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus address Including this Modbus address Commence at this input byte Commence at M 0.0 From 0 from 0 to 65535(decimal) from 0 to 65535(decimal) from 0 to 65535(decimal) Starting with this Modbus address Including this Modbus address Commence at this memory byte Input Meaning
To 4095
The Modbus addresses from 0 to 4095 access the SIMATIC memory bits commencing at memory bit M 0.0 such as: length of area = 4096 bits = 512 bytes, which means last memory bit = M 511.7. The Modbus addresses from 4096 to 5119 access the SIMATIC inputs commencing at input I 128.0 such as: length of area = 1024 bits = 128 bytes, which means last input bit = I 255.7.
Note The input of value commence at memory bit is completely independent of input commence at memory bit for function codes 01, 05, and 15. This means that with Function Code 02 it is possible to use a second SIMATIC memory bits area (read-only), which is completely independent from the first.
3-78
Modbus/USS
3.5.19
Overview of FC 03,06, 16
Conversion of Modbus Addressing for FC 03, 06, 16 Parameter DB SIMATIC Area Data Blocks Modbus Address= 0 in transmission message (register number) means access to: SIMATIC memory area Data Block Commence at DB from 1 to 65535(decimal) Commence at this data block Commence at DBW 0 (= base DB number) Input Meaning
commence at DB
You can use the Commence at DB input to specify the first data block of the SIMATIC area which is to be accessed (= base DB Number). This DB is accessed when the register number of the Modbus message has value 0, starting at data word DBW 0. Higher Modbus register numbers access the following data words / data blocks. Up to 127 successive DBs can be addressed. The driver interprets bits 9 -15 of the Modbus register number for the access of the individual successive DBs.
3-79
Modbus/USS
Application Example
Conversion of Modbus Addressing for FC 03, 06, 16 Parameter DB SIMATIC Area Data Blocks Modbus Address= 0 in transmission message (register number) means access to: SIMATIC memory area Data Block Commence at DB 800 from 1 to 65535(decimal) Commence at this data block Commence at DBW 0 (as base DB number) Input Meaning
You can use Modbus register address 0 to access data block 800 commencing at DBW 0 in the SIMATIC system. Higher Modbus register addresses ( 512, etc.) access the following DBs such as DB 801 and so on.
Overview of FC 04
Conversion of Modbus Addressing for FC 04 Parameter DB SIMATIC Area Data Blocks Modbus Address=0 in transmission message(register number) means access to: SIMATIC memory area Data Blocks Commence at DB from 1 to 65535(decimal) Commence at this data block Commence at DBW 0 (as base DB number) Input Meaning
Commence at DB You can use the Commence at DB input to specify the first data block of the SIMATIC area which is to be accessed (= base DB Number). This DB is accessed when the register number of the Modbus message has value 0, starting at data word DBW 0. Higher Modbus register numbers access the following data words / data blocks. Up to 127 successive DBs can be addressed. The driver interprets bits 9-15 of the Modbus register number for the access of the individual successive DBs.
3-80
Modbus/USS
Note The input of value commence at DB is completely independent of input Commence at DB for function codes 03, 06, and 16. This means that with FC 04 it is possible to use a second SIMATIC data block area (read-only), which is completely independent from the first.
Example of FC 04
Conversion of Modbus Addressing for FC 04 Parameter DB SIMATIC Area Data Blocks Modbus Address=0 in transmission message(register number) means access to: SIMATIC memory area Data Blocks Commence at DB 1200 from 1 to 65535(decimal) Commence at this data block Commence at DBW 0 (as base DB number) Input Meaning
You can use Modbus register address 0 to access data block 1200 commencing at DBW 0 in the SIMATIC system. Higher Modbus register addresses ( 512, 1024, etc.) access the following DBs such as DB 1201, 1202 and so on.
3-81
Modbus/USS
3.5.20
3-82
Modbus/USS
SIMATIC data blocks DB 600 to DB 699 can be accessed with write function codes (FC 06, 16). SIMATIC memory bytes MB 1000 to MB 1127 (FC 05, 15) can be accessed with write function codes. SIMATIC outputs output bytes QB 256 to QB 319 (FC 05, 15) can be accessed with write function codes.
3-83
Modbus/USS
3.6
Diagnostics
3.6.1
Hardware fault Firmware fault Parameterization error(s) Wire break or disconnected cable between the ET 200S Serial Interface Modbus/USS Module and the communication partner: detected only when using RS-422 interface connections with Receive Line Initial State parameter = R(A) 5V / R(B) 0V. Communication errors (parity, framing errors, buffer overflow)
3-84
Modbus/USS
3.6.2
13 12
Reserve
Event class
Figure 3-10
Example: Figure 3-11 shows the contents of the STATUS parameter for the event Request aborted due to complete restart, restart, or reset (event class 1EH, event number 0DH).
Event: Request aborted due to complete restart, restart, or reset 24 STATUS x x x 1 1 1 1 20 27 0 0 0 0 0 1 1 0 20 1
3-85
Modbus/USS
Event Class 5 (05H): Error while processing CPU request Event Number (05) 02H 2 Event Number (Decimal) Event Corrective Action
Request not permitted in this operating mode of the ET 200S Serial Interface Modbus/USS Module (for example, device interface is not parameterized). Invalid message frame length.
Analyze diagnostics alarm and recover error accordingly. The message frame is greater than 200 bytes in length. The rest of the message frame (> 256 bytes) is received by the ET 200S Serial Interface Modbus/USS Module, and the first part of the message frame is rejected. Select a smaller message frame length.
(05) 0EH
14
(05) 51H
81
Frame sequence error when ET 200S Serial Interface Modbus/USS Module communicated with CPU. Error occurred during a receive message transfer from the ET 200S Serial Interface Modbus/USS Module to the CPU.
The module and CPU aborted the transfer. Retry the receive job; the ET 200S Serial Interface Modbus/USS Module will re-send the receive message.
3-86
Modbus/USS
Event Class 8 (08H): Receive Error Event Number (08) 06H 6 Event Number (Decimal) Event Corrective Action
Character delay time exceeded;two Partner device too slow successive characters were not received or faulty. Check for within character delay time. malfunction at partner device, possibly using an interface test device which is switched into the transmission line. Overflow of receive buffer in Master during reception of the reply message. Transmission error (parity error, stop bit error, overflow error) detected. Check protocol settings for the slave. Faults on the transmission line cause message frame repetitions and lower user data throughput. Danger of an undetected error increases. Correct fault by changing system setup or line installation. Check connecting cable of communications partner or check whether both devices have same setting for baud rate, parity and number of stop bits.
10 12
(08) 0DH
13
BREAK: Receive line to partner is interrupted. Parity error: If SF (red) LED is lit up, there is a break on the line between the two communications partners.
Reconnect line or switch partner on again. Check connecting cable of communications partner or check whether both devices have same setting for baud rate, parity and number of stop bits. Change your system setup or the line routing.
(08) 10H
16
3-87
Modbus/USS
Event Class 8 (08H): Receive Error Event Number (08) 11H 17 Event Number (Decimal) Event Corrective Action
Character frame error: If SF (red) LED is lit up, there is a break on the line between the two communications partners.
Check connecting cable of communications partner or check whether both devices have same setting for baud rate, parity and number of stop bits. Change your system setup or the line routing.
(08) 12H
18
More characters were received after the Serial Interface had set CTS to OFF.
Reparameterize communications partner or read data from Serial Interface more quickly. Check if transmission line is interrupted (interface analyzer may be required). Check if the protocol parameters transmission rate, amount of data bits, parity, and amount of stop bits have the same settings in module and the link partner. Check if the value for the reply monitoring time set with PtP_PARAM is big enough. Check if the specified slave address exists.
08 30H
48
Master: A request message has been sent and the reply monitoring time has elapsed without the start of a reply message being recognized.
The Modbus master system is allowed to use Broadcast only for the function codes enabled for this purpose.
3-88
Modbus/USS
Event Class 8 (08H): Receive Error Event Number 08 31H 49 Event Number (Decimal) Event Corrective Action
Master: The first character in the reply message from the slave is different from the slave address sent in the request message (for operating mode Normal).
The wrong slave has replied. Check if the transmission line is interrupted (interface analyzer may be required). This function code cannot be used for this driver. Limit maximum amount of bits to 2040, maximum amount of registers to 127. Access to SIMATIC timers/counters only in 16 bit intervals. Correct amount of bits/ registers or byte_count. Only use codings 0000Hex or FF00Hex for FC05. Only use subcode 0000Hex for FC08. Check CRC checksum generation by Modbus master system. Increase the time-out to the slave reply message for the Modbus master system.
Slave: Received function code not allowed. 08 32H 50 Maximum amount of bits or registers exceeded, or amount of bits cannot be divided by 16 when accessing SIMATIC memory areas Timers or Counters.
08 33H
51
Amount of bits or registers for function codes FC 15/16 and message element byte_count do not match. Illegal bit coding recognized for set bit / reset bit. Illegal diagnostic subcode ( 0000Hex) recognized for function code FC 08 Loop Back Test. The internally-generated value of the CRC 16 checksum does not match the received CRC checksum. Message sequence error: The Modbus master system sent a new request message before the last reply message was transferred by the driver.
08 34H
52
08 35H
53
08 36H
54
08 37H
55
3-89
Modbus/USS
Event Class 14 (0EH) General Processing Errors <Parameter Assignment> Event Number 0E20H 32 Event Number (Decimal) Event Corrective Action
For this data link, the amount of data bits Correct parameter must be set to 8. assignment of the The driver is not ready to run. driver. The multiplication factor set for the character delay time is not within the value range of 1 to 10. The driver is operating with a default setting of 1. The operating mode set for the driver is illegal. Normal operation or Interference Suppression must be specified. The driver is not ready to run. Master: An illegal value for the reply monitoring time has been set: Valid values are 50 to 655000ms. The driver is not ready to run. Correct parameter assignment of the driver. Correct parameter assignment of the driver.
0E21H
33
0E22H
34
0E23H
35
Slave: An illegal value has been set for the slave address. Slave address 0 is not allowed. The driver is not ready to run. 0E2EH 46 An error occurred when reading the interface parameter file. The driver is not ready to run.
Event Class 14 (0EH) General Processing Errors <Processing of a S_SEND Job> Event Number 0E 40 H 0E 41H 64 65 Event Number (Decimal) Event Value specified for LEN at S_SEND too small. Corrective Action Minimum length is 2 bytes.
Value specified for LEN at S_SEND too The minimum length for small. A greater length is required for the this function code is 6 transferred function code. bytes. Transferred function code is illegal. The only function codes which are permitted are those listed in section 3.3 Only use Slave Address 0 for the suitable function codes.
0E 42H
66
0E 43H
67
3-90
Modbus/USS
Event Class 14 (0EH) General Processing Errors <Processing of a S_SEND Job> Event Number 0E 44H 68 Event Number (Decimal) Event The value of the transferred Amount of Bits is not within the range 1 to 2040. The value of the transferred Amount of Registers is not within the range 1 to 127. Function codes 15 or 16: The values of the transferred Amount of Bits and/or Amount of Registers are not within the range 1 to 2040 and/or 1 to 127. Function codes 15 or 16: The LEN for S_SEND does not correspond to the transferred Amount of Bits and/or Amount of Registers. LEN is too small. Corrective Action The Amount of Bits must be within the range 1 to 2040. The Amount of Registers must be within the range 1 to 127. The Amount of Bits and/or Amount of Registers must be within the range 1 to 2040 and/or 1 to 127. Increase LEN for SEND until a sufficient amount of user data is transferred to the module. A larger amount of user data must be transferred to the module because of the Amount of Bits and/or Amount of Registers. The only permitted codes are SET BIT(FF00H) DELETE BIT OR 0000H. The only permitted code is Diagnostic Code 0000H. Refer to the manual on the max length size for each function code
0E 45H
69
0E 46H
70
0E 47H
71
0E 48H
72
Function code 5: The code specified in SEND source DB for Set Bit (FF00H) or Delete Bit (0000H) is wrong. Function code 8: The code specified in SEND source DB for Diagnostic Code is wrong. The length for this function code is greater than the max length.
0E 49H
73
0E 4AH
74
3-91
Modbus/USS
Event Class 14 (0EH) General Processing Errors <Receive Evaluation> Event Number 0E 50 H 80 Event Number(Decimal) Event Master received a reply without a send. Corrective A slave or another master is on network. Check if the transmission line is interrupted(interface analyzer may be required). 0E 51 H 81 Function code incorrect: The function code received in the reply message is different from the sent function code. Byte Underflow: Amount of characters received is less than should have resulted from the byte counter of the reply message, or is less than expected with this function code. Byte Overflow: Amount of characters received is more than should have resulted from the byte counter of the reply message, or is more than expected with this function code. Byte counter wrong: The byte counter received in the reply message is too small. Byte counter wrong: The byte counter received in the reply message is wrong. Echo wrong: The data of the reply message (amount of bits, ...) echoed from the slave are different from the data sent in the request message. CRC Check incorrect: An error has occurred on checking the CRC 16 checksum of the reply message from the slave. Check Slave Device
0E 52H
82
0E 53H
83
0E 54H
84
0E 55H
85
0E 56H
86
0E 57H
87
3-92
Modbus/USS
Event Class 14;. (0EH) General Processing Errors <Receive Exception Code Message> Event Number 0E 61H 0E 62H 0E 63H 0E 64H 0E 65H 0E 66H 0E 67H 97 98 99 100 101 102 103 Event Number (Decimal) Event Corrective Action
Reply message with Exception Code 01: See the manual for Illegal Function your slave device. Reply message with Exception Code 02: See the manual for Illegal Data Address your slave device. Reply message with Exception Code 03: See the manual for Illegal Data Value your slave device. Reply message with Exception Code 04: See the manual for Failure in associated device your slave device. Reply message with Exception Code 05: See the manual for Acknowledge your slave device. Reply message with Exception Code 06: See the manual for Busy, Rejected Message your slave device. Reply message with Exception Code 07: See the manual for Negative Acknowledgment your slave device.
Event Class 30 (1EH): Error During Communication between Serial Interface and CPU Event Number (1E) 0DH (1E) 0EH 13 14 Event Number (Decimal) Event Corrective Action
Request aborted due to complete restart, restart, or reset. Static error when the DP_RDDAT SFC was called. Return value RET_VAL of SFC is available for evaluation in SFCERR variable in instance DB. Static error when the DP_WRDAT SFC was called. Return value RET_VAL of SFC is available for evaluation in SFCERR variable in instance DB. Static error when the RD_LGADR SFC was called. Return value RET_VAL of SFC is available for evaluation in SFCERR variable in instance DB. Parameter out of range. Load SFCERR variable from instance DB.
(1E) 0FH
15
(1E) 10H
16
(1E) 20H
32
Change the Function Block parameter input to be within the acceptable range. Stay within the value range of 1 to 256 bytes.
(1E) 41H
65
3-93
Modbus/USS
3.6.3
Channel-Specific Diagnosis
The channel-specific diagnosis gives information on channel errors of modules and begins after the module status. Table 3-28 lists the channel-specific error types.
Table 3-28 ET 200S Serial Interface Modbus/USS Module Channel Error Types Error Type 00110: Wire break 00111: Overflow 01000: Underflow Description Broken or disconnected wire. Buffer overflow; message length overflow. Message with 0 length sent. Recommended Action Check the wiring to the terminals. Check the cable to the partner. The S_RCV FB must be called more frequently. Check why communications partner is sending message frames without user data. Replace the module. Adjust the parameter assignment. Check the communication setup.
Internal module error occurred. Parameters have not been assigned to the module. Framing error; parity error.
3.6.4
ERROR_NR, ERROR_INFO
Errors are indicated at the ERROR_NR output. Additional details regarding the error in ERROR_NR are displayed at the output ERROR_INFO.
3-94
Modbus/USS
FB Error Codes
ERROR_No 1 to 9 Error during Initialization FB and CP Error numbers 1...9 indicate initialization with error. Parameter START_ERROR is 1. Modbus communication to the master system is not possible. ERROR_No 10 to 19 Error during Processing of a Function Code Error numbers 10...19 indicate an error during processing of a function code. The module transmitted an illegal processing job to the communications FB. The error is also reported to the driver. Subsequent processing jobs continue to be processed. ERROR_No 90 to 99 Other Errors A processing error has occurred. The error is not reported to the driver. Subsequent processing jobs continue to be processed.
3-95
Modbus/USS
3.6.5
Errors
Errors during Initialization Error Number (Decimal) 0 1 2 0 SFC51->RET_VAL S_SEND->STATUS, S_RCV->STATUS ERROR_INFO Description Corrective Action
no error Error when reading SZL with SFC51. Timeout when initializing module or error when initializing module (Error in S_SEND job). Analyze RET_VAL in ERROR_INFO, eliminate cause. Check if protocol Modbus Slave has had parameters assigned on this interface. Check whether the ID specified on the communications FB is correct. Analyze ERROR_INFO.
Errors during Processing of Function Codes Error Number (Decimal) 11 ERROR_INFO Description Corrective Action
Start Address
Illegal start address transferred by the driver to communications FB. Illegal amount of registers transferred by the driver to communications FB: Amount of registers = 0. Illegal amount of registers transferred by the driver to communications FB: Amount of registers > 128.
12
Amount of Registers
Check amount of registers of Modbus master system, if required restart module (Mains_ON)
13
Amount of Registers
Check amount of registers of Modbus master system, if required restart module (Mains_ON)
14
Attempted access to Reduce Modbus start address and/or access SIMATIC memory area length in Modbus master system. Memory Bits in excess of range end. Attention: Range length in SIMATIC CPU is CPU type-dependent.
3-96
Modbus/USS
ERROR_INFO
Description
Corrective Action
Attempted access to Reduce Modbus start address and/or access SIMATIC memory area length in Modbus master system. Outputs in excess of range end. Attention: Range length in SIMATIC CPU is CPU type-dependent. Attempted access to Reduce Modbus start address and/or access SIMATIC memory area length in Modbus master system. Timers in excess of range end. Attention: Range length in SIMATIC CPU is CPU type-dependent. Attempted access to Reduce Modbus start address and/or access SIMATIC memory area length in Modbus master system. Counters in excess of range end. Attention: Range length in SIMATIC CPU is CPU type-dependent. Illegal SIMATIC memory area transferred by the driver to communications FB. Error during access to SIMATIC I/Os. If required, restart module (Mains_ON)
16
17
18
Check if required I/Os exist and are error-free. Add DB to your project Increase DB length
DB# is below minimum Change DB limit minimum value DB limit value DB# is above the maximum DB limit value M memory below minimum limit M memory above maximum limit Q memory below minimum limit Q memory above maximum limit Change DB limit maximum value
24 25 26 27
Change M memory minimum limits in conversion DB Change M memory maximum limits in conversion DB Change Q memory minimum limits in conversion DB Change Q memory maximum limits in conversion DB
3-97
Modbus/USS
S_SEND->STATUS
Error during transmission of an acknowledgment message to the driver with S_SEND. Error when reading SYSTAT with S_RCV (STATUS).
94
S_RCV->STATUS
3-98
Modbus/USS
3.7
USS Master
3.7.1
USS Protocol
The USS protocol is a simple serial data transfer protocol which is fully tailored to the requirements of drive technology. A detailed description of the protocol specification, the physical interface, the bus structure as well as a definition of the transferred net data for drive applications are documented in the specification Universal serial interface protocol USS protocol (Part Number E20125-D0001-S302-A1-7600). The USS protocol defines an access technique according to the master-slave principle for communications via a serial bus. One master and up to 31 slaves can be connected to the bus. The individual slaves are selected by the master using an address character in the message. A slave can never transmit without first being initiated by the master so that direct information transfer between individual slaves is not possible. Communications utilize the half-duplex mode. The master function cannot be transferred; USS is a single-master system.
Message Structure
Each message starts with the start character (STX), followed by the length information (LGE) and the address byte (ADR). The data fields then follow. The message is terminated by the Block Check Character (BCC).
STX LGE ADR 1 2 ... n BCC
For single-word data (16 bit) in the net data block, the high byte is sent first, followed by the low byte. Correspondingly, for double-word data the high word is first sent followed by the low word. The protocol does not identify tasks in the data fields.
Data Coding
The information is coded as follows: STX: 1 byte, Start of Text, 02H LGE: 1 byte, contains the message length as binary number ADR: 1 byte, includes the slave address and the message type. Binary-coded data fields: Each one byte, contents are task-dependent BCC: 1 byte, Block Check Character
3-99
Modbus/USS
3.7.2
3-100
Modbus/USS
3.7.3
Functional Overview
The blocks handle net data transfer cyclically with up to 31 drive slaves in accordance with the sequence specified in the polling list (Parameter Sets DB). Only one request to a slave is active at any one time. The net data for each slave are stored by the user in a data block (Net Data DB) and retrieved from there. They are transferred to and retrieved from the communication processor as defined by the program in the polling list via another data area (Communication Processor DB). Two function calls are required for this procedure (one transmit and one receive block). Another function supports creation and pre-assignment of the data blocks required for communication. Performance features: Creation of data areas for communication depending on the bus configuration Pre-assignment of the polling list Frame structure according to the USS specification Net data exchange may be parameterized in accordance with the required net data structure Execution and monitoring of PKW requests Handling of parameter change reports Monitoring of the overall system and error handling Various net data structures can be used to transmit net data Depending on the selected structure, the net data have a PZD Area for the process data and a PKW Area for parameter processing. The PKW Area allows the master to read and write parameter values and the slave to signal parameter changes in the form of parameter change reports. The PZD Area contains signals necessary for process control, such as control words and setpoints from the master to the slave and status words and actual values from the slave to the master. The proper order of function calls is S_USST, S_SEND, S_RCV, S_USSR. This is important because the outputs from the functions S_SEND and S_RCV are only valid for the current PLC cycle. Figure 7-1 shows how data travels between the user control program and the USS slave.
3-101
Modbus/USS
Data to slave
Net Data DB
S-USST FC
...
Parameter Set DB
...
S-USSR FC
Communication Processor DB
S-SEND FB
S-RECV FB
USS Slave
Figure 3-12 Data travel between user control program and USS slave
3-102
Modbus/USS
3.7.4
3-103
Modbus/USS
S_USST FC Communication processor DB Parameterization and status handling blocks DBPA SYPA SLPA Transmit buffer Receive buffer
Transmit slave 1
Receive slave 1
3-104
Modbus/USS
STL Representation
LAD Representation
S_USST ENO
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, then the BR is set to 0.
SLPA
Input
INT
3-105
Modbus/USS
3.7.5
3-106
Modbus/USS
S_USSR FC Communication processor DB Parameterization and status handling blocks DBPA SYPA SLPA Transmit buffer Receive buffer
Transmit slave 1
Receive slave 1
3-107
Modbus/USS
STL Representation
LAD Representation
S_USSR ENO
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
3-108
Modbus/USS
SLPA
Input
INT
Initial address of the Slave 0 <= SLPA <= 8184 Parameters in the Parameter Sets DB
The parameters of the U_USST FC match the parameters of the S_USSR FC. The two functions access the same parameter set (system and slave parameters) in the Parameter Sets DB and must therefore be parameterized identically.
3.7.6
3-109
Modbus/USS
completely. The data blocks are then generated again on the next restart and the Parameter Sets DB is pre-assigned. S_USSI should be called one time during system start-up (OB100).
STL Representation
LAD Representation
CALL SANZ = TNU1 = PKW = PZD = DBND = DBPA = DBCP = WDH = ANZ =
S_USSI EN SANZ TNU1 PKW PZD DBND DBPA DBCP WDH ANZ
S_USSR ENO
Note The parameters EN and ENO are only present in the graphical representation (LAD or FBD). To process these parameters, the compiler uses the binary result BR. The binary result is set to signal state 1 if the block was terminated without errors. If there was an error, the BR is set to 0.
3-110
Modbus/USS
TNU1 PKW
Input Input
INT INT
0 <= TNU1 <= 31 Number of words of the PKW interface 0, 3 or 4 Number of words of the PZD interface 0 <= PZD <= 16 CPU-specific (zero not allowed) CPU-specific (zero not allowed)
PZD
Input
INT
Number of PZD
Communication Processor CPU-specific DB number (zero not allowed) Number of permissible repetitions of a PKW request Error byte 0 <= WDH <= 32767
ANZ
Output
BYTE
0: no error 1: number of slaves too large 2: impermissible net data structure 3: Parameter Sets DB too short 4: Net Data DB too short 5: error station number 6: Communication Processor DB too short 7: unassigned 8: repeat counter: incorrect value
3-111
Modbus/USS
3.7.7
Net Data DB
These data blocks can either be generated and pre-assigned with the S_USSI during CPU start-up (DBPA only) or entered manually. The Net Data DB is the interface between the communication and the user program. The user must provide this block empty and with sufficient length. Only the transmit data for a slave is placed in the transmit buffer of the Net Data DB assigned to the slave from the control program. The response data from the slave is taken from the appropriate receive buffer (after evaluation of bit 9 of communication control word). Status words allow communication to be checked and the control word permits initiation of a specific parameterization request. The communication interface contains the following data for each slave: Slave-related communication data (communication control, tracing, 6 data words) Buffer for the current PKW request (only if a PKW area exists) Transmit buffer for net data (maximum 20 data words) Receive buffer for net data (maximum 20 data words). The lengths of the transmit and receive buffers depend on the net data structure selected. If the PKW interface does not exist, the buffer for the current PKW request is not used. The total length of the Net Data DB required depends on the number of slaves and the net data structure used: Number of data words per slave = 2 x (PKW + PZD) + PKW + 6 where PKW is 0, 3, or 4 and 0 <= PZD <= 16 For example, a drive with a PKW area of 3 words and a PZD area of 2 words requires 19 data words in the Net Data DB. The Net Data DB is at most 1550 data words long for 31 slaves of the maximum net data length. DBW0 is reserved.
3-112
Modbus/USS
Slave Data Assignment in the Net Data DB with 4 Words in the PKW Area and 0 to 16 Words in the PZD Area
DBWn DBWn+2 DBWn+4 DBWn+6 DBW n+8 DBW n+10 DBW n+12 DBW n+14 DBW n+16 DBW n+18 DBW n+20 DBW n+22 DBW n+24 DBW n+26 DBW n+28 DBW n+30 DBW n+32 DBW n+34 ... DBW n+58 DBW n+60 DBW n+62 DBW n+64 DBW n+66 DBW n+68 DBW n+70 DBW n+72 DBW n+74 ...
Communication control word (KSTW) Internal Communication status word Communication error word Internal Pafe 1-byte, Pafe 2-byte Parameter ID Index Parameter value 1 Parameter value 2 Parameter ID Index Parameter value 1 Parameter value 2 Control word (STW) Main setpoint (HSW) Setpoint/suppl. control word Setpoint/suppl. control word ... Setpoint/suppl. control word Parameter ID Index Parameter value 1 Parameter value 2 Status word (ZSW) Main actual value (HIW) Actual value/ suppl. status word Actual value/ suppl. status word ... PZD16 PKE IND PWE1 PWE2 PZD1 PZD2 PZD3 PKE IND PWE1 PWE2 PKE IND PWE1 PWE2 PZD1 PZD2 PZD3
Communication control
PKW area
Transmit buffer
PKW area
Receive buffer
3-113
Modbus/USS
DBW n+98
PZD16
S
(n = 2,4,6...)
Note If there is no PKW area, then both the Buffer for current PKW request and the PKW area in the Transmit Buffer do not exist.
Bit 0: Accept PKW request Bit 0 is set by the user if a new PKW request is in the transmit buffer and ready for processing.It is reset by the FC if the PKW request has been accepted. Bit 1: Accept parameter change report Bit 1 is set by the user when the parameter change report has been accepted. It is reset by the FC to acknowledge the acceptance. The slave resumes interrupted processing of the current request after this acknowledgment or transmits the next parameter change report.
3-114
Modbus/USS
Bit 0: PKW request in progress Bit 0 is set by the S_USST FC if the PKW request has been accepted and the parameter ID (PKE) contains a valid request ID. It is reset by the S_USSR FC if the PKW request has been executed (with or without error) or if the PKW interface has an error. Bit 1: PKW request complete without error Bit 1 is set by the S_USSR FC if a PKW request has been executed correctly. The response is available in the receive buffer. It is reset by the S_USST FC if a new PKW request is initiated.
Note The PKW requests for the slaves are executed in the sequence of the polling list (DBPA). Only one request to one slave is active at any one time. If more than one slave is entered in the polling list, the response data to a new PKW request are only available on a positive edge of bit 1 (or bit 2). Bit 2: PKW request completed with error. Bit 2 is set by the S_USSR FC for response ID 7 in the PKE. The error number is in the PWE of the slave response. It is reset by the S_USST FC if a new PKW request is initiated.
Note The PKW request last transferred by the user is retained in the transmit interface after it has been processed. Transmission to the slave is repeated until a new request is entered. This might require additional responses in the user program in the event of the status PKW request completed with error (bit 2) and PKW interface fault (bit 4).
Bit 3: PKW request ID invalid. Bit 3 is set by the S_USST FC if request ID 15 is found in the PKE or if index 255 is entered for request ID 4. It is reset by the S_USST FC with initiation of the next PKW request with valid request ID in the PKE. Bit 4: PKW interface with error (counter overflow).
3-115
Modbus/USS
Bit 4 is set by the S_USSR FC if the PKW request is not acknowledged by the slave within a parameterized number of request repetitions (see parameter WDH in Parameter Sets DB) or for response ID 8 in the PKE. It is reset by the S_USSR FC if a new PKW request is initiated and executed properly. Bit 5: Response data contain parameter change report. Bit 5 is set by the S_USSR FC if a parameter change report from the slave exists (response ID 9 to 12 and toggle bit 11 inverted). It is reset by the S_USST FC if the user has acknowledged the parameter change report (communication control word, Bit 1). Bit 6: Operation fault in slave. Bit 6 is set and reset by the S_USSR FC. The FC evaluates the status word (Bit 3) from the slave. Bit 7: Warning from the slave exists. Bit 7 is set and reset by the S_USSR FC. The FC evaluates the status word (Bit 7) from the slave. Bit 8: PLC control requested. Bit 8 is set and reset by the S_USSR FC. The FC evaluates the status word (Bit 9) and the control word (Bit 10). Bit 9: Group error communication. Bit 9 is set and reset by the S_USSR FC. The FC evaluates the feedback signals of the standard blocks S_SEND and S_RCV and checks the frame received for ADR, STX, BCC and LGE. The FC also signals violation of the frame monitoring time here
Note The receive data from the Net Data DB is only valid if bit 9 = 0.
3-116
Modbus/USS
Bit 0: Addressing error (ADR) Bit 3: Start of frame not recognized (no STX for first character) Bit 4: Incorrect Block Check Character (BCC) Bit 6: Incorrect frame length (LGE) Bits 0, 3, 4, and 6 are set by the S_USSR FC if an error is detected in checking the frame received (ADR, STX, BCC, LGE). Bit 7: Frame monitoring timeout Bit 7 is set by the S_USSR FC if the time between transmitting the frame from the master to a slave and arrival of the response from that slave exceeds the permissible limit calculated by the program (frame monitoring time). The remaining bits are not used.
Pafe 1-Byte
Error message from S_USSR FC, parameterization errors in the Parameter Sets DB Value 0: Value 1: No error Incorrect data for PKW / PZD
Pafe 2-Byte
Error message from S_USST FC, parameterization errors in the Parameter Sets DB Value 0: Value 1: No error Incorrect data for PKW / PZD
3-117
Modbus/USS
3.7.8
Parameter Sets DB
The Parameter Sets DB contains the program parameters required for controlling communication. The user must create this block and assign the configuration of the communication system accordingly (S_USSI or manually). The slaves on the bus are processed in the sequence of entry in the DBPA (polling list). A slave can also be entered more than once in the Parameter Sets DB, effectively increasing its priority. The length of the Parameter Sets DB depends on the number n of slaves to be addressed in one bus cycle. Number of data words of the Parameter Sets DB = (n x 4) + 5. 4 data words are required for each slave communication, and 4 data words are assigned once for the system parameters. DBW0 is reserved.
DBW 0 DBW 2 DBW 4 DBW 6 DBW 8 DBW 10 DBW 12 DBW 14 DBW 16 DBW 18 DBW 20 DBW 22 DBW 24
Not used DBCP SANZ SLAV WDH Number of PKW, number of PZD TNU DBND KSTW Number of PKW, number of PZD TNU DBND KSTW Communication parameter set slave 2 Communication parameter set slave 1 System parameters
Number of PKW, number of PZD TNU DBND DBW (n x 8 + 8) KSTW Communication parameter set slave n
3-118
Modbus/USS
System Parameters
DBCP: SANZ: Block number of Communication Processor DB Number of slave parameter sets in the Parameter Sets DB. If individual slaves are to be addressed more frequently than others in a bus cycle, their slave parameters must be entered more than once in the Parameter Sets DB. The system parameter SANZ must be adjusted accordingly. Serial number of the current slave. Required by S_USST FC and S_USSR FC to calculate the current parameter set. This data word must be initialized to 1. This is done by the S_USSI FC if it is used. Number of permissible repetitions of a PKW request (value range: 0 to 32767).If the current PKW request is not completed within the set number, the PKW interface is signaled as faulted.
SLAV:
WDH:
3-119
Modbus/USS
3.7.9
Communication Processor DB
Data exchange between the CPU and ET 200S Serial Interface Modbus/USS module is handled via this data block. The user must provide this block with sufficient length. The Communication Processor DB must be at least 50 words long (DBW 0 to 98).
DBW 0 DBW 2
Communication status Maximum number of cycles while waiting to receive Cycle counter for timeout calculation while waiting to receive
Starting pause measured Duration of the last cycle (OB1_MIN_CYCLE) Send telegram length (LEN) Not used
Transmit buffer
Transmit frame to module (length depends on the net data structure of the current slave)
Receive buffer
Receive frame from the module (length depends on the net data structure of the current slave)
3-120
Modbus/USS
3.8
Start-up Characteristics and Operating Modes of the ET 200S Serial Interface Modbus/USS Driver
3.8.1
Data Management When you close the Hardware Configuration, your Step 7 project automatically saves the data.
Loading the Configuration and Parameters You can download the configuration and parameter assignment data online from the programming device to the CPU. Use the menu command PLC Download to transfer the data to the CPU. During CPU startup and each time you switch between STOP mode and RUN mode, the module parameters of the module automatically transfer to the module as soon as it can be reached via the S7-300 backplane bus. The parameter assignment tool in the retentive memory of the module saves the driver code. This means you cannot change a module without a programming device.
Additional Information
Refer to the Step 7 User Manual for a detailed description of the following tables: How to save the configuration and the parameters How to load the configuration and the parameters into the CPU How to read, change, copy, and print the configuration and the parameters
3-121
Modbus/USS
3.8.2
3.8.3
3-122
Modbus/USS
3.8.4
Behavior of the ET 200S Serial Interface Modbus/USS Module on Operating Mode Transitions of the CPU
Once the ET 200S Serial Interface Modbus/USS Module starts, all data is exchanged between the CPU and the module by means of the function blocks. CPU-STOP: In CPU-STOP mode, communication by means of PROFIBUS is impossible. Any active ET 200S Serial Interface Modbus/USS Module-CPU data transmission, including both send and receive message frames, is aborted and the connection is re-established. CPU-Start-up: At start-up, the CPU transmits the parameters to the module. Through appropriate parameterization, you can have the receive buffer on the module deleted automatically at CPU start-up. CPU-RUN: When the CPU is in RUN mode, sending and receiving are unrestricted. In the first FB cycles following the CPU restart, the module and the corresponding FBs are synchronized. No new S_SEND or S_RCV is executed until this is finished.
Note The ET 200S Serial Interface Modbus/USS Module does not send data to the communications partner until it has received all data from the module.
3-123
Modbus/USS
Processing Times The time for complete processing of a master-slave (with data update time) can be determined as follows: Total Processing time (t8 ) = Master request processing time (t1 ) + Master request send time (t2 ) + Slave request processing time (t3 ) + 1 CPU cycle (time to process function code) (t4 ) + Slave response processing time (t5 ) + Slave response send time (t6 ) + Master response processing time (t7 ) Request/Response Processing Time The Send or Receive Time formula will be the same for Master or slave. can be determined as follows: If CPU is much > (I/O cycle + 10 ms) then Processing Time = 1 CPU cycle per 7 bytes else Processing Time = (2 CPU cycles + 3 I/O cycles + 10 ms) per 7 bytes Send/Receive Time for the Request/Response The amount of time for a request or response to be sent or received is determined as follows: Send/Receive time = 10 ms + transmission rate times the # of characters in the message Total Processing Time Example:
Read 10 words Baud Rate 9600 bits/sec I/O Cycle 2ms t1 40ms t2 15ms t3 40ms t4 40ms t5 160 ms t6 31.7 ms t7 160 ms t8 488.7 ms
3-124
Modbus/USS
3.9
Technical Specifications
Supplied protocol drivers Baud rates with Modbus protocol Baud rates with USS driver Character frames (11 bits)
Modbus drivers USS drivers 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400 bits per second (half-duplex) 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400 bits per second (half-duplex) Number of bits per character: 8 Number of start/stop bits: 1 or 2 Parity: none, even, odd, any
RS-232C Interface Specifications Interface RS-232C signals Maximum transmission distance RS-232C, 8 terminals TXD, RXD, RTS, CTS, DTR, DSR, DCD, PE All isolated against ET 200S internal power supply 15m
RS-422/485 Interface Specifications Interface RS-422 signals RS-485 signals Maximum transmission distance RS-422, 5 terminals RS-485, 3 terminals TXD (A), RXD (A), TXD (B), RXD (B), PE R/T (A), R/T (B), PE All isolated against ET 200S internal power supply 1200m
3-125
Modbus/USS
Technical Specifications
Dimensions and Weight Dimensions W H D (in millimeters) Weight 15 x 81 x 52 Approximately 50 g Data for Specific Module RS-232C Current source
from backplane bus from the power supply L+ Power dissipation of the module
4 3 1 1
Status, Interrupts, Diagnostics Status display Diagnostic functions Green LED (TX) Green LED (RX)
Number of input
pairs
Number of output
pairs RS-485
Outputs Output, RS-232C range 10 V maximum 2500 pF maximum Yes Approximately 60 mA 25 V maximum
Voltage, Currents, Potentials Power rated voltage of the electronics L+ 24 VDC Yes
Short-circuit current Voltage at the outputs or inputs to PE (ground) Output, RS-422/485 Load resistance
Reverse polarity
protection Isolation
Between channels
and backplane bus
Short-circuit current
1
Between channels
and power supply of the electronics
External protection devices required in the user power input lines: Blitzductor DIN rail mounting adapter Blitzductor protection module type KTAD-24V
No Yes
Channels against
backplane bus and load voltage L+
500 VDC
Load voltage L+
against backplane bus
500 VAC
3-126
Index
Numbers
3964(R) procedure, 2-32 Diagnostics, 3-84 Event Class 14 (0EH)Loadable Driver General Processing Errors, 3-90 Calling the SFCERR Variable, 3-85 Diagnostic Information of the Status LEDs, 3-84 Diagnostic Messages of the Function Blocks, 3-85 ET 200S Serial Interface Module Channel Error Types, 3-94 Event Class 14 (0EH)Loadable Driver General Processing Errors, 3-90 Event Class 30 (1EH): Error During Communication between SI and CPU, 3-93 PROFIBUS Slave Diagnosis, 3-94 Structure of the Function Block Diagnostic Messages, 3-85 Diagnostics of the Communications FB Deleting the Errors, 3-95 Diagnostic Functions, 3-94 Diagnostics via Parameters ERROR_NR, ERROR_INFO, 3-95 ERROR_No 1...9, 3-95 ERROR_No 10...19, 3-95 ERROR_No 90...99, 3-95 ERROR_NR, ERROR_INFO, 3-94 Errors during Initialization, 3-96
A
ASCII driver, RS-232C auxiliary signals, 2-48
B
Brief explanation of commissioning, serial interface, 2-6 Broadcast Message, 3-14
C
Configuring the Modbus Module, 3-27 CRC Check, 3-16
D
DATA Field Data, 3-15 Bytecount, 3-15 Coil_Start Address, 3-15 Number_of_Coils, 3-15 Number_of_Registers, 3-15 Register_Start Address, 3-15 Data Transfer for ET 200S Modbus Master, 3-18
Index-1
Index
Master Function Code 08 -- Loop Back Diagnostic Test, 3-36 Exception Code Message, 3-17 RCV Destination DB, 3-37 Master Function Code 11 -- Fetch Communications Event Counter, 3-37 F RCV Destination DB, 3-37 FB2 S_RCV, 3-23 Master Function Code 12 -- Fetch Assignment in the Data Area, 3-24 Communications Event Log, 3-38 Time Sequence Chart, 3-26 RCV Destination DB, 3-38 FB3 S_SEND, 3-18 Master Function Code 15 -- Force Multiple Assignment in the Data Area, 3-20 Coils, 3-39 Calling, 3-20 Master Function Code 16 -- Preset Multiple Parameters, 3-21 Registers, 3-40 Time Sequence Chart, 3-22 Master Function Codes 01 -- Read Output Full-duplex operation, 2-22 Status, SEND Source DB, 3-31 Function Codes, 3-15 Master Function Codes 03 -- Read Output Registers, 3-33 RCV Destination DB, 3-33 SEND Source DB, 3-33 H Master Function Codes 04 -- Read Input Half-duplex operation, 2-22 Registers, RCV Destination DB, 3-34 Master Function Codes 05 -- Force Single Coil I RCV Destination DB, 3-35 SEND Source DB, 3-34 Interfaces Master Function Codes 06 -- Preset Single RS-232C, 3-10 Register, SEND Source DB, 3-35 RS-422/485, 3-13 Master Function Codes 07 -- Read Exception Status, SEND Source DB, 3-36 M Master Function Codes 08 -- Loop Back Master Function Codes, 3-15 Diagnostic Test, SEND Source DB, 3-37 Master Function Code 01 -- Read Output Master Function Codes 11 -- Fetch Status, 3-31 Communications Event Counter, SEND RCV Destination DB, 3-32 Source DB, 3-37 Master Function Code 02 -- Read Input Master Function Codes 12 -- Fetch Status, 3-32 Communications Event Log, SEND RCV Destination DB, 3-32 Source DB, 3-38 SEND Source DB, 3-32 Master Function Codes 15 -- Force Multiple Master Function Code 04 -- Read Input Coils, SEND Source DB, 3-39 Registers, 3-33 Master Function Codes 16 -- Preset SEND Source DB, 3-34 Multiple Registers, SEND Source DB, Master Function Code 05 -- Force Single 3-40 Coil, 3-34 Message End, 3-16 Master Function Code 06 -- Preset Single Message Structure, 3-14 Register, 3-35 Modbus Master Driver, 3-18 RCV Destination DB, 3-35 Modbus Slave Driver, 3-41 Master Function Code 07-- Read Exception Mode of Operation of the Data Link for the Status, 3-36 Slave Driver RCV Destination DB, 3-36 Access with Bit-Oriented Function Codes, 3-71 Function Code 02, 3-71
Index-2
Index
Function Codes 01, -05, -15, 3-74 Access with Register-Oriented Function Codes, 3-71 Function Code 04, 3-72 Function Codes 03, -06, -16, 3-71 Resulting DB Number, 3-72 Word Number in DB, 3-72 Conversion of MODBUS Addresses for Bit Functions, 3-74 Commence At SIMATIC Memory Area, 3-77 From / To MODBUS Address, 3-75, 3-77 Commence AT SIMATIC Memory Area, 3-75 Example of FC 01, 05, 15, 3-75 Example of FC 02, 3-78 Overview of FC 01, 05, 15, 3-74 Overview of FC02, 3-77 Conversion of MODBUS Addresses for Register Functions, 3-79 commence at DB, 3-80 Example, 3-80 Example of FC 04, 3-81 Overview of FC 03,06, 16, 3-79 Overview of FC 04, 3-80 Data Areas in the SIMATIC CPU, Address Transformation, 3-43 Enable/ Disable Write Access, 3-73 Enable Write Access, 3-73 Function Codes 05, 06,15, 16, 3-73 Limits for Write Functions, 3-82 MIN/MAX SIMATIC Memory Areas, 3-82 Example for FC 05, 06, 16, 3-83 Overview of FC 05, 06, 15, 16, 3-82
Master Function Code 05, 3-35 Master Function Code 06, 3-35 Master Function Code 07, 3-36 Master Function Code 08, 3-37 Master Function Code 11, 3-37 Master Function Code 12, 3-38 RS-232C Communications, Terminal Assignment, 3-5 RS-232C Connecting Cable Pin-out to 25-Pin Connector, 3-8 RS-232C to 9-Pin Connector Cable Pin-out, 3-7 RS-422 Communications, Terminal Assignment, 3-6 RS-422 Connecting Cable Pin-out to 15-Pin Connector, 3-9 RS-485 Communications, Terminal Assignment Diagram, 3-6 RS-485 Connecting Cable Pin-out to 15-Pin Connector, 3-10 RS-232C auxiliary signals, 2-48
S
SEND Source DB Master Function Code 01, 3-31 Master Function Code 02, 3-32 Master Function Code 03, 3-33 Master Function Code 04, 3-34 Master Function Code 05, 3-34 Master Function Code 06, 3-35 Master Function Code 07, 3-36 Master Function Code 08, 3-37 Master Function Code 11, 3-37 Master Function Code 12, 3-38 Master Function Code 15, 3-39 Master Function Code 16, 3-40 Serial interface module, technical specifications, 2-99, 2-100, 3-126 Setting Parameters for the Master Driver, 3-27 Character Delay Multiplier, 3-30 Data Bits, 3-29 Half-Duplex (RS 485) Two-Wire Operation, 3-29 Half-Duplex Receive Line Initial State, 3-29 Interference Suppression, 3-30 Normal Operation, 3-30 Parity, 3-29 Response Time, 3-30 Stop Bits, 3-29 Transmission Rate, 3-29 Signals
P
Parameter Configuration and Setting, Presetting of the Receiving Line, 3-29 Product Overview, 3-2 Order Number, 3-2
R
RCV Destination DB Master Function Code 01, 3-32 Master Function Code 02, 3-32 Master Function Code 03, 3-33 Master Function Code 04, 3-34
Index-3
Index
Automatic Use of the Secondary Signals, 3-55 3-12 register_number, 3-55 RS-232C, 3-11 start_address, 3-55 Time Diagram for Secondary Signals, 3-13 Function Code 04 - Read Input Registers, Slave, Address, 3-14 3-58 Slave Application Examples Application Example, 3-59 Function Code 05, 3-62 register_number, 3-58 Function Code 06 - Preset Single Register, start_address, 3-58 3-63 Function Code 05 - Force Single Coil, 3-61 Function Code 08, 3-65 Access to Memory Bits and Outputs, Function Code 15, Conversion of Modbus 3-61 Addressing Assignment, 3-67 Access to Timers and Counters, 3-61 Function Code 16, 3-69 Application Examples, 3-62 Slave Function Code 01, 3-50 coil_address, 3-61 Slave Function Code 02, 3-53 DATA on/off, 3-61 Slave Function Code 03, 3-56 Function Code 06 - Preset Single Register, Slave Function Code 04, 3-59 3-63 Slave Driver Application Example, 3-63 Components, 3-41 DATA Value, 3-63 Data Structures, 3-41 start_register, 3-63 MODBUS Slave Communications FB, Function Code 08 - Loop Back Diagnostic 3-41 Test, 3-65 MODBUS Slave Data Link, 3-41 Application Example, 3-65 Parameters Function Code 15 - Force Multiple Coils, Data Bits, 3-47 3-66 Interference Suppression, 3-47 Access to Memory Bits and Outputs, Multiplier Character Delay Time, 3-47 3-66 Normal Operation, 3-47 Access to Timers and Counters, 3-66 Configuring, 3-45 Applicaiton Example for Conversion of Parity, 3-47 Modbus Addressing Assignment, Setting Parameters for the Slave Driver, 3-67 3-45 DATA, 3-67 Slave Address, 3-47 Quantity, 3-66 Stop Bits, 3-47 start_address, 3-66 Transmission Rate, 3-47 Function Code 16 - Preset Multiple Slave Function Codes, 3-15, 3-48 Registers, 3-68 Function Code 01 - Read Coil (Output) Applicaiton Example, 3-69 Status, 3-49 DATA (High, Low), 3-69 Access to Memory Bits and Outputs, Quantity, 3-69 3-49 start_register, 3-69 Access to Timers and Counters, 3-49 Start-up Characteristics , 3-122 Application Example, 3-50 Start-up Characteristics and Operating Modes bit_number, 3-50 Loading Assignment Data, 3-121 start_address, 3-49 Operating Modes, 3-122 Function Code 02 - Read Input Status, 3-52 Start-up Characteristics and Operating Modes , Application Example, 3-53 Behavior of the ET 200S Serial Interface bit_number, 3-52 MODBUS/ USS Module on Operating Mode start_address, 3-52 Transitions of the CPU, 3-123 Function Code 03 - Read Output Registers, 3-55 Application Example, 3-56 Calculation Formula for start_register,
Index-4
Index
Net Data DB, 3-112 Communication Control Word Technical Specifications, 3-125 KSTW(DBWn), 3-114 Protocols and Interface Specifications, Communication Status Word (DBW 3-125 n+4), 3-115 Technical specifications, serial interface Pafe 1-byte, 3-117 module, 2-99 Pafe 2-byte, 3-117 Terminal Assignment Diagrams, 3-5 Parameter ID PKE in the Transmit Transmission Protocol, 3-14 Buffer, 3-117 Slave Data Assignment, 3-113 Structure of the Communication Error U Word (DBW n+6), 3-117 Parameter Sets DB, 3-118 Usable Interfaces and Protocols, 3-18 Slave Communication Parameter Set, USS Master, 3-99 3-119 Communication Processor DB, 3-120 System Paramaters, 3-119 Communication Status DBW0, 3-120 USS Protocol, 3-99 Duration of the Last Cycle DBW6, 3-120 Net Data Block, 3-100 Configuration and Parameterization, 3-100 Data Coding, 3-99 FC17 S_USST: Transmitting Data to a Data Transfer Procedures, 3-100 Slave, 3-103 Message Structure, 3-99 Parameters, 3-105 USS Protocol, General Structure of the Net FC18 S_USSR: Receiving Data from a Data Block Slave, 3-106 Parameter Area (PKW), 3-100 Parameters, 3-109 Process Data Area (PZD), 3-100 FC19 S_USSI: Initialization, 3-109 Parameters, 3-111 Function Call Order, 3-101 Functional Overview, 3-101 W
Index-5
Index
Index-6