s7-200 SMART System Manual en-US PDF
s7-200 SMART System Manual en-US PDF
Preface
___________________
Product overview 1
___________________
Getting started 2
SIMATIC ___________________
Installation 3
___________________
PLC concepts 4
S7
S7-200 SMART ___________________
Programming concepts 5
___________________
PLC device configuration 6
System Manual
___________________
Program instructions 7
___________________
Communication 8
___________________
Libraries 9
___________________
Debugging and
troubleshooting 10
___________________
PID loops and tuning 11
___________________
Open loop motion control 12
___________________
Technical specifications A
___________________
Calculating a power budget B
___________________
Error codes C
___________________
Special memory (SM) and
system symbol names D
___________________
References E
___________________
Ordering information F
V2.4, 03/2019
A5E03822230-AG
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 3
Preface
Security information
Siemens provides products and solutions with industrial security functions that support the
secure operation of plants, systems, machines and networks.
In order to protect plants, systems, machines and networks against cyber threats, it is
necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial
security concept. Siemens’ products and solutions only form one element of such a concept.
Customer is responsible to prevent unauthorized access to its plants, systems, machines
and networks. Systems, machines and components should only be connected to the
enterprise network or the internet if and to the extent necessary and with appropriate security
measures (e.g. use of firewalls and network segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be taken into
account. For more information about industrial security, please visit
(http://www.siemens.com/industrialsecurity).
Siemens’ products and solutions undergo continuous development to make them more
secure. Siemens strongly recommends to apply product updates as soon as available and to
always use the latest product versions. Use of product versions that are no longer supported,
and failure to apply latest updates may increase customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS
Feed under (http://www.siemens.com/industrialsecurity).
S7-200 SMART
4 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
Preface ................................................................................................................................................... 3
1 Product overview .................................................................................................................................. 18
1.1 S7-200 SMART CPU ..............................................................................................................18
1.2 New features ...........................................................................................................................21
1.3 S7-200 SMART expansion modules .......................................................................................23
1.4 HMI devices for S7-200 SMART .............................................................................................24
1.5 Communications options ........................................................................................................25
1.6 Programming software ............................................................................................................26
2 Getting started ...................................................................................................................................... 27
2.1 Connecting to the CPU ...........................................................................................................27
2.1.1 Configuring the CPU for communication ................................................................................28
2.1.1.1 Overview .................................................................................................................................28
2.1.1.2 Establishing the Ethernet hardware communication connection ............................................29
2.1.1.3 Setting up Ethernet communication with the CPU ..................................................................30
2.1.1.4 Establishing the RS485 hardware communication connection...............................................32
2.1.1.5 Setting up RS485 communication with the CPU ....................................................................32
2.2 Creating the sample program .................................................................................................35
2.2.1 Network 1: Starting the timer ..................................................................................................36
2.2.2 Network 2: Turning the output on ...........................................................................................37
2.2.3 Network 3: Resetting the timer ...............................................................................................38
2.2.4 Setting the CPU type and version for your project .................................................................39
2.2.5 Saving the sample project ......................................................................................................39
2.3 Downloading the sample program ..........................................................................................40
2.4 Changing the operating mode of the CPU ..............................................................................41
3 Installation ............................................................................................................................................ 42
3.1 Guidelines for installing S7-200 SMART devices ...................................................................42
3.2 Power budget ..........................................................................................................................44
3.3 Installation and removal procedures .......................................................................................45
3.3.1 Mounting dimensions for the S7-200 SMART devices ...........................................................45
3.3.2 Installing and removing the CPU ............................................................................................46
3.3.3 Installing and removing a signal board or battery board.........................................................49
3.3.4 Removing and reinstalling the terminal block connector ........................................................51
3.3.5 Installing and removing an expansion module .......................................................................52
3.3.6 Installing and removing the expansion cable ..........................................................................53
3.4 Wiring guidelines .....................................................................................................................54
4 PLC concepts ....................................................................................................................................... 61
4.1 Execution of the control logic ..................................................................................................61
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 5
Table of contents
S7-200 SMART
6 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 7
Table of contents
S7-200 SMART
8 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 9
Table of contents
S7-200 SMART
10 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 11
Table of contents
S7-200 SMART
12 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 13
Table of contents
S7-200 SMART
14 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 15
Table of contents
S7-200 SMART
16 System Manual, V2.4, 03/2019, A5E03822230-AG
Table of contents
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 17
Product overview 1
The S7-200 SMART series of micro-programmable logic controllers (Micro PLCs) can control
a wide variety of devices to support your automation needs.
The CPU monitors inputs and changes outputs as controlled by the user program, which can
include Boolean logic, counting, timing, complex math operations, and communications with
other intelligent devices. The compact design, flexible configuration, and powerful instruction
set combine to make the S7-200 SMART a perfect solution for controlling a wide variety of
applications.
The CPU provides different models with a diversity of features and capabilities that help you
create effective solutions for your varied applications. The different models of CPUs are
shown below. For detailed information about a specific CPU, see the technical specifications
(Page 719).
S7-200 SMART
18 System Manual, V2.4, 03/2019, A5E03822230-AG
Product overview
1.1 S7-200 SMART CPU
The S7-200 SMART CPU family includes fourteen CPU models, separated into two lines: the
Compact Line and the Standard Line. The first letter of the CPU designator indicates a line,
either Compact (C) or Standard (S). The second letter of the designator indicates AC power
supply / relay outputs (R) or DC power supply / DC transistor (T). The number in the
designator indicates the total onboard digital I/O count. The new compact models are
designated by a lower case "s" character (serial port only) following the I/O count.
Note
CPU CRs and CPU CR
S7-200 SMART CPU firmware release V2.4 does not apply to the CPU CRs and CPU CR
models.
SR2 ST2 CR20 SR3 ST3 CR30 SR4 ST4 CR40 CR40 SR6 ST6 CR60 CR60
0 0 s 0 0 s 0 0 s 0 0 s
Compact serial, X X X X X X
non-expandable
Standard, expanda- X X X X X X X X
ble
Relay output X X X X X X X X X X
Transistor output X X X X
(DC)
I/O points (built-in) 20 20 20 30 30 30 40 40 40 40 60 60 60 60
Features CPU CR20s CPU CR30s CPU CR40s, CPU CPU CR60s, CPU
CR40 CR60
Dimensions: W x H x D (mm) 90 x 100 x 81 110 x 100 x 81 125 x 100 x 81 175 x 100 x 81
User memory Program 12 Kbytes 12 Kbytes 12 Kbytes 12 Kbytes
User data 8 Kbytes 8 Kbytes 8 Kbytes 8 Kbytes
Retentive 2 Kbytes max.1 2 Kbytes max.1 2 Kbytes max.1 2 Kbytes max.1
On-board digi- • Inputs • 12 DI • 18 DI • 24 DI 36 DI
tal I/O 24 DQ Relay
• Outputs • 8 DQ Relay • 12 DQ Relay • 16 DQ Relay
Expansion modules None None None None
Signal board None None None None
High-speed Single 4 at 100 kHz 4 at 100 kHz 4 at 100 kHz 4 at 100 kHz
counters (4 phase
total) A/B phase 2 at 50 kHz 2 at 50 kHz 2 at 50 kHz 2 at 50 kHz
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 19
Product overview
1.2 New features
Features CPU CR20s CPU CR30s CPU CR40s, CPU CPU CR60s, CPU
CR40 CR60
PID loops 8 8 8 8
Real-time clock with 7-day No No No No
back-up
1 You can configure areas of V memory, M memory, C memory (current values), and portions of T memory (current val-
ues on retentive timers) to be retentive, up to the specified maximum amount.
Refer to the technical specifications (Page 714) for the power requirements of the CPU and
the expansion modules. Use the worksheets in Appendix B, Calculating a power budget
(Page 821) to calculate your power budget (Page 818).
S7-200 SMART
20 System Manual, V2.4, 03/2019, A5E03822230-AG
Product overview
1.2 New features
STEP 7-Micro/WIN SMART V2.4 release provides the following new features:
PROFINET Communication
STEP 7-Micro/WIN SMART V2.4 and the S7-200 SMART V2.4 CPU firmware adds functions
for PROFINET communication.
GSDML management
GSDML Management (Page 398) is a new tool for importing and deleting the GSDML files
for PROFINET.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 21
Product overview
1.2 New features
Network Diagnostic
Diagnostic functions (Page 119) are available for PROFINET devices.
Status Chart
The Status Chart (Page 616)function is available on PROFINET devices.
SINAMICS library
SINAMICS Library (Page 556): This library includes pre-configured subroutines that make
controlling the drives easier. You can control the physical drive and the drive parameters
with the SINAMICS library.
Memory card
In STEP 7-Micro/Win SMART V2.4, you can directly download the S7-200 SMART project to
the computer and then save it on Micro SD card (Page 85)through card reader.
S7-200 SMART
22 System Manual, V2.4, 03/2019, A5E03822230-AG
Product overview
1.3 S7-200 SMART expansion modules
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 23
Product overview
1.4 HMI devices for S7-200 SMART
Text Display unit: The TD400C is an RS485-only display device that can be
connected to the CPU. Using the Text Display wizard, you can easily pro-
gram your CPU to display text messages and other data pertaining to your
application.
The TD400C device provides a low-cost interface to your application by
allowing you to view, monitor, and change the process variables pertaining
to your application.
SMART HMIs: The SMART LINE Touch Panel provides operating and
monitoring functions for small-scale machines and plants. Short configura-
tion and commissioning times, their configuration in WinCC flexible (ASIA
version), and a double-port Ethernet/RS485 interface form the highlights of
these HMIs.
The Text Display wizard in STEP 7-Micro/WIN SMART helps you configure Text Display
messages quickly and easily for the TD400C. To start the Text Display wizard, select the
"Text Display" command from the "Tools" menu.
The SIMATIC Text Display (TD) User Manual can be downloaded from the Siemens
customer support web site (http://www.siemens.com/automation/).
S7-200 SMART
24 System Manual, V2.4, 03/2019, A5E03822230-AG
Product overview
1.5 Communications options
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
● PROFIBUS:
– High speed communications for distributed I/O (up to 12 Mbps)
– One bus master connects to many I/O devices (supports 126 addressable devices).
– Exchange of data between the master and I/O devices
– EM DP01 module is a PROFIBUS I/O device.
● RS485:
– Provides a STEP 7-Micro/WIN SMART connection for programming when using a
USB-PPI cable
– Supports a total of 126 addressable devices (32 devices per network segment)
– Supports PPI (point-to-point interface) protocol
– Exchange of data between HMIs and the CPU
– Exchange of data between devices and the CPU using Freeport (XMT/RCV
instructions)
● RS232:
– Supports a point-to-point connection to one device
– Supports PPI protocol
– Exchange of data between HMIs and the CPU
– Exchange of data between devices and the CPU using Freeport (XMT/RCV
instructions)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 25
Product overview
1.6 Programming software
Computer requirements
STEP 7-Micro/WIN SMART runs on a personal computer. Your computer should meet the
following minimum requirements:
● Operating system: Windows 7 or Windows 10 (both 32 bit and 64 bit versions)
● At least 350M bytes of free hard disk space
● Mouse (recommended)
Note
To install STEP 7-Micro/WIN SMART on a Windows XP or Windows 7 operating system, you
must log in with Administrator privileges.
S7-200 SMART
26 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started 2
STEP 7-Micro/WIN SMART makes it easy for you to program your CPU. In just a few short
steps using a simple example, you can learn how to create a user program that you can
download and run on your CPU.
All you need for this example is an Ethernet or USB-PPI communication cable, a CPU, and a
programming device running the STEP 7-Micro/WIN SMART programming software.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and no functions related to the use of Ethernet communications.
WARNING
Ensure power is off prior to installing, wiring or removing devices
Before you install or remove any electrical device, ensure that the power to that equipment
has been turned off.
Attempts to install or connect the wiring for the CPU or related equipment with power
applied could cause electric shock or faulty operation of equipment. Failure to disable all
power to the CPU and related equipment during installation or removal procedures could
result in death or serious injury to personnel, and/or damage to equipment.
Always follow appropriate safety precautions and ensure that power to the CPU is disabled
before attempting to install or remove the CPU or related equipment.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 27
Getting started
2.1 Connecting to the CPU
Connect the CPU to a power source. The following figure shows the wiring connections for
either a DC or an AC model of the CPU.
DC installation AC installation
2.1.1.1 Overview
A CPU can communicate with a STEP 7-Micro/WIN SMART programming device on two
types of communications networks:
S7-200 SMART
28 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.1 Connecting to the CPU
Consider the following when setting up Ethernet communications between a CPU and a
programming device:
● Configuration/Setup: No hardware configuration is required for a single CPU. If you want
multiple CPU's on the same network, then you must change the default IP addresses to
new, unique IP addresses.
● No Ethernet switch is required for one-to-one communications; an Ethernet switch is
required for more than two devices in a network.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 29
Getting started
2.1 Connecting to the CPU
S7-200 SMART
30 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.1 Connecting to the CPU
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 31
Getting started
2.1 Connecting to the CPU
Note
The CPU list will show all of the CPUs regardless of Ethernet network class and subnet.
To make a connection to your CPU, your Communication Interface (for Ethernet, a network
interface card (NIC)) and the CPU must be on the same class of network and on the same
subnet. You can either set up your network interface card to match the default IP address of
the CPU, or you can change the IP address of the CPU to match the network class and
subnet of your network interface card.
See the "Configuring or changing an IP address for a CPU or device in your project"
(Page 382) for information about how to accomplish this.
① RS485 port
S7-200 SMART
32 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.1 Connecting to the CPU
All CPUs and devices that have valid RS485 port addresses are displayed in the
"Communications" dialog.
In STEP 7-Micro/WIN SMART, you can access CPUs in one of two ways:
● From the project tree, double-click the "Communications" node.
● Click the "Communications" button from the navigation bar.
● Select "Communications" from the "Component" drop-down list in the Windows area of
the "View" menu ribbon strip.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 33
Getting started
2.1 Connecting to the CPU
The "Communications" dialog provides two methods of selecting the CPU to be accessed:
● Click the "Find CPUs" button to have STEP 7-Micro/WIN SMART search your local
network for CPUs. The RS485 network address of each CPU found on the network is
listed under "Found CPUs".
● Click the "Add CPU" button to manually enter the access information (RS485 network
address and baud rate) for a CPU that you wish to access. The RS485 network address
for each CPU, manually added with this method, is listed under "Added CPUs" and is
retained.
S7-200 SMART
34 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.2 Creating the sample program
Table 2- 1 Sample program for getting started with STEP 7-Micro/WIN SMART
Network 3 T33 (bit) pulse is too fast to monitor with Status view.
LD T33 Reset the timer through M0.0 after the (100 x 10 ms
= M0.0 = 1 s) period.
Timing diagram:
• ① T33 (current)
• ② Current = 100
• ③ Current = 40
• ④ T33 (bit) and M0.0
• ⑤ M10.0
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 35
Getting started
2.2 Creating the sample program
After you enter and save the program, you can download the program to the CPU.
S7-200 SMART
36 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.2 Creating the sample program
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 37
Getting started
2.2 Creating the sample program
S7-200 SMART
38 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.2 Creating the sample program
2.2.4 Setting the CPU type and version for your project
Configure your project for the CPU and version matching your physical CPU. If the project is
not configured for the correct CPU and CPU version, then the download could fail or the
program may not run.
To select your CPU, click the "CPU" field under the "Module" column to display the
dropdown list button, and select your CPU from the dropdown list. Using the same
procedure, select your CPU version in the "Version" column.
2. Click the Save As button and provide a filename for saving your project.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 39
Getting started
2.3 Downloading the sample program
If your CPU is in RUN mode, a dialog prompts you to place the CPU in STOP mode. Clicking
"Yes" sets the CPU to STOP mode.
Note
Each project is associated with a CPU type. If the project type does not match the CPU to
which you are connected, STEP 7-Micro/WIN SMART indicates a mismatch and prompts
you to take an action.
See also
Hardware troubleshooting guide (Page 622)
PLC fatal error codes (Page 826)
Changing the operating mode of the CPU (Page 41)
S7-200 SMART
40 System Manual, V2.4, 03/2019, A5E03822230-AG
Getting started
2.4 Changing the operating mode of the CPU
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 41
Installation 3
3.1 Guidelines for installing S7-200 SMART devices
The S7-200 SMART equipment is designed to be easy to install. You can install the
S7-200 SMART either on a panel or on a standard DIN rail, and you can orient the
S7-200 SMART either horizontally or vertically. The small size of the S7-200 SMART allows
you to make efficient use of space.
WARNING
Safety requirements for installing S7-200 SMART PLCs
S7-200 SMART PLCs are Open Type Controllers. You must install the PLC in a housing,
cabinet, or electric control room. Limit entry to the housing, cabinet, or electric control room
to authorized personnel.
Failure to follow these installation requirements could result in death or serious injury to
personnel, and/or damage to equipment.
Always follow these requirements when installing the PLC.
Separate the devices from heat, high voltage, and electrical noise
As a general rule for laying out the devices of your system, always separate the devices that
generate high voltage and high electrical noise from the low-voltage, logic-type devices such
as the PLC.
When configuring the layout of the PLC inside your panel, consider the heat-generating
devices and locate the electronic-type devices in the cooler areas of your cabinet. Reducing
the exposure to a high-temperature environment will extend the operating life of any
electronic device.
Consider also the routing of the wiring for the devices in the panel. Avoid placing low-voltage
signal wires and communications cables in the same tray with AC power wiring and high-
energy, rapidly-switched DC wiring.
S7-200 SMART
42 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.1 Guidelines for installing S7-200 SMART devices
CAUTION
Temperature considerations
Vertical mounting reduces the maximum allowable ambient temperature by 10 degrees C.
Operating outside the maximum temperature range could result in erratic process operation
and could result in minor personal injury.
If your installation includes expansion modules, mount the CPU below them as shown in
the following figure. Follow the prescribed guidelines for mounting modules to ensure
proper cooling.
When planning your layout for the PLC, allow enough clearance for the wiring and
communications cable connections.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 43
Installation
3.2 Power budget
Note
If the CPU power budget is exceeded, you may not be able to connect the maximum number
of modules allowed for your CPU.
The standard CPU also provides a 24 V DC sensor supply that can supply 24 V DC for input
points, for relay coil power on the expansion modules, or for other requirements. If your
power requirements exceed the budget of the sensor supply, then you must add an external
24 V DC power supply to your system. You must manually connect the 24 V DC supply to
the input points or relay coils.
If you require an external 24 V DC power supply, ensure that the power supply is not
connected in parallel with the sensor supply of the CPU. For improved electrical noise
protection, it is recommended that the commons (M) of the different power supplies be
connected.
WARNING
Connecting power supplies safely
Connecting an external 24 V DC power supply in parallel with the 24 V DC sensor supply of
the CPU can result in a conflict between the two supplies as each seeks to establish its
own preferred output voltage level.
The result of this conflict can be shortened lifetime or immediate failure of one or both
power supplies, with consequent unpredictable operation of the PLC system. Unpredictable
operation could result in death or serious injury to personnel, and/or damage to equipment.
The DC sensor supply of the CPU and any external power supply should provide power to
different points. A single connection of the commons is allowed.
Some of the 24 V DC power input ports in the S7-200 SMART system are interconnected,
with a common logic circuit connecting multiple M terminals. For example, the following
circuits are interconnected when designated as "not isolated" in the data sheets: the 24 V
DC power supply of the CPU, the power input for the relay coil of an EM, or the power supply
S7-200 SMART
44 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.3 Installation and removal procedures
for a non-isolated analog input. All non-isolated M terminals must connect to the same
external reference potential.
WARNING
Avoiding unwanted current flow
Connecting non-isolated M terminals to different reference potentials will cause unintended
current flows that may cause damage or unpredictable operation in the PLC and any
connected equipment.
Failure to comply with these guidelines could cause damage or unpredictable operation
which could result in death or severe personal injury and/or property damage.
Always ensure that all non-isolated M terminals in an S7-200 SMART system are
connected to the same reference potential.
Refer to the technical specifications for your particular CPU to determine the 24 V DC sensor
supply power budget, the 5 V DC logic budget supplied by your CPU and the 5 V DC power
requirements of the expansion modules and signal boards.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 45
Installation
3.3 Installation and removal procedures
Note
The compact serial CPUs (CPU SR20s, CPU SR30s, CPU SR40s, and CPU SR60s) do not
support expansion modules or signal boards.
S7-200 SMART
46 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.3 Installation and removal procedures
Before you install or remove any electrical device, ensure that the power to that equipment
has been turned off. Also, ensure that the power to any related equipment has been turned
off.
WARNING
Remove power to PLC before installing or removing equipment
Attempts to install or remove the PLC or related equipment with the power applied could
cause electric shock or faulty operation of equipment.
Failure to disable all power to the PLC and related equipment during installation or removal
procedures could result in death or serious injury to personnel, and/or damage to
equipment.
Always follow appropriate safety precautions and ensure that power to the PLC is disabled
before attempting to install or remove the CPU or related equipment.
Always ensure that whenever you replace or install a device, you use the correct module or
equivalent device.
WARNING
Module replacement
If you install an incorrect module, the program in the CPU could function unpredictably.
Failure to replace a device with the same model, orientation, or order could result in death
or serious injury to personnel, and/or damage to equipment.
Replace the device with the same model, and be sure to orient and position it correctly.
Note
Install expansion modules separately after the CPU has been installed. The CPU models
CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support the use of
expansion modules or signal boards.
Consider the following when installing the units on the DIN rail or on a panel:
● For DIN rail mounting, make sure the upper DIN rail clip is in the latched (inner) position
and that the lower DIN rail clip is in the extended position for the CPU.
● After installing the devices on the DIN rail, move the lower DIN rail clips to the latched
position to lock the devices on the DIN rail.
● For panel mounting, make sure the DIN rail clips are pushed to the extended position.
To install the CPU on a panel, follow these steps:
1. Locate, drill, and tap the mounting holes (M4 or American Standard number 8), using the
dimensions in the table, Mounting dimensions (mm) (Page 45).
2. Ensure that the CPU and S7-200 SMART equipment are disconnected from electrical
power.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 47
Installation
3.3 Installation and removal procedures
3. Secure the module(s) to the panel, using a Pan Head M4 screw with spring and flat
washer. Do not use a flat head screw.
4. If you are using an expansion module, put it next to the CPU and slide together until the
connectors join securely.
Note
The type of screw will be determined by the material upon which it is mounted. You
should apply appropriate torque until the spring washer becomes flat. Avoid applying
excessive torque to the mounting screws. Do not use a flat head screw.
Task Procedure
Follow the steps below to install a CPU on a DIN rail.
1. Secure the rail to the mounting panel every 75 mm.
2. Snap open the DIN clip (located on the bottom of the module) and hook the back of
the module onto the DIN rail.
3. Rotate the module down to the DIN rail and snap the clip closed. Carefully check
that the clip has fastened the module securely onto the rail. To avoid damage to the
module, press on the tab of the mounting hole instead of pressing directly on the
front of the module.
Note
Using DIN rail stops could be helpful if your CPU is in an environment with high vibration
potential or if the CPU has been installed vertically. Use an end bracket (8WA1 808 or 8WA1
805) on the DIN rail to ensure that the modules remain connected.
If your system is in a high-vibration environment, then panel-mounting the CPU will provide a
greater level of vibration protection.
S7-200 SMART
48 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.3 Installation and removal procedures
Task Procedure
Follow the steps below to remove a CPU from a DIN rail.
1. Remove power from the CPU and any attached I/O modules.
2. Disconnect all the wiring and cabling that is attached to the CPU. The CPU and
most expansion modules have removable connectors to make this job easier.
3. Unscrew the mounting screws or snap open the DIN clip.
4. If you have expansion modules connected, slide the CPU to the left to disengage it
from the expansion module connector. Note: unscrewing or unsnapping the DIN
clips of the expansion modules can make it easier to disengage the CPU.
5. Remove the CPU.
Task Procedure
Follow the steps below to install a signal board or battery board
1. Ensure that the CPU and all S7-200 SMART equipment are disconnected from electri-
cal power.
2. Remove the top and bottom terminal block covers from the CPU.
3. Place a screwdriver into the slot on top of the CPU at the rear of the cover.
4. Gently pry the cover up and remove it from the CPU.
5. Place the signal board or battery board straight down into its mounting position in the
top of the CPU.
6. Firmly press the module into position until it snaps into place.
7. Replace the terminal block covers.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 49
Installation
3.3 Installation and removal procedures
Task Procedure
Follow the steps below to remove a signal board or battery board
1. Ensure that the CPU and all S7-200 SMART equipment are disconnected from electri-
cal power.
2. Remove the top and bottom terminal block covers from the CPU.
3. Place a screwdriver into the slot on top of the module.
4. Gently pry the module up to disengage it from the CPU.
5. Remove the module straight up from its mounting position in the top of the CPU.
6. Replace the cover onto the CPU.
7. Replace the terminal block covers.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
50 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.3 Installation and removal procedures
Task Procedure
Prepare the system for terminal block removal by removing the power from the CPU
and opening the cover above the connector.
1. Ensure that the CPU and all S7-200 SMART equipment are disconnected from
electrical power.
2. Inspect the top of the connector and locate the slot for the tip of the screwdriver.
3. Insert a small screwdriver into the slot.
4. Gently pry the top of the connector away from the CPU. The connector will release
with a snap.
5. Grasp the connector and remove it from the CPU.
Task Procedure
Prepare the components for terminal block installation by removing power from the
CPU and opening the cover above the connector.
1. Ensure that the CPU and all S7-200 SMART equipment are disconnected from
electrical power.
2. Align the connector with the pins on the unit.
3. Align the wiring edge of the connector inside the rim of the connector base.
4. Press firmly down and rotate the connector until it snaps into place.
Check carefully to ensure that the connector is properly aligned and fully engaged.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 51
Installation
3.3 Installation and removal procedures
Task Procedure
Follow the steps below to install an expansion module:
1. Ensure that the CPU and all S7-200 SMART equipment are disconnected from
electrical power.
2. Remove the cover for the I/O bus connector from the right side of the CPU.
3. Insert a screwdriver into the slot above the cover.
4. Gently pry the cover out at its top and remove the cover. Retain the cover for
reuse.
Task Procedure
Follow the steps below to remove an expansion module:
1. Ensure that the CPU and all S7-200 SMART equipment are disconnected from
electrical power.
2. Remove the I/O connectors and wiring from the expansion module. Loosen the
DIN rail clips of all the S7-200 SMART devices.
3. Physically slide the expansion module to the right.
S7-200 SMART
52 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.3 Installation and removal procedures
Table 3- 9 Installing and removing the male connector of the expansion cable
Task Procedure
To install the male connector:
1. Ensure that the CPU and all S7-200 SMART equipment are
disconnected from electrical power.
2. Push the male connector into the bus connector on the right
side of the expansion module or CPU.
3. The male connector is locked in place when it is fully seeded.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 53
Installation
3.4 Wiring guidelines
Table 3- 10 Installing and removing the female connector of the expansion cable
Task Procedure
To install the female connector:
1. Ensure that the CPU and all S7-200 SMART equipment are
disconnected from electrical power.
2. Push the female connector into the bus connector on the left
side of the expansion module.
3. The female connector is locked in place when it is fully seed-
ed.
Note
Installing the expansion cable in a vibration environment
If the expansion cable is connected to modules that move or are not firmly fixed, the
connection on the cable ends can gradually become loose.
Use a cable tie to fix the cable ends on the DIN-rail (or other place) to provide extra strain
relief.
Avoid using excessive force when you pull the cable during installation. Ensure the cable-
module connection is in the correct position once installation is complete.
S7-200 SMART
54 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.4 Wiring guidelines
Prerequisites
Before you ground or install wiring to any electrical device, ensure that the power to that
equipment has been turned off. Also, ensure that the power to any related equipment has
been turned off.
Ensure that you follow all applicable electrical codes when wiring the PLC and related
equipment. Install and operate all equipment according to all applicable national and local
standards. Contact your local authorities to determine which codes and standards apply to
your specific case.
WARNING
Attempts to install or wire the PLC or related equipment with power applied could cause
electric shock or faulty operation of equipment. Failure to disable all power to the PLC and
related equipment during installation or removal procedures could result in death or serious
injury to personnel, and/or damage to equipment.
Always follow appropriate safety precautions and ensure that power to the PLC is disabled
before attempting to install or remove the PLC or related equipment.
Always take safety into consideration as you design the grounding and wiring of your PLC
system. Electronic control devices, such as the PLC, can fail and can cause unexpected
operation of the equipment that is being controlled or monitored. For this reason, you should
implement safeguards that are independent of the PLC to protect against possible personal
injury or equipment damage.
WARNING
Isolation guidelines
The AC power supply boundaries and I/O boundaries to AC circuits have been designed and
approved to provide safe separation between AC line voltages and low voltage circuits.
These boundaries include double or reinforced insulation, or basic plus supplementary
insulation, according to various standards. Components which cross these boundaries such
as optical couplers, capacitors, transformers, and relays have been approved as providing
safe separation. Only circuits rated for AC line voltage include safety isolation to other
circuits. Isolation boundaries between 24 V DC circuits are functional only, and you should
not depend on these boundaries for safety.
The sensor supply output, communications circuits, and internal logic circuits of an S7-200
SMART with included AC power supply are sourced as SELV (safety extra-low voltage)
according to EN 61131-2.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 55
Installation
3.4 Wiring guidelines
To maintain the safe character of the S7-200 SMART low voltage circuits, external
connections to communications ports, analog circuits, and all 24 V DC nominal power supply
and I/O circuits must be powered from approved sources that meet the requirements of
SELV, PELV, Class 2, Limited Voltage, or Limited Power according to various standards.
WARNING
Safe use of power converters
Use of non-isolated or single insulation supplies to supply low voltage circuits from an AC
line can result in hazardous voltages appearing on circuits that are expected to be touch
safe, such as communications circuits and low voltage sensor wiring.
Such unexpected high voltages could result in death or serious injury to personnel, and/or
damage to equipment.
Use only high-voltage-to-low-voltage power converters that are approved as sources of
touch-safe, limited-voltage circuits.
Grounding guidelines
The best way to ground your application is to ensure that all the common and ground
connections of your PLC and related equipment are grounded to a single point. This single
point should be connected directly to the earth ground for your system.
All ground wires should be as short as possible and should use a large wire size, such as
2 mm2 (14 AWG).
When locating grounds, remember to consider safety grounding requirements and the proper
operation of protective interrupting devices.
Wiring guidelines
When designing the wiring for your S7-200 SMART CPU, provide a single disconnect switch
that simultaneously removes power from the CPU power supply, from all input circuits, and
from all output circuits. Provide over-current protection, such as a fuse or circuit breaker, to
limit fault currents on supply wiring. Consider providing additional protection by placing a
fuse or other current limit in each output circuit.
Install appropriate surge suppression devices for any wiring that could be subject to lightning
surges.
Avoid placing low-voltage signal wires and communications cables in the same wire tray with
AC wires and high-energy, rapidly switched DC wires. Always route wires in pairs, with the
neutral or common wire paired with the hot or signal-carrying wire.
Use the shortest wire possible and ensure that the wire is sized properly to carry the required
current.
Use wire and cable with a temperature rating 30 °C higher than the ambient temperature
around the S7-200 SMART CPU (for example, a minimum of 85 °C-rated conductors for 55
°C ambient temperature). You should determine other wiring type and material requirements
from the specific electrical circuit ratings and your installation environment.
S7-200 SMART
56 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.4 Wiring guidelines
Use shielded wires for optimum protection against electrical noise. Typically, grounding the
shield at the S7-200 SMART CPU gives the best results. You should ground communication
cable shields to S7-200 SMART CPU communication connector shells using connectors that
engage the cable shield, or by bonding the communication cable shields to a separate
ground. You should ground other cable shields using clamps or copper tape around the
shield to provide a high surface area connection to the grounding point.
When wiring input circuits that are powered by an external power supply, include an
overcurrent protection device in that circuit. External protection is not necessary for circuits
that are powered by the 24 V DC sensor supply from the S7-200 SMART CPU because the
sensor supply is already current-limited.
All S7-200 SMART CPU modules have removable connectors for user wiring. To prevent
loose connections, ensure that the connector is seated securely and that the wire is installed
securely into the connector.
To help prevent unwanted current flows in your installation, the S7-200 SMART CPU
provides isolation boundaries at certain points. When you plan the wiring for your system,
you should consider these isolation boundaries. Refer to the technical specifications
(Page 714) for the amount of isolation provided and the location of the isolation boundaries.
Circuits rated for AC line voltage include safety isolation to other circuits. Isolation
boundaries between 24 V DC circuits are functional only, and you should not depend on
these boundaries for safety.
A summary of wiring rules for the S7-200 SMART CPUs, EMs, and SBs is shown below:
Table 3- 11 Wiring rules for S7-200 SMART CPUs, EMs, and SBs
* To avoid damaging the connector, be careful that you do not over-tighten the screws.
Note
Ferrules or end sleeves on stranded conductors reduce the risk of stray strands causing
short circuits. Ferrules longer than the recommended strip length should include an
insulating collar to prevent shorts due to side movement of conductors. Cross-sectional area
limits for bare conductors also apply to ferrules.
See also
General technical specifications (Page 714)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 57
Installation
3.4 Wiring guidelines
Note
The effectiveness of a suppressor circuit depends on the application and must be verified for
your particular usage. Ensure that all components are correctly rated and use an
oscilloscope to observe the turn-off transient.
S7-200 SMART
58 System Manual, V2.4, 03/2019, A5E03822230-AG
Installation
3.4 Wiring guidelines
Typical suppressor circuit for DC or relay outputs that switch DC inductive loads
Typical suppressor circuit for relay outputs that switch AC inductive loads
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 59
Installation
3.4 Wiring guidelines
WARNING
Correct placement of external resistor/capacitor noise suppression circuit
When you use relay expansion modules to switch AC inductive loads, you must place the
external resistor/capacitor noise suppression circuit across the AC load to prevent
unexpected machine or process operation. Unexpected machine or process operation
could result in death or severe personal injury.
Always be sure to follow these guidelines in placing the external resistor/capacitor noise
suppression circuit.
S7-200 SMART
60 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts 4
The basic function of the CPU is to monitor field inputs and, based on your control logic, turn
on or off field output devices. This chapter explains the concepts used to execute your
program, the various types of memory used, and how that memory is retained.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 61
PLC concepts
4.1 Execution of the control logic
S7-200 SMART
62 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.1 Execution of the control logic
Analog outputs: The CPU does not write analog output values as part of the normal scan
cycle. Instead, the analog outputs are written immediately when your program accesses the
analog output.
Note
When you read an analog input, the value is read immediately. When you write a value to an
analog output, the output is updated immediately.
It is usually advantageous to use the process image register rather than to directly access
inputs or outputs during the execution of your program. There are three reasons for using the
image registers:
● The sampling of all inputs at the start of the scan synchronizes and freezes the values of
the inputs for the program execution phase of the scan cycle. The outputs are updated
from the image register after the execution of the program is complete. This provides a
stabilizing effect on the system.
● Your program can access the image register much more quickly than it can access I/O
points, allowing faster execution of the program.
● I/O points are bit entities and must be accessed as bits or bytes, but you can access the
image register as bits, bytes, words, or double words. Thus, the image registers provide
additional flexibility.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 63
PLC concepts
4.1 Execution of the control logic
Local memory is reserved for each of 14 entities: the main program, eight subroutine nesting
levels when initiated from the main program, one interrupt routine, and four subroutine
nesting levels when initiated from an interrupt routine. Local memory has a local scope in
that it is available only within its associated program entity, and cannot be accessed by the
other program entities. For more information about Local memory, refer to Local Memory
Area: L in this chapter.
The following figure depicts the flow of a typical scan including the Local memory usage and
two interrupt events, one during the program-execution phase and another during the
communications phase of the scan cycle. Subroutines are called by the next higher level,
and are executed when called. Interrupt routines are not called; they are a result of an
occurrence of the associated interrupt event.
S7-200 SMART
64 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
In this example, the memory area and byte address ("M3") designates byte 3 of M memory,
with a period (".") to separate the bit address (bit 4).
You can access data in most memory areas (V, I, Q, M, S, L, and SM) as bytes, words, or
double words by using the byte-address format. To access a byte, word, or double word of
data in the memory, you must specify the address in a way similar to specifying the address
for a bit. This includes an area identifier, data size designation, and the starting byte address
of the byte, word, or double-word value, as shown in the following figure.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 65
PLC concepts
4.2 Accessing data
The following table shows the range of integer values that can be represented by the
different sizes of data.
Table 4- 3 Decimal and hexadecimal ranges for the different sizes of data
Data in other memory areas (such as T, C, HC, and the accumulators) are accessed by
using an address format that includes an area identifier and a device number.
I (process-image input)
The CPU samples the physical input points at the beginning of each scan cycle and writes
these values to the process image input register. You can access the process image input
register in bits, bytes, words, or double words:
Q (process-image output)
At the end of the scan cycle, the CPU copies the values stored in the process image output
register to the physical output points. You can access the process image output register in
bits, bytes, words, or double words:
S7-200 SMART
66 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
V (variable memory)
You can use V memory to store intermediate results of operations being performed by the
control logic in your program. You can also use V memory to store other data pertaining to
your process or task. You can access the V memory area in bits, bytes, words, or double
words:
M (flag memory)
You can use the flag memory area (M memory) as internal control relays to store the
intermediate status of an operation or other control information. You can access the flag
memory area in bits, bytes, words, or double words:
T (timer memory)
The CPU provides timers that count increments of time in resolutions (time-base increments)
of 1 ms, 10 ms, or 100 ms. Two variables are associated with a timer:
● Current value: this 16-bit signed integer stores the amount of time counted by the timer.
● Timer bit: this bit is set or cleared as a result of comparing the current and the preset
value. The preset value is entered as part of the timer instruction.
You access both of these variables by using the timer address (T + timer number). Access to
either the timer bit or the current value is dependent on the instruction used: instructions with
bit operands access the timer bit, while instructions with word operands access the current
value. As shown in the following figure, the Normally Open Contact instruction accesses the
timer bit, while the Move Word instruction accesses the current value of the timer.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 67
PLC concepts
4.2 Accessing data
Figure 4-2 Accessing the timer bit or the current value of a timer
C (counter memory)
The CPU provides three types of counters that count each low-to-high transition event on the
counter input(s): one type counts up only, one type counts down only, and one type counts
both up and down. Two variables are associated with a counter:
● Current value: this 16-bit signed integer stores the accumulated count.
● Counter bit: this bit is set or cleared as a result of comparing the current and the preset
value. The preset value is entered as part of the counter instruction.
You access both of these variables by using the counter address (C + counter number).
Access to either the counter bit or the current value is dependent on the instruction used:
instructions with bit operands access the counter bit, while instructions with word operands
access the current value. As shown in the following figure, the Normally Open Contact
instruction accesses the counter bit, while the Move Word instruction accesses the current
value of the counter.
Figure 4-3 Accessing the counter bit or the current value of a counter
HC (high-speed counter)
The high-speed counters count high-speed events independent of the CPU scan. High-
speed counters have a signed, 32-bit integer counting value (or current value). To access
the count value for the high-speed counter, you specify the address of the high-speed
counter, using the memory type (HC) and the counter number. The current value of the high-
speed counter is a read-only value and can be addressed only as a double word (32 bits).
S7-200 SMART
68 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
AC (accumulators)
The accumulators are read/write devices that can be used like memory. For example, you
can use accumulators to pass parameters to and from subroutines and to store intermediate
values used in a calculation. The CPU provides four 32-bit accumulators (AC0, AC1, AC2,
and AC3). You can access the data in the accumulators as bytes, words, or double words.
The size of the data being accessed is determined by the instruction that is used to access
the accumulator. As shown in the following figure, you use the least significant 8 or 16 bits of
the value that is stored in the accumulator to access the accumulator as bytes or words. To
access the accumulator as a double word, you use all 32 bits.
For information about how to use the accumulators within interrupt subroutines, refer to the
Interrupt instructions (Page 302).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 69
PLC concepts
4.2 Accessing data
SM (special memory)
The SM bits provide a means for communicating information between the CPU and your
user program. You can use these bits to select and control some of the special functions of
the CPU, such as: a bit that turns on for the first scan cycle, a bit that toggles at a fixed rate,
or a bit that shows the status of math or operational instructions. You can access the SM bits
as bits, bytes, words, or double words:
For more information, see the descriptions of the SM bits (Page 828).
S7-200 SMART
70 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
successfully compiled. However, you can use absolute L memory addresses as shown in the
following table.
Local memory and to global V memory use a similar address syntax, but V memory has a
global scope while L memory has a local scope. Global scope means that the same memory
address can be accessed from any POU. Local scope means that the L memory allocation is
associated with a particular POU and cannot be accessed by another program unit.
The local scope of L memory also affects symbol usage, when a global symbol and a local
symbol use the same name. If your program logic references that symbol name, the CPU
ignores the global symbol and processes the address assigned to the local memory symbol.
Note
Local memory value assignments are not always preserved for successive executions of a
POU
L memory addresses are reused for the next execution sequence, after the current nested
sequence is completed. Depending on a POU's level in the execution stack and L memory
assignments made since a POU's last execution, a POU's L memory assignments made in a
previous execution may be overwritten with unexpected values.
Remember to reassign the correct values to L memory variables, in your program logic.
Reinitialize all TEMP values before processing them and ensure that any output values
(OUT and IN_OUT) are correct.
AI (analog input)
The CPU converts an analog value (such as temperature or voltage) into a word-length (16-
bit) digital value. You access these values by the area identifier (AI), size of the data (W),
and the starting byte address. Since analog inputs are words and always start on even-
number bytes (such as 0, 2, or 4), you access them with even-number byte addresses (such
as AIW0, AIW2, or AIW4). Analog input values are read-only values.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 71
PLC concepts
4.2 Accessing data
AQ (analog output)
The CPU converts a word-length (16-bit) digital value into a current or voltage, proportional
to the digital value (such as for a current or voltage). You write these values by the area
identifier (AQ), size of the data (W), and the starting byte address. Since analog outputs are
words and always start on even-number bytes (such as 0, 2, or 4), you write them with even-
number byte addresses (such as AQW0, AQW2, or AQW4). Analog output values are write-
only values.
Note
Floating-point numbers are accurate up to 6 decimal places. Therefore, you can specify a
maximum of 6 decimal places when entering a floating-point constant.
Calculations that involve a long series of values including very large and very small numbers
can produce inaccurate results. This can occur if the numbers differ by 10 to the power of x,
where x > 6. For example: 100 000 000 + 1 = 100 000 000
S7-200 SMART
72 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
Note
The CPU does not support "data typing" or data checking (such as specifying that the
constant is stored as an integer, a signed integer, or a double integer). For example, an Add
instruction can use the value in VW100 as a signed integer value, while an Exclusive Or
instruction can use the same value in VW100 as an unsigned binary value.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 73
PLC concepts
4.2 Accessing data
Note
Process image register space for digital I/O is always reserved in increments of eight bits
(one byte). If a module does not provide a physical point for each bit of each reserved byte,
these unused bits cannot be assigned to subsequent modules in the I/O chain. For input
modules, the unused bits are set to zero with each input update cycle.
Analog I/O points are always allocated in increments of two points. If a module does not
provide physical I/O for each of these points, these I/O points are lost and are not available
for assignment to subsequent modules in the I/O chain.
The following table provides an example of the fixed mapping convention (established by
STEP 7 Micro/WIN SMART and downloaded as part of the I/O configuration, in the system
block).
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
74 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
An S7-200 SMART CPU allows pointers to access the following memory areas: I, Q, V, M, S,
AI, AQ, SM, T (current value only), and C (current value only). You cannot use indirect
addressing to access an individual bit or to access HC, L or accumulator memory areas.
To indirectly access the data in a memory address, you create a pointer to that location by
entering an ampersand character (&) and the first byte of the memory location to be
addressed. The input operand of the instruction must be preceded with an ampersand (&) to
signify that the address of a memory location, instead of its contents, is to be moved into the
location identified in the output operand of the instruction (the pointer).
Entering an asterisk (*) in front of an operand for an instruction specifies that the operand is
a pointer. As shown in the following figure, entering *AC1 means that AC1 stores a pointer to
the word-length value being referenced by the Move Word (MOVW) instruction. In this
example, the values stored in both VB200 and VB201 are moved to accumulator AC0.
As shown in the following figure, you can change the value of a pointer. Since pointers are
32-bit values, use double-word instructions to modify pointer values. Simple mathematical
operations, such as adding or incrementing, can be used to modify pointer values.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 75
PLC concepts
4.2 Accessing data
Note
When modifying the value of a pointer, remember to adjust for the size of the data that you
are accessing: to access a byte, increment the pointer value by 1; to access a word or a
current value for a timer or counter, add or increment the pointer value by 2; and to access a
double word, add or increment the pointer value by 4.
S7-200 SMART
76 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.2 Accessing data
LAD STL
To transfer a recipe from a table of
recipes:
• Each recipe is 50 bytes long.
• The index parameter (VW1008)
identifies the recipe to be loaded.
Network 1
LD SM0.0
Create a pointer to the starting address MOVD &VB100, LD14
of the recipe table.
+D LD18, LD14
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 77
PLC concepts
4.3 Saving and restoring data
Table 4- 20 Example: Using an offset to read the value of any V memory location
LAD STL
Load the starting address of the V Network 1
memory to a pointer. LD SM0.0
MOVD &VB0, LD10
Note
Downloading a program block, data block, or system block to the CPU completely overwrites
any pre-existing contents of that block in the CPU. Be sure that you want to overwrite the
block before performing a download.
To download project components from STEP 7-Micro/WIN SMART to the CPU, follow these
steps:
1. Ensure that your Communication Interface and PLC connector cable for either Ethernet
(Page 29) (standard CPUs only) or RS485 (Page 32) communications is working, and
that PLC communication is operating properly.
2. Place the CPU in STOP mode (Page 41).
S7-200 SMART
78 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.3 Saving and restoring data
3. To download all project components, click the Download button from the Transfer area of
the File or PLC menu ribbon strip, or alternatively press the shortcut key combination
CTRL+D.
4. To download selected project components, click the down arrow under the Download
button, and then select the specific project component you want to download (Program
Block, Data Block, or System Block) from the drop-down list.
5. After clicking the Download button, if you see a Communications dialog, select the
Communication Interface and the Ethernet IP address or RS485 network address for the
PLC to which you want to download.
6. From the Download dialog, set the download options for the blocks, and whether you
want to be prompted on CPU transitions from RUN to STOP mode (Page 41) and STOP
to RUN mode (Page 41).
7. Optionally click the "Close dialog on success" check box if you want the dialog to
automatically close after a successful download.
8. Click the Download button.
STEP 7-Micro/WIN SMART copies the complete program or program components that you
selected to the CPU. The status icon indicates informational messages, or whether potential
problems or errors occurred with the download. The status message provides specific results
of the operation.
Note
You can download project components that you originally created for use in an S7-200
SMART CPU with firmware version V1.x to a CPU with firmware version V2.0 or later.
However, you cannot download project components that you originally created for use in a
CPU firmware version V2.0 or later to a CPU with firmware version V1.x, especially if the
project components use functionality that firmware version V1.x did not support.
STEP 7-Micro/WIN SMART also supports program edit and download in RUN mode.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 79
PLC concepts
4.3 Saving and restoring data
If the download attempt produces compiler errors or download errors, correct the errors and
reattempt the download.
See also
Uploading project components (Page 81)
See also
Hardware troubleshooting guide (Page 622)
S7-200 SMART
80 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.3 Saving and restoring data
3. To upload selected project components, click the down arrow under the Upload button,
and then select the specific project component you want to upload (Program Block, Data
Block, or System Block).
4. If you see a Communications dialog, select the Communication Interface and the
Ethernet IP address or RS485 network address of the PLC from which you want to
upload.
5. From the Upload dialog, you can change your selection for which blocks to upload if you
choose.
6. Optionally click the "Close dialog on success" check box if you want the dialog to
automatically close after a successful upload
7. Click the "Upload" button to start the upload.
STEP 7-Micro/WIN SMART copies the complete program or program components that you
selected for uploading from the PLC to the currently open project. The status icon indicates
informational messages, or whether potential problems or errors occurred with the upload.
The status message provides specific results of the operation.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 81
PLC concepts
4.3 Saving and restoring data
If the upload is successful, you can save the uploaded program, or make further changes.
The PLC does not contain symbol or status chart information; hence, you cannot upload a
symbol table or status chart.
Note
Uploading into a new project is a risk-free way to capture the program block, system block,
and/or data block information. Since the project is empty, you cannot inadvertently destroy
data. If you want to make use of material from a status chart or symbol table that are in
another project, you can always open a second instance of STEP 7-Micro/WIN SMART and
copy that information in from the other project file (Page 100).
Uploading into an existing project is useful if you want to overwrite all modifications that have
been made to the program since it was downloaded (Page 78) to the PLC. Uploading into an
existing project does, however, overwrite any additions or modifications you have made to
the project. Use this option, only if you want to completely overwrite your
STEP 7-Micro/WIN SMART project with the project stored in the PLC.
STEP 7-Micro/WIN SMART does not upload comments, but if you currently have a program
with comments open in the program editor, the comments are retained. Take care if
uploading over an existing project and use this method only if the projects are similar.
S7-200 SMART
82 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.3 Saving and restoring data
The following CPU behaviors are common, regardless of the memory card usage:
1. Inserting a memory card into a CPU in RUN mode causes the CPU to automatically
transition to STOP mode.
2. A CPU cannot advance to RUN mode if a memory card is inserted.
3. Memory card evaluation is performed only after a CPU power-up or warm restart.
Therefore, program transfer and firmware update can only occur after a CPU power-up or
warm restart.
4. The memory card can be used to store files and folders not related to program transfer
and firmware update usage as long as their names do not conflict with the file and folder
names used for program transfer and firmware update usage.
WARNING
Verify that the CPU is not actively running a process before installing the memory card.
Installing the memory card will cause the CPU to go to STOP mode, which could affect
the operation of an online process or machine. Unexpected operation of a process or
machine could result in death or injury to personnel and/or property damage.
Before inserting the memory card, always ensure that the CPU is offline and in a safe
state.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 83
PLC concepts
4.3 Saving and restoring data
After power-up, if the CPU detects the presence of a memory card, it locates and opens the
S7_JOB.SYS file on the card. If the CPU discovers the FWUPDATE string in that file, then
the CPU enters a firmware update sequence.
The CPU examines each update file (.upd) in the FWUPDATE.S7S folder and if the order ID
contained in the update file name matches the order ID (MLFB) of a connected device (CPU,
expansion module or signal board), then the CPU updates the firmware of that device with
the firmware content contained within the update file.
Note
Firmware update from STEP 7-Micro/WIN SMART
You can also perform a firmware update from STEP 7-Micro/WIN SMART using the RS485
port. Especially for CPU models that do not have a memory card, this method is valuable.
Refer to the PLC menu section of the STEP 7-Micro/WIN SMART online help for
instructions.
S7-200 SMART
84 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.3 Saving and restoring data
Task Procedure
Follow the steps below to insert the microSDHC
memory card into the CPU.
1. Open the bottom terminal block connector
cover.
2. Insert the microSDHC memory card in the
memory card slot (marked X50) located
above the terminal block connectors.
3. Replace the terminal block connector cover
after inserting the card to ensure that the card
is secure.
Follow the steps below to remove the mi-
croSDHC memory card from the CPU.
1. Open the bottom terminal block connector
cover.
2. Grasp the microSDHC memory card from the
CPU and pull it out of the card slot (marked
Micro-SD X50).
3. Replace the bottom terminal block cover.
WARNING
Verify that the CPU is not running a process before inserting the memory card.
Inserting a memory card into a CPU in RUN mode causes the CPU to automatically
transition to STOP mode.
Inserting a memory card into a running CPU can cause disruption to process operation,
possibly resulting in death or severe personal injury.
Always ensure that the CPU is in STOP mode (Page 41) prior to inserting a memory card.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 85
PLC concepts
4.3 Saving and restoring data
Note
STEP 7-Micro/WIN SMART first erases any SIMATIC content on the card prior to
transferring the program to the card. Any other data on the card that you've stored using a
card reader and Windows Explorer is left undisturbed.
Note also that you cannot change the CPU to RUN mode if a memory card is inserted.
To program the memory card as a program transfer card, follow these steps:
1. Ensure that your network hardware and PLC connector cable are working, the CPU is
powered on and in STOP mode, and that PLC communication is operating properly
(Page 30).
2. If not already inserted, insert a microSDHC memory card in the CPU. You can insert or
remove the memory card while the CPU is powered on.
3. Download (Page 40) the program to the PLC, if not already downloaded.
4. Click the down arrow under the Program button in the PLC menu ribbon strip, and then
select "Program memory card in PLC".
5. Select which of the following blocks (or all) to store on the memory card:
– Program block
– Data block
– System Block (PLC configuration)
Note
Always download system blocks together with program blocks.
When the program has no password, you can download program blocks without system
blocks.
You can download the data blocks separately.
S7-200 SMART
86 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.3 Saving and restoring data
7. Enter the password (Page 135) if one is required for programming the memory card.
2. Select which of the following blocks (or all) to store on the memory card:
– Program block
– Data block
– System Block (PLC configuration)
Note
Always download the system blocks with program blocks together.
When the program has no password, you can download program blocks without system
blocks.
You can download the data blocks separately.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 87
PLC concepts
4.3 Saving and restoring data
3. Follow either of the following steps to select the folder you want to save the program.
– Click "Browse.." button and navigate to the root folder of the SD card.
– Type the full path to the root folder of the SD card in the Destination bar.
5. Enter the password (Page 135)if one is required for programming the memory card.
Note
The PLC might fail to compile the program restored from an SD card by °Program Memory
Card on PC". To ensure your program/configuration is valid, Siemens recommends that you
connect to a PLC and download the program at least once.
Note
The memory card created in PC doesn't contain any force configuration in the program.
S7-200 SMART
88 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.3 Saving and restoring data
Note
Program transfer card compatibility
Restoring a program transfer card that you created on a different CPU model might fail due
to the differences in model types. During the restore process, the CPU validates the
following characteristics of the program content stored on the memory card:
• Size of program block
• Size of V memory specified in the data block
• Quantity of onboard digital I/O configured in the system block (Page 126)
• Each retentive range that is configured in the system block
• Expansion module and signal board configurations in the system block
• Axis of Motion configurations in the system block
• Forced memory locations
Note
In addition to using a memory card as a program transfer card, you can also create a reset-
to-factory-defaults memory card (Page 157).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 89
PLC concepts
4.4 Changing the operating mode of the CPU
S7-200 SMART
90 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC concepts
4.5 Status LEDs
EM status LEDs
The expansion modules (EM) provide the following LED status indicators:
Each digital EM provides a DIAG LED that indicates the status of the module:
● Green indicates that the module is operational
● Red indicates that the module is defective or non-operational
Each analog EM provides an I/O Channel LED for each of the analog inputs and outputs.
● Green indicates that the channel has been configured and is active
● Red indicates an error condition of the individual analog input or output
In addition, each analog EM provides a DIAG LED that indicates the status of the module:
● Green indicates that the module is operational
● Red indicates that the module is defective or non-operational
The EM DP01 has a different set of LEDs. See LED status indicators for the EM DP01
PROFIBUS DP (Page 424).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 91
PLC concepts
4.5 Status LEDs
The EM detects the presence or absence of power to the module (field-side power, if
required).
S7-200 SMART
92 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts 5
5.1 Guidelines for designing a PLC system
There are many methods for designing a PLC system. The following general guidelines can
apply to many design projects. Of course, you must follow the directives of your own
company's procedures and the accepted practices of your own training and location.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 93
Programming concepts
5.1 Guidelines for designing a PLC system
S7-200 SMART
94 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.2 Elements of the user program
subroutine only when you call the subroutine, and does not evaluate the code during
the scans in which the subroutine is not called.
– Using subroutines creates code that is portable. You can isolate the code for a
function in a subroutine, and then copy that subroutine into other programs with little
or no rework.
Note
Using V memory addresses can limit the portability of your subroutine, because it is
possible for V memory address assignment from one program to conflict with an
assignment in another program. Subroutines that use the local variable table
(L memory) for all address assignments, by contrast, are highly portable because
there is no concern about address conflicts between the subroutine and another part
of the program when using local variables.
● Interrupt routines are optional elements of your program that react to specific interrupt
events. You design an interrupt routine to handle a pre-defined interrupt event. Whenever
the specified event occurs, the CPU executes the interrupt routine.
The interrupt routines are not called by your main program. You associate an interrupt
routine with an interrupt event, and the CPU executes the instructions in the interrupt
routine only on each occurrence of the interrupt event.
Note
Because it is not possible to predict when the CPU might generate an interrupt, it is
desirable to limit the number of variables that are used both by the interrupt routine and
elsewhere in the program.
Use the local variable table of the interrupt routine to ensure that your interrupt routine
uses only the temporary memory and does not overwrite data used somewhere else in
your program.
There are a number of programming techniques you can use to ensure that data is
correctly shared between your main program and the interrupt routines. Refer to the
descriptions of the Interrupt instructions (Page 302).
● Other blocks contain information for the CPU. You can choose to download these blocks
when you download your program:
– System Block: The system block allows you to configure different hardware options for
the CPU.
– Data Block: The DB stores the initial values for different variables (V memory) used by
your program.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 95
Programming concepts
5.3 Creating your user program
The following example shows a program that includes a subroutine and an interrupt routine.
This sample program uses a timed interrupt for reading the value of an analog input every
100 ms.
S7-200 SMART
96 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.3 Creating your user program
Note
Opening projects created with an older version
• Projects from earlier versions of STEP 7-Micro/WIN (.mwp files) might contain one or
more logical constructs that STEP 7-Micro/WIN SMART does not support.
STEP 7-Micro/WIN SMART omits the instructions that it does not support when opening
the project. You must take care to examine your project and redesign sections where
STEP 7-Micro/WIN SMART omitted program logic.
• STEP 7-Micro/WIN SMART ignores the system block of the old project and uses a default
system block for the opened project.
• STEP 7-Micro/WIN SMART omits all wizard-generated program blocks of the old project.
• You cannot use Open to open a project that resides on a PLC. The project file must
reside on your personal computer/ programming device.
• You can only open one project for each instance of STEP 7-Micro/WIN SMART. You
must run two instances of STEP 7-Micro/WIN SMART to have two projects open at the
same time. When two instances are open, you can copy and paste LAD/ FBD program
elements and STL text from one project to the other.
• You can define a default project folder where you want STEP 7-Micro/WIN SMART to
open and save new projects.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 97
Programming concepts
5.3 Creating your user program
WARNING
Risks with STEP 7-Micro/WIN Version 4.0 or greater (.mwp files) with absolute special
memory (SM) addressing
You can open a program (.mwp file) from an earlier version of STEP 7-Micro/WIN in STEP
7-Micro/WIN SMART. If that program uses symbolic special memory (SM) addressing, then
insert the System Symbol table (Page 106) in your project. The symbols map correctly to
the current SM addresses. If, however, the program uses absolute SM addressing, those
absolute SM addresses might no longer exist.
Programs based on inconsistent definitions of SM addresses can result in unexpected
machine or process operation. Unexpected machine or process operation can cause death
or serious injury to personnel, and/or damage to equipment.
If you open an .mwp file in STEP 7-Micro/WIN SMART, delete the "S7-200 Symbols" table
and insert the "System Symbols" table. The symbols in the former .mwp program map to
the current SM address scheme. Convert any absolute SM addresses to use the
corresponding symbol name.
See also
SM (Special Memory) overview (Page 828)
S7-200 SMART
98 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.3 Creating your user program
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 99
Programming concepts
5.3 Creating your user program
Project tree
The project tree displays all of the project objects and the instructions for creating your
control program. You can drag and drop individual instructions from the tree into your
program, or you can double-click an instruction to insert it at the current location of the cursor
in the program editor.
The Project tree organizes your project:
● Right-click the project to set a project password or set project options
● Right-click the Program Block folder to insert new subroutines and interrupt routines.
● Open the Program Block folder and right-click a POU to open the POU, edit its properties,
password-protect it, or rename it.
● Right-click a Status Chart or Symbol Table folder to insert new charts or tables.
● Open the Status Chart or Symbol Table folder and right-click the icon in the instruction
tree or double-click the appropriate POU tab to open it, rename it, or delete it.
Note
Increased security for project, POU, and data block (data page) passwords
STEP 7-Micro/WIN SMART V2.3 increased the security for passwords from previous
versions. If you are working with a project that you created with a previous version of
STEP 7-Micro/WIN SMART, re-enter your passwords to activate the increased security.
Navigation bar
The Navigation bar appears at the top of the project tree and provides quick access to
objects on the project tree. Clicking a navigation bar button is equivalent to expanding the
project tree and clicking the same selection. The navigation bar presents groups of icons for
accessing different programming features of STEP 7-Micro/WIN SMART.
S7-200 SMART
100 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.3 Creating your user program
Program editor
The program editor contains the program logic and a variable table where you can assign
symbolic names for temporary program variables. Subroutines and interrupt routines appear
as tabs at the top of the program editor window. Click the tabs to move between the
subroutines, interrupts, and the main program.
STEP 7-Micro/WIN SMART provides three editors for creating your program:
● Ladder logic (LAD)
● Statement list (STL)
● Function block diagram (FBD)
With some restrictions, programs written in any of these program editors can be viewed and
edited with the other program editors.
You can change the editor to LAD, FBD, or STL from the Editor section of the View menu
ribbon strip. You can configure the default editor at startup from the Options button of the
Settings area of the Tools menu ribbon strip.
Status bar
The status bar, which is located at the bottom of the main window, provides information on
the editing mode or online status operations that you perform in STEP 7-Micro/WIN SMART.
Output window
The Output Window keeps a list of the most recently compiled POUs (Page 843) and any
errors that occurred during the compilation. If you have the Program Editor window open as
well as the Output Window, you can double-click an error message in the Output Window to
scroll your program automatically to the network where the error is located.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 101
Programming concepts
5.3 Creating your user program
To start a wizard, select that wizard from the STEP 7-Micro/WIN SMART Tools menu ribbon
strip or from the Wizards node in the project tree. You can press F1 when a wizard is
displayed and get wizard details from the online Help system.
A LAD program includes a left power rail that is energized. Contacts that are closed allow
energy to flow through them to the next element, and contacts that are open block that
energy flow. The logic is separated into networks. The program is executed one network at a
time, from left to right and then top to bottom as dictated by the program.
The various instructions are represented by graphic symbols and include three basic forms:
● Contacts represent logic input conditions such as switches, buttons, or internal
conditions.
● Coils usually represent logic output results such as lamps, motor starters, interposing
relays, or internal output conditions.
● Boxes represent additional instructions, such as timers, counters, or math instructions.
Consider these main points when you select the LAD editor:
● Ladder logic is easy for beginning programmers to use.
● Graphical representation is easy to understand and is popular around the world.
● You can always use the STL editor to display a program created with the SIMATIC LAD
editor.
S7-200 SMART
102 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.3 Creating your user program
The CPU executes each instruction in the order dictated by the program, from top to bottom,
and then restarts at the top.
STL uses a logic stack to resolve the control logic. You insert the STL instructions for
handling the stack operations.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 103
Programming concepts
5.4 Data block (DB) editor
Consider these main points when you select the STL editor:
● STL is most appropriate for experienced programmers.
● STL sometimes allows you to solve problems that you cannot solve very easily with the
LAD or FBD editor.
● While you can always use the STL editor to view or edit a program that was created with
the LAD or FBD editors, the reverse is not always true. You cannot always use the LAD
or FBD editors to display a program that was written with the STL editor.
S7-200 SMART
104 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.4 Data block (DB) editor
Note: Enter a space before the data values on the lines where you enter no explicit address.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 105
Programming concepts
5.5 Symbol table
WARNING
Risks with STEP 7-Micro/WIN Version 4.0 or greater (.mwp files) with absolute special
memory (SM) addressing
You can open a program (.mwp file) from an earlier version of STEP 7-Micro/WIN in STEP
7-Micro/WIN SMART. If that program uses symbolic special memory (SM) addressing, then
insert the System Symbol table in your project. The symbols map correctly to the current
SM addresses. If, however, the program uses absolute SM addressing, those absolute SM
addresses might no longer exist.
Programs based on inconsistent definitions of SM addresses can result in unexpected
machine or process operation. Unexpected machine or process operation can cause death
or serious injury to personnel, and/or damage to equipment.
If you open an .mwp file in STEP 7-Micro/WIN SMART, delete the "S7-200 Symbols" table
and insert the "System Symbols" table. The symbols in the former .mwp program map to
the current SM address scheme. Convert any absolute SM addresses to use the
corresponding symbol name.
S7-200 SMART
106 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.5 Symbol table
Note
Until you assign an address or constant value to the symbol, it appears as an undefined
symbol (green wavy underline). After you complete the Address column assignment,
STEP 7-Micro/WIN SMART removes the green wavy underline.
If you have selected to view both symbolic and absolute view of operands for your
project, lengthy symbol names are truncated with a tilde (~) in the program editor. You
can place your mouse pointer over the truncated name to see the entire name displayed
in a tooltip.
3. Type the address or constant value (for example, VB0 or 123) in the Address column.
Note that to assign a string constant to a symbol, you enclose the string constant in
double quotation marks.
4. Optionally, type in a comment up to a maximum of 79 characters.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 107
Programming concepts
5.5 Symbol table
You can resize the width of the columns in the symbol table editor as needed.
Note
You can create multiple symbol tables; however, you cannot use the same symbol name
more than once as a global symbol assignment.
By contrast, you can reuse symbol names in variable tables.
Note
When you correct an erroneous symbol name or address, press the TAB key, ENTER
key, or an ARROW key to complete the edited correction.
S7-200 SMART
108 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.5 Symbol table
Indirect addressing
When referencing a symbol in the program editor, you can use indirect notation (& and *)
with symbol names as with direct addresses. For more information about indirect addressing,
see the topic on direct and indirect addressing.
Note
You can print symbol tables from the Print area of the File menu ribbon strip.
You can view symbols on a network-by-network basis by displaying the symbol information
table.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 109
Programming concepts
5.6 Variable table
Note
Local data values are not initialized to zero by the PLC. You must initialize the local variables
that you use, in your program logic.
S7-200 SMART
110 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.6 Variable table
Example
You call SBR0 from OB1, using a global symbol called INPUT1 as an input parameter of the
subroutine.
Inside the Local Variable Table of SBR0, you have defined a local variable called FIRST as
an input parameter.
When OB1 calls SBR0, the value of INPUT1 is passed to FIRST.
The data types of INPUT1 and FIRST must match.
If INPUT1 is a REAL and FIRST is a REAL, the data types match. If INPUT1 is a REAL but
FIRST is an INT, the data types do not match and the program cannot be compiled until this
error is corrected.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 111
Programming concepts
5.6 Variable table
Note
You can put the variable table on the quick access toolbar (Page 94) for easy access.
Note
Make the assignments in the variable table before using local variables in your program.
When you use symbolic names in your program, the program editor checks first the Local
Variable Table of the appropriate POU, and then the symbol table. If the symbolic name is
undefined in both places, the program editor treats it as an undefined global symbol which is
indicated by a green wavy underline. The program editor does not automatically re-read the
variable table and make corrections to your program logic. If you later make a data type
assignment that defines that symbolic name (in the local variable table), you must manually
insert a pound symbol (#) in front of the name, like this: #UndefinedLocalVar (in the program
logic). For this reason, declaring the variables prior to usage minimizes the programming
effort.
The maximum limit of input/output parameters for each subroutine call is 16. If you attempt to
download a program that exceeds this limit, STEP 7-Micro/WIN SMART returns an error.
S7-200 SMART
112 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.6 Variable table
3. Choose a row that has the right variable type for the kind of variable that you want to
define, and type a name for the variable in the Symbol field. If you are making an
assignment in OB1 or an interrupt routine, the variable table contains only TEMP
variables. If you are making an assignment in a subroutine, the variable table contains IN,
IN_OUT, OUT, and TEMP variables. Do not preface the name with a pound symbol in the
variable table. Pound symbols are only used to precede local variables in the program
code.
Note
Local variable names are permitted to contain a maximum of 23 alphanumeric characters
and underscores. They are also permitted to contain extended characters (ASCII 128 to
ASCII 255). The first character is restricted to alpha and extended characters only. It is
illegal to use keywords as symbolic names, or to use names that begin with a number or
contain characters that are not alphanumeric or in the extended character set.
Local variable names are downloaded and stored in CPU memory. The use of longer
variable names may reduce the memory available to store your program.
4. Click the mouse pointer in the Data Type field and use the list box to select an
appropriate data type for the local variable.
Note
When you assign local variables as parameters for subroutines, you must ensure that the
data type that you assign to the local variable does not conflict with the operand being
used in the subroutine call.
Deleting variables
To delete a local variable, select it in the variable table and click the Delete button .
Alternatively you can delete a row by right-clicking it and selecting Delete > Row from the
context menu.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 113
Programming concepts
5.7 PLC error reaction
See also
Programming software (Page 26)
S7-200 SMART
114 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.7 PLC error reaction
The "PLC Information" dialog provides the following tree entries for status check:
● System:
– Connected CPU: the name of connected CPU, for example, CPU ST 60.
– Configured PROFINET device: the name of configured PROFINET device, for
example, device 1.
● Event Log
● PROFINET Alarm
● Scan Rates
Note
The "Refresh" button is used for updating the PLC information. The "Refresh" button is used
for updating the information. No matter where you click the "Refresh" button, all the PLC
information is updated.
The "Firmware Update" button is used for updating the firmware.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 115
Programming concepts
5.7 PLC error reaction
5.7.1.1 System
S7-200 SMART
116 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.7 PLC error reaction
5.7.1.2 CPU
The CPU dialog is as follows:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 117
Programming concepts
5.7 PLC error reaction
The PROFINET device dialog displays the following information of configured PROFINET
devices:
● Device Identification
– Device Name
– Device Type
– Device No.
– Converted Name: The system converts the device name to the name in the format
supported by the PROFINET protocol. For example, if you enter a Chinese name "设
备 1", the corresponding converted name is "xn--1-b90bx17m". If you enter a English
name, the converted name is the same as the name you enter.
– IP Address
● Device Status
The device status is classified as follows:
– Not available: CPU cannot find the device
– OK
– Diagnosis: An alarm is reported
● Module Status
For each module in a slot, the dialog displays the status. The module status is classified
as follows:
– OK
– Error: If you click "Error" in the "Status" column, the corresponding detailed error
information shows at the right.
S7-200 SMART
118 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.7 PLC error reaction
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 119
Programming concepts
5.7 PLC error reaction
LAD STL
When an I/O error or a run-time error Network 1
occurs, go to STOP mode LD SM5.0
O SM4.3
STOP
S7-200 SMART
120 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.7 PLC error reaction
Non-fatal errors are those indicating problems with the construction of the user program or
with certain instruction execution problems in the user program. I/O errors are those
indicating problems with the I/O of the CPU, signal board, and expansion modules. You can
use STEP 7-Micro/WIN SMART to view the error codes that were generated by the non-fatal
and I/O errors.
Click the PLC button from the Information section of the PLC menu ribbon strip, to see the
current error status of a PLC connected to STEP 7-Micro/WIN SMART.
Description
Program-compile The CPU compiles the program as it downloads. If the CPU detects that the program violates a
errors in the CPU compilation rule, it aborts the download and generates an error code. (A program that was already
downloaded to the CPU would still exist in the permanent memory and would not be lost.) After you
correct your program, you can download it again.
I/O device errors After power-up and after a system block download, the CPU verifies that the I/O configuration
stored in the system block matches the CPU, signal board, and expansion modules that are actual-
ly present. Any mismatch results in the generation of a configuration error for the device. During
runtime, devices can detect other I/O problems (such as missing user power or input value exceed-
ing limits) that cause the CPU to generate an I/O error.
The CPU stores module status information in special memory (SM) bits. Your program can monitor
and evaluate these bits. SM5.0 is the global I/O error bit and remains set while any I/O error condi-
tion exists.
Program execution Your program can create error conditions during execution. These errors can result from improper
errors use of an instruction or from the processing of invalid data by an instruction. For example, an indi-
rect-address pointer that was valid when the program compiled could point to an out-of-range ad-
dress if the program modified the pointer during execution. Modifying a pointer to an invalid address
is an example of a run-time programming problem. The CPU sets SM4.3 upon the occurrence of a
run-time programming problem. SM4.3 remains set while the CPU is in RUN mode.
The program can execute the GET_ERROR instruction (Page 333) to get the current non-fatal error
code and reset SM4.3 to OFF.
Refer to the non-fatal error code list (Page 823) for a description of compile rule violations
and run-time programming problems.
Refer to the description of the SM bits (Page 828) for more information about the SM bits
used for reporting I/O and program execution errors.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 121
Programming concepts
5.8 Program edit in RUN mode
Once you have made the changes to correct the fatal error condition, use one of the
following methods to restart the PLC:
● Turn the PLC power off and then on.
● Using STEP 7-Micro/WIN SMART, click the "Warm Start" button in the modify area of the
PLC ribbon strip. This forces the PLC to restart and clear any fatal errors.
Restarting the PLC clears the fatal error condition and performs power-up diagnostic testing
to verify that the fatal error has been corrected. If another fatal error condition is found, the
PLC again sets the ERROR LED, indicating that an error still exists. Otherwise, the PLC
begins normal operation.
Some error conditions can render the PLC incapable of communication. In these cases, you
cannot view the error code from the PLC. These types of errors indicate hardware failures
that require the PLC to be repaired; they cannot be fixed by changes to the program or
clearing the memory of the PLC.
Refer to the fatal error code list (Page 826) for details.
WARNING
Risks when downloading a program in RUN mode
When you download program changes to a PLC in RUN mode, your changes immediately
affect process operation. You have no margin for error; mistakes in your programming edits
can cause death or serious injury to personnel, and/or damage to equipment. Only qualified
personnel should perform a program edit in RUN mode.
Overview
The "program edit in RUN mode" feature allows you to make changes to a program and
download them to your PLC without switching to STOP mode.
● You can make minor changes to your current process without having to shut down.
Example: Change a parameter value.
● You can debug a program more quickly with this feature.
Example: Invert the logic for a normally open or normally closed switch.
If you download changes to a real process (as opposed to a simulated process, which you
might do in the course of debugging a program), be sure to think through the possible safety
consequences to machines and machine operators before you download.
You can download only the program block (OB1, subroutines, and interrupts) during a
program edit in RUN mode. You cannot download the system block or the data block during
a program edit in RUN mode.
S7-200 SMART
122 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.8 Program edit in RUN mode
Possible complications
To help you decide whether to download your program modifications to the PLC in RUN
mode or STOP mode, consider the following effects from various types of program
modifications made during a RUN mode edit:
● If you delete the control logic for an output, the output maintains its last state until the next
power cycle or transition to STOP mode.
● If you delete HSC, Motion, or PLS functions that were running at the time of the edit in
RUN mode, then these functions continue to run until the next power cycle or transition to
STOP mode.
● If you delete ATCH or DTCH instructions in a RUN mode edit but do not delete the
associated interrupt routine, then the interrupt routine continues to execute whenever the
controlling event occurs until the next power cycle or transition to STOP mode.
● If you add ATCH instructions that are conditional on the first scan flag, the CPU does not
enable these events until the next power cycle or STOP-to-RUN mode transition.
● If you delete an ENI or DISI instruction, activated interrupt routines events still continue to
operate until the next power cycle or transition from RUN to STOP mode.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 123
Programming concepts
5.8 Program edit in RUN mode
● If you modify the table address of a RCV instruction and the RCV instruction is active at
the time of the edit in RUN mode, then the PLC writes the received data to the old table
address. The PLC does not use the new address until the current receive request (to the
old address) completes. Because you have edited your program, if the program looks for
the data in the new address, the data will not be there. GET and PUT instructions
function similarly.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
● The PLC does not execute logic that is conditional on the first scan flag until after a power
cycle or a transition from STOP to RUN mode. The startup of the modified program after
a RUN mode edit does not set the first scan flag.
Note
If you have not saved your current program in the program editor,
STEP 7-Micro/WIN SMART prompts you to save your project. You can use the same
name or you can change the name.
2. From the warning dialog, click the "Continue" button to confirm that you want to proceed
with editing your program in RUN mode. STEP 7-Micro/WIN SMART uploads the
program that is currently stored in the CPU and displays it in the program editor, where
you can make the changes you need.
After you make the desired editing changes, you must download them before they can take
effect in the CPU. Once you initiate a download, you cannot perform other tasks in STEP 7-
Micro/WIN SMART until the download completes.
S7-200 SMART
124 System Manual, V2.4, 03/2019, A5E03822230-AG
Programming concepts
5.9 Features for debugging your program
Examine the output window to see whether any compile errors exist (for instance, duplicate
EU or ED numbers). You can double-click the error message to edit the offending network in
the program editor.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 125
PLC device configuration 6
6.1 Configuring the operation of the PLC system
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
Use one of the following methods to view and edit the system block to set up CPU options:
● Click the "System Block" button on the navigation bar (Page 26).
● Select "System Block" from the Component drop-down list (Page 26) in the Windows
area of the View menu ribbon strip.
● Select the "System Block" node, then press Enter; or double-click the "System Block"
node in the project tree (Page 26).
STEP 7-Micro/WIN SMART opens the system block, and displays the configuration options
that are applicable for your CPU type.
S7-200 SMART
126 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Hardware configuration
The top part of the System Block dialog displays the modules that you have configured and
allows you to add or delete modules. Use the drop-down lists to change, add, or delete the
CPU model, signal board, and expansion modules. As you add modules, the input and
output columns display the assigned input and output addresses.
Note
Optimally, select the CPU model and firmware version (V1 or V2) in the system block to be
the model and firmware version of the actual CPU you plan to use. When downloading your
project, if the CPU model and firmware version in the project does not match the model and
firmware version of the connected CPU, STEP 7-Micro/WIN SMART issues a warning
message. You can continue with the download, but if the connected CPU does not support
the resources and capabilities that the project requires, a download error occurs.
Module options
The bottom part of the system block dialog displays options for the module that you select in
the top part. Click any node in the configuration options tree to modify the project
configuration for the selected module.
The system block includes the following configuration options for CPU modules:
● Communication (Page 128)
● Digital inputs and pulse catch bits (Page 130)
● Digital outputs (Page 133)
● Retentive Ranges (Page 134)
● Security (Page 135)
● Startup (Page 139)
Configuration options specific to other devices such as analog inputs (Page 140), analog
outputs (Page 143), RTD analog inputs (Page 144), Thermocouple (TC) analog inputs
(Page 149), RS485/RS232 CM01 communications signal board (Page 152), Battery BA01
signal board (Page 153), and additional digital inputs and outputs are accessible from the
system block when you add those modules.
You must establish communications between STEP 7-Micro/WIN SMART and your CPU
before you can download or upload a system bock.
You can then download a modified system block in order to provide the CPU with a new
system configuration. New properties that you enter take effect when you download
(Page 40) the modifications to the CPU.
Alternatively, you can upload an existing system block from the CPU in order to make your
STEP 7-Micro/WIN SMART project configuration match that of the CPU.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 127
PLC device configuration
6.1 Configuring the operation of the PLC system
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
Ethernet port
If you want your CPU to obtain its Ethernet network port information from the project, click
the "IP address data is fixed to the values below and cannot be changed by other means"
checkbox. You can then enter the following Ethernet network information:
● IP address: Each device must have an Internet Protocol (IP) address. The device uses
this address to deliver data on a more complex, routed network.
● Subnet mask: A subnet is a logical grouping of connected network devices. Nodes on a
subnet are usually located in close physical proximity to each other on a Local Area
Network (LAN). The subnet mask defines the boundaries of an IP subnet. A subnet mask
of 255.255.255.0 is generally suitable for a local network.
S7-200 SMART
128 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
● Default gateway: Gateways (or IP routers) are the link between LANs. Using a gateway, a
computer in a LAN can send messages to other networks, which might have other LANs
behind them. If the destination of the data is not within the LAN, the gateway forwards the
data to another network or group of networks where it can be delivered to its destination.
Gateways rely on IP addresses to deliver and receive data packets.
● Station name: The station name is the name by which this CPU is identified on the
network. Use a name that helps you identify the CPU on the Communications dialog.
Note
The station name follows the standard DNS (Domain Name System) naming conventions.
The S7-200 SMART CPUs limit the station name to a maximum of 63 characters, which
can consist of the lower case letters a through z, the digits 0 through 9, the hyphen
character (minus sign) and the period character.
The CPU prohibits certain names:
• The station name must not have the format n.n.n.n where n is a value of 0 through
999.
• You cannot begin the station name with the string port-nnn or the string port-nnn-
nnnnn where n is a digit 0 through 9. For example, port-123 and port-123-45678 are
illegal station names. A station name cannot start or end with a hyphen or period.
Background time
You can configure the percentage of the scan cycle time that is dedicated to processing the
communication requests. As you increase the percentage of time that is dedicated to
processing communication requests, you are increasing scan time, which makes your control
process run more slowly. The scan time only increases if there are communication requests
to process.
The default percentage of the scan time dedicated to processing communication requests is
set to 10%. This setting provides a reasonable compromise for processing compilation/
status operations, while minimizing the impact to your control process. You can adjust this
value by 5% increments up to a maximum of 50%.
As you add more communication partners to the S7-200 SMART CPU, additional
background time is required to handle the requests from those partners. GET and PUT
instructions need additional resources to create and maintain connections to other devices.
The EM DP01 PROFIBUS DP module requires additional communication background time if
you have HMIs or other CPUs communicating with the S7-200 SMART CPU through the
EM DP01. Open User Communication (OUC) also adds an additional load to the CPU and
may require additional background time.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 129
PLC device configuration
6.1 Configuring the operation of the PLC system
RS485 port
Use these settings to adjust the communication parameters for system protocols for the
onboard RS485 port. The system protocols are used when connecting to a programming
device or HMI devices:
● RS485 port address: Click the scroll buttons to enter the desired CPU address (1-126).
The default port address is 2.
● Baud Rate: Choose the desired data baud rate from the dropdown list (9.6 Kbps, 19.2
Kbps, or 187.5 Kbps).
Note
You can make the following RS485 communication connections for V2.4 S7-200 SMART
CPUs:
• Use a USB-PPI cable to program all CPU models through any serial port, including the
RS485 port, the signal board port, and the DP01 PROFIBUS port.
• Use the RS485 and RS232 ports for HMI access (Data read/write) and Freeport
communications.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
130 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
WARNING
Risks with changes to filter time for digital input channel
If the filter time for a digital input channel is changed from a previous setting, a new "0"
level input value may need to be presented for up to 12.8 ms accumulated duration
before the filter becomes fully responsive to new inputs. During this time, short "0" pulse
events of duration less than 12.8 ms may not be detected or counted.
This changing of filter times can result in unexpected machine or process operation,
which may cause death or serious injury to personnel, and/or damage to equipment.
To ensure that a new filter time goes immediately into effect, a power cycle of the CPU
must be applied.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 131
PLC device configuration
6.1 Configuring the operation of the PLC system
You can enable individual pulse catch operation for the first fourteen digital input points (I0.0
through I0.7 and I1.0 through I1.5), dependent upon the CPU model (Page 18).
If your configuration includes an SB DT04, you can enable the two additional digital input
points available on this signal board for pulse catch operation.
The figure below shows the basic operation of the S7-200 SMART CPU with and without
pulse catch enabled:
Because the pulse catch function operates on the input after it passes through the input filter,
you must adjust the input filter time so that the pulse is not removed by the filter. The figure
below shows a block diagram of the digital input circuit:
The figure below shows the response of an enabled pulse catch function to various input
conditions. If you have more than one pulse in a given scan, only the first pulse is read. If
you have multiple pulses in a given scan, you should use the rising/falling edge interrupt
events:
S7-200 SMART
132 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
You can set digital output points to a specific value when the CPU is in STOP mode, or
preserve the output states that existed before the transition to STOP mode.
You have two ways to set the digital output behavior in STOP mode:
● Freeze Outputs in last state: Click this checkbox to have all digital outputs frozen in their
last states at the time of a RUN-to-STOP transition.
● Substitute value: If the Freeze Outputs in last state checkbox is not checked, this table
allows you to select the desired state of each output whenever the CPU is in STOP
mode. Click the checkbox for each output you want set to ON (1). The default substitute
value for digital outputs is OFF (0).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 133
PLC device configuration
6.1 Configuring the operation of the PLC system
Configure the areas of memory you want to retain through power cycles. Enter new values
for V, M, T, or C memory.
You can define ranges of addresses in the following memory areas to be retentive: V, M, T,
and C. For timers, only the retentive timers (TONR) can be retained, and, for both timers and
counters, only the current value can be retained (timer and counter bits are cleared on each
power-up).
By default, the CPU has no defined retentive memory areas, but you can configure the
retentive ranges:
● The S7-200 SMART CPU models CPU SR20, CPU ST20, CPU SR30, CPU ST30, CPU
SR40, CPU ST40, CPU SR60, and CPU ST60 have a maximum of 10 Kbytes of retentive
memory.
● The S7-200 SMART CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU
CR60s have a maximum of 2 Kbytes of retentive memory.
S7-200 SMART
134 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Data type Desc. CPU CR20s CPU SR20 CPU SR30 CPU SR40 CPU SR60
CPU CR30s CPU ST20 CPU ST30 CPU ST40 CPU ST60
CPU CR40s
CPU CR60s
V Data Memory VB0-VB8191 VB0-VB8191 VB0-VB12281 VB0-VB16383 VB0-VB20479
T Timers T0-T31, T0-T31, T0-T31, T0-T31, T0-T31,
T64-T95 T64-T95 T64-T95 T64-T95 T64-T95
C Counters C0-C255 C0-C255 C0-C255 C0-C255 C0-C255
M Flag bits MB0-MB31 MB0-MB31 MB0-MB31 MB0-MB31 MB0-MB31
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 135
PLC device configuration
6.1 Configuring the operation of the PLC system
The password can be any combination of letters, numbers, and symbols and is case-
sensitive.
S7-200 SMART
136 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Note
If you restrict write access to a specific range of V memory, be sure that Text Display
modules or HMIs only write within the writable range of V memory. Also, if you use the PID
wizard, PID control panel, motion wizard, or motion control panel be sure that the V memory
that the wizards or panels use are within the writable range of V memory.
With this restriction disabled, you can write to the full ranges of memory areas, including I, Q,
M, V, and AQ.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 137
PLC device configuration
6.1 Configuring the operation of the PLC system
This checkbox provides backward compatibility with older HMIs that do not prompt for a
password for these functions. The following selections are available:
● If this box is checked and the CPU is password protected, then you can change operating
modes and make TOD writes with these older HMIs.
● If this box is unchecked and the CPU is password protected, you cannot change
operating modes or make TOD writes with these older HMIs.
● If the CPU is not password protected, you can change operating modes and make TOD
writes with these older HMIs, regardless of the setting of the checkbox.
Note
When you enter the password for a password-protected CPU, the authorization level for that
password remains effective for up to one minute after the programming device has been
disconnected from the S7-200 SMART CPU. Always exit STEP 7-Micro/WIN SMART before
disconnecting the cable to prevent another user from unauthorized access.
Entering the password over a network does not compromise the password protection for the
S7-200 SMART CPU. If one authorized user is accessing restricted functions across a
network, that does not authorize other users to access those functions. Only one user is
allowed unrestricted access to the S7-200 SMART CPU at a time.
Disabling a password
You can disable the password by changing the privilege level 4, 3, or 2 to "Full privileges"
(Level 1), since Level 1 allows all unrestricted CPU access.
Note
If the privilege level is at "Disallow Upload" (Level 4), you cannot download a new system
block with a new password level if a valid user program exists. You must delete the user
program first, and then you can download an updated system block.
S7-200 SMART
138 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
CPU mode
From this dialog you can select the mode for the CPU after a startup. You have one of the
following three choices:
● STOP
The CPU shall always enter STOP mode after a power up or restart (default selection).
● RUN
The CPU shall always enter RUN mode after a power up or restart. For most applications,
especially those where the CPU operates independently without a connection to
STEP 7-Micro/WIN SMART, the RUN startup mode selection is the correct choice.
● LAST
The CPU shall enter the operating mode that existed prior to the last power up or restart.
This selection can be useful during program development or commissioning. Be aware
that a running CPU can enter STOP mode for a variety of reasons, such as the failure of
an expansion module, occurrence of a scan watchdog timeout, the insertion of a memory
card, or an erratic power up event. Once the CPU enters STOP mode, it will continue to
enter STOP mode each time the CPU powers up. You must restore the CPU back to
RUN mode (Page 41) from STEP 7-Micro/WIN SMART.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 139
PLC device configuration
6.1 Configuring the operation of the PLC system
Hardware options
You can also configure the CPU to allow RUN mode operation under the following hardware
conditions:
● One or more devices specified in the hardware configuration stored in the CPU are
missing.
● A difference exists between the hardware configuration stored in the CPU and the
devices actually present, resulting in configuration errors (for example, discrete input
module in place of a configured discrete output module).
If you deselect one or both of the selections, the CPU is prohibited from entering RUN mode
if any of the disallowed conditions are true.
S7-200 SMART
140 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Range
You then configure either the voltage range or the current range for the channel. You can
choose one of the following value ranges:
● +/- 2.5v
● +/- 5v
● +/- 10v
● 0 - 20ma
Rejection
Fluctuations in analog input values can also be caused by the response time of the sensor,
or the length and condition of the wires carrying the analog signal to the module. In such
cases, the fluctuating values could be changing too rapidly for the program logic to respond
effectively. You can configure the module to reject signals to eliminate or minimize noise at
the following frequencies:
● 10 Hz
● 50 Hz
● 60 Hz
● 400 Hz
Smoothing
You can also configure the module to smooth the analog input signal over a configured
number of cycles, thus presenting an averaged value to the program logic. You have four
choices for the smoothing algorithm:
● None (no smoothing)
● Weak
● Medium
● Strong
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 141
PLC device configuration
6.1 Configuring the operation of the PLC system
Alarm configuration
You select whether to enable or disable the following alarms for the selected channel of the
selected module:
● Upper limit exceeded (value > 32511)
● Lower limit exceeded (value < -32512)
● User power (Configured in the system block "Module Parameters" node; see the figure
below.)
S7-200 SMART
142 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Range
You then configure either the voltage range or the current range for the channel. You can
choose one of the following value ranges:
● +/- 10 V
● 0 - 20 mA
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 143
PLC device configuration
6.1 Configuring the operation of the PLC system
Alarm configuration
You select whether to enable or disable the following alarms for the selected channel of the
selected module:
● Upper limit exceeded (value > 32511)
● Lower limit exceeded (value < -32512)
● Wire break (for current channels only)
● Short circuit (for voltage channels only)
● User power (Configured in the system block "Module Parameters" node; see the figure
below.)
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
144 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
The RTD analog input module provides a current at terminals I+ and I- for resistance
measurements. The current is fed to the resistance for measuring its voltage potential. The
current cables must be wired directly to the resistance thermometer/resistor.
Measurements programmed for 4-or 3-wire connections compensate for line resistance and
return considerably higher accuracy compared to 2-wire connections.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 145
PLC device configuration
6.1 Configuring the operation of the PLC system
Resistor
Depending upon the RTD type that you select, you can configure the following RTD resistors
for the channel:
Coefficient
Depending upon the RTD resistor that you select, you can configure the following RTD
temperature coefficients for the channel:
• Pt 10 • Pt 0.00385055
• Pt 50 • Pt 0.003910
• Pt 100 • Pt 0.00385055
• Pt 500 • Pt 0.003916
• Pt 0.003902
• Pt 0.003920
• Pt 0.003910
S7-200 SMART
146 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
• Ni 100 • Ni 0.006170
• Ni 0.006180
• Ni 0.006720
• Ni 120 • Ni 0.006180
• Ni 200 • Ni 0.006720
• Ni 500
• Ni 1000
• Cu 10 • Cu 0.00426
• Cu 0.00428
• Cu 0.00427
• Cu 50 • Cu 0.00426
• Cu 100 • Cu 0.00428
Scale
You configure a temperature scale for the channel, choosing one of the following options:
● Celsius
● Fahrenheit
Note
For the "Resistance 4-wire", "Resistance 3-wire", and "Resistance 2-wire" RTD types and
associated resistors, you cannot configure temperature coefficients or temperature
scales.
Rejection
Fluctuations in RTD analog input values can also be caused by the response time of the
sensor, or the length and condition of the wires carrying the RTD analog signal to the
module. In such cases, the fluctuating values could be changing too rapidly for the program
logic to respond effectively. You can configure the module to reject signals to eliminate or
minimize noise at the following frequencies:
● 10 Hz
● 50 Hz
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 147
PLC device configuration
6.1 Configuring the operation of the PLC system
● 60 Hz
● 400 Hz
Smoothing
You can also configure the module to smooth the RTD analog input signal over a configured
number of cycles, thus presenting an averaged value to the program logic. You have four
choices for the smoothing algorithm:
● None
● Weak
● Medium
● Strong
Alarm configuration
You select whether to enable or disable the following alarms for the selected channel of the
selected RTD module:
● Wire break
● Upper limit exceeded
● Lower limit exceeded
● User power (Configured in the system block "Module Parameters" node; see the figure
below.)
S7-200 SMART
148 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
The TC analog expansion module measures the value of voltage connected to the module
inputs.
Thermocouple
Depending upon the thermocouple type that you select, you can configure the following
thermocouples for the channel:
● Type B (PtRh-PtRh)
● Type N (NiCrSi-NiSi)
● Type E (NiCr-CuNi)
● Type R (PtRh-Pt)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 149
PLC device configuration
6.1 Configuring the operation of the PLC system
● Type S (PtRh-Pt)
● Type J (Fe-CuNi)
● Type T (Cu-CuNi)
● Type K (NiCr-Ni)
● Type C (W5Re-W26Re)
● TXK/XK (TXK/XK(L))
Scale
You configure a temperature scale for the channel, choosing one of the following options:
● Celsius
● Fahrenheit
Rejection
Fluctuations in thermocouple analog input values can also be caused by the response time
of the sensor, or the length and condition of the wires carrying the thermocouple analog
signal to the module. In such cases, the fluctuating values could be changing too rapidly for
the program logic to respond effectively. You can configure the TC analog input module to
reject signals to eliminate or minimize noise at the following frequencies:
● 10 Hz
● 50 Hz
● 60 Hz
● 400 Hz
Smoothing
You can also configure the module to smooth the thermocouple analog input signal over a
configured number of cycles, thus presenting an averaged value to the program logic. You
have four choices for the smoothing algorithm:
● None
● Weak
● Medium
● Strong
S7-200 SMART
150 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Alarm configuration
You select whether to enable or disable the following alarms for the selected channel of the
selected TC analog input module:
● Wire break
● Upper limit exceeded
● Lower limit exceeded
● User power (Configured in the system block "Module Parameters" node; see the figure
below.)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 151
PLC device configuration
6.1 Configuring the operation of the PLC system
a value to be added to the sensor conversion. The corrected sensor conversion is then
linearized using the thermocouple tables.
For optimum operation of the cold junction compensation, the thermocouple module must be
located in a thermally stable environment. Slow variation (less than 0.1 °C/minute) in
ambient module temperature is correctly compensated within the module specifications. Air
movement across the module will also cause cold junction compensation errors.
If better cold junction error compensation is needed, an external iso-thermal terminal block
may be used. The thermocouple module provides for use of a 0 °C referenced or 50 °C
referenced terminal block.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
152 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
Address
Click the scroll buttons to enter the desired port address (1-126), for the RS485 or RS232
port: The default port address is 2.
Baud rate
Choose the desired data baud rate from the dropdown list:
● 9.6 Kbps
● 19.2 Kbps
● 187.5 Kbps
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 153
PLC device configuration
6.1 Configuring the operation of the PLC system
S7-200 SMART
154 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
WARNING
Effect of clearing PLC memory on outputs
Clearing the PLC memory affects the state of digital and analog outputs. The default is
for digital and analog outputs to use a substitute value of 0. If you have defined
substitute values other than 0 or chosen "Freeze" for your digital or analog outputs, you
need to be aware that when you delete the system block, you are deleting the substitute
and freeze information and, as a result, your outputs shall return to the default value of
0. Furthermore, if you perform a selective clear such that you keep your system block
but delete your program block, then your analog outputs are frozen at their current
value. Until you download a new program block, the only way to make changes to the
state of the analog outputs is by means of the status chart.
If the S7-200 SMART PLC is connected to equipment when you clear the PLC memory,
changes to the state of the digital outputs can be transmitted to the equipment. If you
clear PLC memory without planning for the consequences to your digital and analog
outputs, your equipment could operate in an unpredictable fashion, which could result in
death or serious injury to personnel and/or damage to equipment.
Always follow appropriate safety precautions and ensure that your process is in a safe
state before clearing the PLC memory.
3. Select what to clear - Program Block, Data Block, System Block, or all blocks, or select
"Reset to factory defaults".
4. Click the Clear button.
Clearing the PLC memory requires the PLC to be in STOP mode and then deletes the
selected blocks or resets the PLC to the factory-set defaults, depending on your selection. A
clear operation does not clear the IP address, station name, or reset the time-of-day clock.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 155
PLC device configuration
6.1 Configuring the operation of the PLC system
When executed, the "Reset to factory defaults" setting deletes all blocks, resets all user
memory to the initial powerup state, and resets all Special Memory (Page 828) to initial
values.
WARNING
Inserting a memory card into a CPU
Inserting a memory card into a CPU in RUN mode causes the CPU to automatically
transition to STOP mode. You cannot change the CPU to RUN mode if a memory card is
inserted.
Inserting a memory card into a running CPU can cause disruption to process operation,
possibly resulting in death or severe personal injury.
Always ensure that the CPU is in STOP mode (Page 41) prior to inserting a memory card.
S7-200 SMART
156 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.1 Configuring the operation of the PLC system
After the CPU is reset, you can assign a new password and begin programming, or load a
program from another program transfer memory card (Page 85) or from your hard disk.
Note
If you load a password-protected program from a memory card or file on your hard disk, you
must enter the password to access the protected areas. You cannot access a password-
protected program component without a password, nor can you clear an assigned password
without entry of the password.
3. Click the Clear button and power cycle the CPU within 60 seconds. Note that you must
physically cycle the power within 60 seconds; a warm start or other reboot is not
sufficient.
After you perform these steps within the required time frame, the CPU resets to factory
defaults.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 157
PLC device configuration
6.2 High-speed I/O
3. Save this file to the microSDHC card root level under the file name "S7_JOB.S7S".
4. Label the card and store it in a safe place for future use.
Note
A reset-to-factory-defaults card is for resetting standard CPUs only
Because the compact serial (CRs) model CPUs do not have a microSD card interface, you
cannot use a reset-to-factory-defaults card to clear the PLC and reset it to factory faults. See
Clearing PLC memory (Page 155) for instructions on how to clear a PLC without the use of a
reset-to-factory-defaults card.
High-speed counters
The CPU provides integrated high-speed counter functions that count high speed external
events without degrading the performance of the CPU. Refer to the "Product overview"
(Page 18) chapter for the rates supported by your CPU. Dedicated inputs exist for clocks,
direction control, and reset, where these functions are supported. You can select single
phase, dual phase, or AB quadrature phase for varying the counting rate. For more
information, refer to the description of the high-speed counter instructions (Page 243).
S7-200 SMART
158 System Manual, V2.4, 03/2019, A5E03822230-AG
PLC device configuration
6.2 High-speed I/O
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 159
Program instructions 7
7.1 Bit logic
S7-200 SMART
160 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
See also
Bit logic input examples (Page 173)
Logic stack overview (Page 163)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 161
Program instructions
7.1 Bit logic
S7-200 SMART
162 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
See also
Bit logic input examples (Page 173)
Logic stack overview (Page 163)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 163
Program instructions
7.1 Bit logic
STL Description
AENO AENO is used in the STL representation of LAD/FBD box ENO bit. AENO performs a logical AND of
the ENO bit with the top of stack for the same effect as the ENO bit of a LAD/FBD box. The result of the
AND operation is the new top of stack value.
S7-200 SMART
164 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
STL1 Description
ALD The AND Load instruction (ALD) combines the values in the first and second levels of the stack using a logical
AND operation. The result is loaded in the top of stack. After the ALD is executed, the stack depth is decreased
by one.
OLD The OR Load instruction (OLD) combines the values in the first and second levels of the stack, using a logical
OR operation. The result is loaded in the top of the stack. After the OLD is executed, the stack depth is de-
creased by one.
LPS The Logic Push instruction (LPS) duplicates the top value on the stack and pushes this value onto the stack.
The bottom of the stack is pushed off and lost.
LRD The Logic Read instruction (LRD) copies the second stack value to the top of stack. The stack is not pushed or
popped, but the old top-of-stack value is destroyed by the copy.
LPP The Logic Pop instruction (LPP) pops one value off of the stack. The second stack value becomes the new top
of stack value.
LDS N The Load Stack instruction (LDS) duplicates the stack bit (N) on the stack and places this value on top of the
stack. The bottom of the stack is pushed off and lost.
AENO AENO is used in the STL representation of the LAD/FBD box ENO bit. AENO performs a logical AND of the
ENO bit with the top of stack for the same effect as the ENO bit of a LAD/FBD box. The result of the AND op-
eration is the new top of stack.
1 Not applicable for LAD or FBD
As shown in the following figure, the CPU uses a logic stack to resolve the control logic. In
these examples, "iv0" to "iv31" identify the initial values of the logic stack, "nv" identifies a
new value provided by the instruction, and "S0" identifies the calculated value that is stored
in the logic stack.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 165
Program instructions
7.1 Bit logic
S7-200 SMART
166 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
LAD STL
Network 1
LD I0.0
LD I0.1
LD I2.0
A I2.1
OLD
ALD
= Q5.0
Network 2
LD I0.0
LPS
LD I0.5
O I0.6
ALD
= Q7.0
LRD
LD I2.1
O I1.3
ALD
= Q6.0
LPP
A I1.0
= Q3.0
7.1.5 NOT
See also
Bit logic input examples (Page 173)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 167
Program instructions
7.1 Bit logic
Note
Because the Positive Transition and Negative Transition instructions require an on-to-off or
an off-to-on transition, you cannot detect an edge-up or edge-down transition on the first
scan. During the first scan, the CPU saves the initial input state in a memory bit. On
subsequent scans, these instructions compare the current state and the state of the memory
bit, to detect a transition.
See also
Bit logic input examples (Page 173)
S7-200 SMART
168 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
See also
Bit logic output examples (Page 174)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 169
Program instructions
7.1 Bit logic
See also
Bit logic input examples (Page 173)
Bit logic output examples (Page 174)
S7-200 SMART
170 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
LAD/FBD 1 Description
The bit parameter assigns the Boolean address that is set or reset. The optional OUT connection
reflects the signal state of the Bit parameter.
SR (Set dominant bistable) is a latch where the set dominates. If the set (S1) and reset (R) sig-
nals are both true, the output (OUT) is true.
RS (Reset dominant bistable) is a latch where the reset dominates. If the set (S) and reset (R1)
signals are both true, the output (OUT) is false.
SR truth table
S1 R Out (bit)
0 0 Previous state
0 1 0
1 0 1
1 1 1
RS truth table
S R1 Out (bit)
0 0 Previous state
0 1 0
1 0 1
1 1 0
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 171
Program instructions
7.1 Bit logic
Example SR and RS
LAD STL
NETWORK 1
LD I0.0
LD I0.1
NOT
A Q0.0
OLD
= Q0.0
NETWORK 2
LD I0.0
LD I0.1
NOT
LPS
A Q0.1
= Q0.1
LPP
ALD
O Q0.1
= Q0.1
S7-200 SMART
172 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.1 Bit logic
LAD STL
Normally-open contacts I0.0 AND I0.1 must be ON Network 1
(closed) to activate Q0.0. The NOT instruction acts LD I0.0
as an inverter. In RUN mode, Q0.0 and Q0.1 have A I0.1
opposite logic states. = Q0.0
NOT
= Q0.1
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 173
Program instructions
7.1 Bit logic
LAD STL
Output instructions assign bit values to external I/O Network 1
(I, Q) and internal memory (M, SM, T, C, V, S, L). LD I0.0
= Q0.0
= Q0.1
= V0.0
S7-200 SMART
174 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.2 Clock
7.2 Clock
TODW T The Set real-time clock instruction writes a new time and date to the CPU using the
8 byte Time buffer data that is assigned by T.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 175
Program instructions
7.2 Clock
Note
READ_RTC, SET_RTC programming tips
These instructions do not accept Invalid dates. If you enter February 30, for example, a time-
of-day non-fatal error occurs (0007H).
Do not use the READ_RTC / SET_RTC instructions in both the main program and in an
interrupt routine. A READ_RTC / SET_RTC instruction in an interrupt routine cannot execute
while another READ_RTC / SET_RTC instruction is executing. In this case, the CPU sets
system flag bit SM4.3, indicating that two simultaneous accesses to the clock were
attempted resulting in a T data error (non-fatal error 0007H).
The time-of-day clock in the CPU uses only the least significant two digits for the year, so 00
represents the year 2000. User programs that use the year's value must take into account
the two-digit representation.
The CPU handles leap year correctly through year 2099.
S7-200 SMART
176 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.2 Clock
Note
Compact serial (CRs) CPU models do not have a RTC (Real-time Clock)
You can use the READ_RTC and SET_RTC instructions to set the year, date, and time
values in compact serial (CRs) CPU models, but the values will be lost on the next CPU
power off-on cycle. On power-up, the date and time will initialize to January 1, 2000.
7.2.2
TODWX T The Set real-time clock instruction writes a new time, date, and daylight saving
configuration to the PLC using the 19-byte buffer data that is assigned by byte
address T.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 177
Program instructions
7.2 Clock
Note
READ_RTCX, SET_RTCX programming tips
These instructions do not accept Invalid dates. If you enter February 30, for example, a time-
of-day non-fatal error occurs (0007H).
Do not use the READ_RTCX / SET_RTCX instructions in both the main program and in an
interrupt routine. A READ_RTCX / SET_RTCX instruction in an interrupt routine cannot
execute while another READ_RTCX / SET_RTCX instruction is executing. In this case, the
CPU sets system flag bit SM4.3, indicating that two simultaneous accesses to the clock were
attempted resulting in a T data error (non-fatal error 0007H).
The time-of-day clock in the CPU uses only the least significant two digits for the year, so 00
represents the year 2000. User programs that use the year's value must take into account
the two-digit representation.
The CPU handles leap year correctly through year 2099.
Note
T bytes (9 to18) or (9 to 20) are used only when a time correction mode is assigned in byte
8. Otherwise, the last values written to bytes (9 to18) or (9 to 20) by
STEP 7-Micro/WIN SMART or the SET_RTCX instruction are returned.
You must assign all date and time values in BCD format (for example, 16#12 for the year
2012). The BCD value range of 00 to 99 can assign the year in the range of 2000 to 2099.
S7-200 SMART
178 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.2 Clock
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 179
Program instructions
7.2 Clock
Note
Compact serial (CRs) CPU models do not have a RTC (Real-time Clock)
You can use the READ_RTCX and SET_RTCX instructions to set the year, date, and time
values in compact serial (CRs) CPU models, but the values will be lost on the next CPU
power off-on cycle. On power-up, the date and time will initialize to January 1, 2000.
S7-200 SMART
180 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
7.3 Communication
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
You can have any number of GET and PUT instructions in the program, but only a maximum
of 16 GET and PUT instructions can be activated at any one time. For example, you can
have eight GET and eight PUT instructions, or six GET and ten PUT instructions, active at
the same time in a given CPU.
When you execute a GET or PUT instruction, the CPU makes an Ethernet connection to the
remote IP address in the GET or PUT table. The CPU maintains a maximum of eight
connections at a time. Once a connection is established, that connection is maintained until
the CPU goes to STOP mode.
The CPU utilizes a single connection for all GET/PUT instructions that are directed to the
same IP address. For example, if there are three GET instructions enabled at the same time
when the remote IP address is 192.168.2.10, then the GET instructions execute sequentially
on one Ethernet connection to IP address 192.168.2.10.
If you try to create a ninth connection (a ninth IP address), the CPU searches through the
connections to find the connection that has been inactive for the longest period of time. The
CPU disconnects this connection and then creates a connection to the new IP address.
The GET and PUT instructions require additional communication background time (refer to
"Configuring communication" (Page 128)) when they are processing/active/busy and also
when they are just maintaining the connection to the other device. The amount of
communication background time required depends on the number of GET and PUT
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 181
Program instructions
7.3 Communication
instruction that are active/busy, how often the GET and PUT instructions are executed, and
the number of connections that are currently open. You should adjust the communication
background time to a higher value if the communication performance is slow.
S7-200 SMART
182 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
Table 7- 4 Error codes for the GET and PUT instructions TABLE parameter
Code Definition
0 No error
1 Illegal parameter in the PUT/GET table:
• Local area is not I, Q, M, or V
• Local area is not large enough for the data length requested
• Data length is zero or greater than 222 bytes for a GET or greater than 212 bytes for a PUT
• Remote area is not I, Q, M, or V
• Remote IP address is illegal (0.0.0.0)
• Remote IP address is a broadcast address or a multicast address
• Remote IP address is the same as the Local IP address
• Remote IP address is on a different subnet
2 Too many PUT/GET instructions are currently active (only 16 allowed)
3 No connection available. All connections are currently active with outstanding requests
4 Error returned from remote CPU:
• Too much data was requested or sent
• Writing to Q memory is not allowed in STOP mode
• Memory area is write-protected (see SDB configuration)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 183
Program instructions
7.3 Communication
Code Definition
5 No connection available to the remote CPU:
• Remote CPU does not have an available server connection
• Connection to remote CPU was lost (CPU powered off, physical disconnect)
6 to 9, Not used (Reserved for future use)
A to F
The following figure shows an example to illustrate the utility of the GET and PUT
instructions. For this example, consider a production line where tubs of butter are being filled
and sent to one of four boxing machines (case packers). The case packer packs eight tubs
of butter into a single cardboard box. A diverter machine controls the flow of butter tubs to
each of the case packers. Four CPUs control the case packers, and a CPU with a TD 400
operator interface controls the diverter.
S7-200 SMART
184 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
The following figure shows the GET table (VB200) and PUT table (VB300) for accessing the
data in station 2. The Diverter CPU uses a GET instruction to read the control and status
information on a continuous basis from each of the case packers. Each time a case packer
has packed 100 cases, the diverter notes this and sends a message to clear the status word
using a PUT instruction.
Table 7- 5 GET and PUT instructions buffer for reading from and clearing the count of Case Packer
1
GET_ Bit Bit Bit Bit Bit Bit Bit Bit PUT_ Bit Bit Bit Bit Bit Bit Bit Bit
TABLE 7 6 5 4 3 2 1 0 TABLE 7 6 5 4 3 2 1 0
buffer buffer
VB200 D A E 0 Error code VB300 D A E 0 Error code
VB201 Remote station IP address = 192. VB301 Remote station IP address = 192.
VB202 168. VB302 168.
VB203 50. VB303 50.
VB204 2 VB304 2
VB205 Reserved = 0 (Must be set to zero) VB305 Reserved = 0 (Must be set to zero)
VB206 Reserved = 0 (Must be set to zero) VB306 Reserved = 0 (Must be set to zero)
VB207 Pointer to the data VB307 Pointer to the data
VB208 area in the VB308 area in the
VB209 remote station = VB309 remote station =
VB210 (&VB100) VB310 (&VB101)
VB211 Data length = 3 bytes VB311 Data length = 2 bytes
VB212 Pointer to the data VB312 Pointer to the data
VB213 area in the VB313 area in the
VB214 local station (this CPU) = VB314 local station (this CPU) =
VB215 (&VB216) VB315 (&VB316)
VB216 Control VB316 0
VB217 Status MSB VB317 0
VB218 Status LSB
In this example, the data immediately follows the PUT and GET tables. This data can be
placed anywhere in the CPU memory since it is pointed to by the local station pointer in a
table (for example, VB212 - VB215).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 185
Program instructions
7.3 Communication
S7-200 SMART
186 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 187
Program instructions
7.3 Communication
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of signal boards.
RCV TBL, PORT The Receive instruction (RCV) initiates or terminates the receive message
function. You must specify a start and an end condition for the Receive
box to operate. Messages received through the specified port (PORT) are
stored in the data buffer (TBL). The first entry in the data buffer specifies
the number of bytes received.
S7-200 SMART
188 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 189
Program instructions
7.3 Communication
You can only use Freeport communications when the CPU is in RUN mode. Enable the
Freeport mode by setting a value of 01 in the protocol select field of SMB30 (Port 0) or
SMB130 (Port 1). While in Freeport mode, you cannot communicate with an HMI on the
same port.
Note
The serial CR model CPUs disable Freeport mode when you connect a USB-PPI cable to
the CPU. Likewise, the CPU inhibits the switch to Freeport mode if you connect a USB-PPI
cable to the CRs CPUs.
Transmit data
The Transmit instruction lets you send a buffer of one or more characters, up to a maximum
of 255. The following figure shows the format of the Transmit buffer.
S7-200 SMART
190 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
If an interrupt routine is attached to the transmit complete event, the CPU generates an
interrupt (interrupt event 9 for port 0 and interrupt event 26 for port 1) after the last character
of the buffer is sent.
You can transmit without using interrupts (for example, sending a message to a printer) by
monitoring SM4.5 (port 0) or SM4.6 (port 1) to signal when transmission is complete.
You can use the Transmit instruction to generate a BREAK condition by setting the number
of characters to zero and then executing the Transmit instruction. This generates a BREAK
condition on the line for 16-bit times at the current baud rate. Transmitting a BREAK is
handled in the same manner as transmitting any other message, in that a Transmit interrupt
is generated when the BREAK is complete and SM4.5 or SM4.6 signals the current status of
the Transmit operation.
Receive data
Note
The receive message function is automatically terminated in case of a framing, parity,
overrun, or break error.
You must define a start condition and an end condition (maximum character count) for the
receive message function to operate.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 191
Program instructions
7.3 Communication
en:
0 = Receive message function is disabled.
1 = Receive message function is enabled.
The enable/disable receive message bit is checked each time the RCV instruction is executed.
sc:
0 = Ignore SMB88 or SMB188.
1 = Use the value of SMB88 or SMB188 to detect start of message.
ec:
0 = Ignore SMB89 or SMB189.
1 = Use the value of SMB89 or SMB189 to detect end of message.
il:
0 = Ignore SMB90 or SMB190.
1 = Use the value of SMB90 or SMB190 to detect start of message.
c/m:
0 = Timer is an inter-character timer.
1 = Timer is a message timer.
tmr:
0 = Ignore SMW92 or SMW192.
1 = Terminate receive if the time period in SMW92 or SMW192 is exceeded.
bk:
0 = Ignore break conditions.
1 = Use break condition as start of message detection.
SMB88 SMB188 Start of message character.
SMB89 SMB189 End of message character.
SMW90 SMW190 Idle line time period given in milliseconds. The first character received after idle line time has ex-
pired is the start of a new message.
SMW92 SMW192 Inter-character/message timer time-out value given in milliseconds. If the time period is exceeded,
the receive message function is terminated.
SMB94 SMB194 Maximum number of characters to be received (1 to 255 bytes). This range must be set to the
expected maximum buffer size, even if the character count message termination is not used.
S7-200 SMART
192 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
Note
If there is traffic present on the communications port from other devices when the Receive
instruction is executed, the receive message function could begin receiving a character in
the middle of that character, resulting in a possible parity or framing error and termination of
the receive message function. If parity is not enabled the received message could contain
incorrect characters. This situation can occur when the start condition is specified to be a
specific start character or any character, as described in item 2 and item 6 below.
The Receive instruction supports several message start conditions. Specifying a start
condition involving a break or an idle line detection avoids the problem of starting a message
in the middle of a character by forcing the receive message function to synchronize the start
of the message with the start of a character before placing characters into the message
buffer.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 193
Program instructions
7.3 Communication
The idle line time should always be greater than the time to transmit one character (start
bit, data bits, parity and stop bits) at the specified baud rate. A typical value for the idle
line time is three character times at the specified baud rate.
You use idle line detection as a start condition for binary protocols, protocols where there
is not a particular start character, or when the protocol specifies a minimum time between
messages.
2. Start character detection: The start character is any character which is used as the first
character of a message. A message is started when the start character specified in
SMB88 or SMB188 is received. The receive message function stores the start character
in the receive buffer as the first character of the message. The receive message function
ignores any characters that are received before the start character. The start character
and all characters received after the start character are stored in the message buffer.
Typically, you use start character detection for ASCII protocols in which all messages
start with the same character.
S7-200 SMART
194 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
character. If any character but the start character is received, the receive message
function restarts the search for an idle line condition. All characters received before the
idle line condition has been satisfied and before the start character has been received are
ignored. The start character is placed in the message buffer along with all subsequent
characters.
The idle line time should always be greater than the time to transmit one character (start
bit, data bits, parity and stop bits) at the specified baud rate. A typical value for the idle
line time is three character times at the specified baud rate.
Typically, you use this type of start condition when there is a protocol that specifies a
minimum time between messages, and the first character of the message is an address
or something which specifies a particular device. This is most useful when implementing
a protocol where there are multiple devices on the communications link. In this case the
Receive instruction triggers an interrupt only when a message is received for the specific
address or devices specified by the start character.
Typically, you use break detection as a start condition only when a protocol requires it.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 195
Program instructions
7.3 Communication
5. Break and a start character: The Receive instruction can be configured to start receiving
characters after receiving a break condition, and then a specific start character, in that
sequence. After the break condition, the receive message function looks for the specified
start character. If any character but the start character is received, the receive message
function restarts the search for a break condition. All characters received before the break
condition has been satisfied and before the start character has been received are
ignored. The start character is placed in the message buffer along with all subsequent
characters.
Starting a message on any character allows the message timer to be used to time out the
receiving of a message. This is useful in cases where Freeport is used to implement the
master or host portion of a protocol and there is a need to time out if no response is
received from a slave device within a specified amount of time. The message timer starts
when the Receive instruction executes because the idle line time was set to zero. The
message timer times out and terminates the receive message function if no other end
condition is satisfied.
Typically, you use end character detection with ASCII protocols where every message
ends with a specific character. You can use end character detection in combination with
the intercharacter timer, the message timer or the maximum character count to terminate
a message.
S7-200 SMART
196 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
characters (including the second character) exceeds the number of milliseconds specified
in SMW92 or SMW192, the receive message function is terminated. The intercharacter
timer is restarted on each character received. See the following figure.
You can use the intercharacter timer to terminate a message for protocols which do not
have a specific end-of-message character. This timer must be set to a value greater than
one character time at the selected baud rate since this timer always includes the time to
receive one entire character (start bit, data bits, parity and stop bits).
You can use the intercharacter timer in combination with the end character detection and
the maximum character count to terminate a message.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 197
Program instructions
7.3 Communication
3. Message timer: The message timer terminates a message at a specified time after the
start of the message. The message timer starts as soon as the start condition(s) for the
receive message function have been met. The message timer expires when the number
of milliseconds specified in SMW92 or SMW192 has passed. See the following figure.
Typically, you use a message timer when the communications devices cannot guarantee
that there will not be time gaps between characters or when operating over modems. For
modems, you can use a message timer to specify a maximum time allowed to receive the
message after the message has started. A typical value for a message timer would be
about 1.5 times the time required to receive the longest possible message at the selected
baud rate.
You can use the message timer in combination with the end character detection and the
maximum character count to terminate a message.
4. Maximum character count: The Receive instruction must be told the maximum number of
characters to receive (SMB94 or SMB194). When this value is met or exceeded, the
receive message function is terminated. The Receive instruction requires that the user
specify a maximum character count even if this is not specifically used as a terminating
condition. This is because the Receive instruction needs to know the maximum size of
the receive message so that user data placed after the message buffer is not overwritten.
The maximum character count can be used to terminate messages for protocols where
the message length is known and always the same. The maximum character count is
always used in combination with the end character detection, intercharacter timer, or
message timer.
5. Parity errors: The Receive instruction automatically terminates when the hardware signals
a parity, framing, or overrun error; or if a break condition is detected after the start of a
message. Parity errors occur only if parity is enabled in SMB30 or SMB130. Framing
errors occur if the stop bit is not correct. Overrun errors occur if characters come in to
quickly for the hardware to handle. A break condition terminates a message because it
resembles a parity or framing error to the hardware. There is no way to disable this
function.
6. User termination: The user program can terminate a receive message function by
executing another Receive instruction with the enable bit (EN) in SMB87 or SMB187 set
to zero. This immediately terminates the receive message function.
S7-200 SMART
198 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
Note
SMB2 and SMB3 are shared between Port 0 and Port 1. When the reception of a character
on Port 0 results in the execution of the interrupt routine attached to that event (interrupt
event 8), SMB2 contains the character received on Port 0, and SMB3 contains the parity
status of that character. When the reception of a character on Port 1 results in the execution
of the interrupt routine attached to that event (interrupt event 25), SMB2 contains the
character received on Port 1 and SMB3 contains the parity status of that character.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 199
Program instructions
7.3 Communication
S7-200 SMART
200 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
7.3.3 Get port address and set port address (PPI protocol on RS485/RS232)
You can use the GET_ADDR and SET_ADDR instructions to read and set the PPI network
address of the selected port.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of signal boards.
SPA ADDR, PORT The SET_ADDR instruction sets the port station address (PORT) to the
value specified in ADDR. The new address is not saved permanently. After
a power cycle, the affected port returns to the network address downloaded
in the system block.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 201
Program instructions
7.3 Communication
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
SIP ADDR, MASK, GATE The SIP_ADDR instruction sets the CPU’s IP address to the value found
in ADDR, the CPU’s subnet mask to the value found in MASK, and the
CPU’s gateway to the value found in GATE.
S7-200 SMART
202 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
Note
To use the SIP_ADDR instruction, do not select the "IP address data is fixed to the values
below and cannot be changed by other means" option for the Ethernet Port in the
Communication section of the System Block.
Execution of the SIP_ADDR instruction causes the CPU to store the IP address, subnet
mask, and gateway values in persistent memory.
Example
Note that STEP 7-Micro/WIN SMART displays the outputs for the GIP_ADDR instruction,
ADDR, MASK, and GATE, as string values. For the SIP_ADDR instruction, however, you
provide the ADDR, MASK, and GATE inputs as hexadecimal values. For the SIP_ADDR
input values, think of each octet of the IP address, MASK and GATE as a hexadecimal
number.
For the SIP_ADDR instruction, consider the octets of the IP address "192.168.2.150":
You would use the combined hexadecimal values of the octets to form the ADDR input to the
SIP_ADDR instruction: 16#C0A80296. (You could convert this number to a decimal value,
but the hexadecimal value is representative of the values of the octets.)
Similarly, consider the octets of the subnet mask "255.255.255.0":
You would use the combined hexadecimal values of the octets to form the MASK input to the
SIP_ADDR instruction: 16#FFFFFF00. You could also use the decimal equivalent, but not a
string representation.
The following program status display shows two networks:
● Network 1: The GIP_ADDR reads the IP address of 192.168.2.150 with a subnet mask of
255.255.255.0.
● Network 2: The SIP_ADDR sets the IP address to 192.168.2.150 (16#C0A80296) and
sets the subnet mask to 255.255.255.0 (16#FFFFFF00).
Note that the default gateway is 0.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 203
Program instructions
7.3 Communication
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
S7-200 SMART
204 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
The OUC instructions maintain information about the connections so that your program does
not need to permanently allocate V memory for the OUC Tables. The data in the tables must
be kept constant while the OUC instruction is active.
The OUC instructions require additional communication background time when they are
processing/active/busy and also when they are just maintaining the connection to the other
device. The amount of communication background time required depends on the number of
OUC instructions that are active/busy, how often the OUC instructions are executed, and the
number of connections that are currently open. You should adjust the communication
background time to a higher value if the communication performance is slow. Refer to
"Configuring communication" (Page 128) for further information.
All of the OUC instructions use a table to store the parameters for the instructions. The
content of the tables for each instruction is described below.
The S7-200 SMART CPU uses the input table parameters to determine the instance of the
OUC instructions. The table parameters must be kept the same during an operation so that
the S7-200 SMART CPU knows that the particular instruction (instance) is the same as
during the previous scans.
Note
Siemens also offers the Open User Communication (OUC) library instructions for your
convenience. The OUC Library instructions build the tables for you based upon the inputs to
the library instructions. The Library instructions also retrieve the response information from
the tables and provide this information on the outputs of the library instructions. Refer to
"Open user communication library" (Page 495) for further information.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 205
Program instructions
7.3 Communication
TCON instruction
You use the TCON instruction to set up and establish a communication connection. Once
the CPU establishes the connection, it is automatically maintained and monitored by the
CPU. The TCON instruction has only one parameter which is the address of the TCON table.
The TCON table contains the connection parameters. There are two formats for the TCON
table based upon the protocol selected for the connection. UDP and TCP share a common
table format. ISO-on-TCP has a special TCON table format. Refer to the TCON instruction
tables below for further information.
Set the REQ bit in the table to TRUE to initiate a connection. The CPU ignores the REQ bit
while the TCON instruction is active and the connection is initializing and the Active bit is
TRUE. The TCON instruction set the Done bit when the CPU has established the
connection. The Error bit is set if there is a problem with the connection parameters or if the
CPU cannot establish a connection to the remote device. The Error Code describes the
reason for the connection failure if the Error bit is set.
The TCON instruction is asynchronous and can take several scans to complete. The Active
bit will be set while the connection operation is pending.
The TCON instruction creates either an active (client) connection or a passive (server)
connection. The CPU initiates contact with the remote devices for an active connection.
Passive connections cause the CPU to wait on the remote device to contact the CPU.
You can use the TCON instruction to determine the current status of a connection. If your
program calls the TCON instruction with the REQ bit set to FALSE, the CPU reports the
status of the connection:
● The instruction sets the Done bit (without Error) if the CPU establishes the connection
and the connection is operational.
● The instruction sets the Active bit if the connection is still in the process of being
connected.
● The instruction sets the Done and Error bits if no connection can be established. The
Error Code gives the reason for the connection failure.
The REQ bit in the table is level-triggered. It is recommended that you put a positive edge
trigger on the REQ input to initiate a connection so that the CPU only requests the
connection establishment one time.
During the connection process (the call to the TCON instruction), your program assigns a
Connection ID to the given connection. The Connection ID is a user-selected, 16-bit value
passed into the TCON instruction. The Connection ID can be any number 0 to 65534
inclusive. The CPU does not allow the Connection ID to be 65535 (0xFFFF). The Connection
S7-200 SMART
206 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
ID value is an input to all of the OUC instructions to identify the connection to be utilized for
the given operation.
You can select your own Connection ID, allowing you to use a number that is logical for your
situation. For example, you can use part of your IP address as your connection ID. You can
name your connection to IP address 192.168.2.10, connection ID 10.
Note that the S7-200 SMART does not automatically attempt to reconnect to a device after
the connection has been closed. After a connection has been disconnected, your program
must execute another TCON instruction to reconnect the device. This is true for both active
and passive connections.
Table 7- 9 Definition of TCON instruction TABLE parameter structure for UDP and TCP
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 207
Program instructions
7.3 Communication
S7-200 SMART
208 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
TSEND
You use the TSEND instruction to send data over an existing communication connection.
The TSEND table contains the connection parameters. There are two formats for the TSEND
table based upon the protocol selected for the connection. TCP and ISO-on-TCP share a
common table format. UDP has a special TSEND table format. Refer to the TSEND and
TRECV instruction tables below for further information.
The TSEND instruction initiates sending the specified number of bytes when your program
calls the TSEND instruction with the REQ bit set and the connection is not currently busy
with some other operation.
The REQ bit is level-triggered. It is recommended that you put a positive edge trigger on the
REQ input so that the CPU does not initiate unintended send operations. The CPU ignores
the REQ bit while the TSEND is Active. The status bits and error code show the status of the
TSEND for each call:
● Done without Error means the TSEND instruction completed with no errors.
● Active means that the TSEND instruction is still busy.
● Done with Error means there is a problem with the TSEND instruction. The Error Code
contains the reason for the failure.
The Done/Active/Error status is shown for one call of the TSEND instruction after the send
operation is complete. After that, the TSEND instruction responds with error code 24, which
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 209
Program instructions
7.3 Communication
means no operation pending, if your program calls the instruction with REQ set to FALSE. If
the REQ bit remains set, the TSEND instruction initiates another send operation.
The maximum amount of data that you can send in one message is 1024 bytes. Only one
TSEND instruction can be active at a time on a given connection. The program copies the
data from your send buffer in user memory to an internal buffer when the TSEND instruction
executes with REQ set, so you can change your send buffer after the TSEND instruction
executes.
TRECV
You use the TRECV instruction to retrieve data that the CPU has received over an existing
communication connection. You assign the receive area/buffer and the maximum length of
the receive area so that there is no possibility of a buffer overrun. The TRECV table contains
the parameters needed for the TRECV instruction. There are two formats for the TRECV
table based upon the protocol selected for the connection. TCP and ISO-on-TCP share a
common table format. UDP has a special TRECV table format. Refer to the TSEND and
TRECV tables below for further information.
The TRECV instruction does not have a REQ bit. After the first execution of the TRECV
instruction, the status bits show the instruction as Active. All subsequent calls to the TRECV
instruction show an Active status if no data has been received by the CPU for this
connection.
After a successful receipt of data, the instruction sets the Done bit in the status byte of the
table, and the returned Data Length value is the actual number of bytes received. The
TRECV instruction copies the received data from an internal buffer to the your receive buffer
only when the TRECV instruction executes and the Done bit is set to TRUE.
The maximum amount of data that you can receive in one message is 1024 bytes. Because
TCP acts as a "streaming" protocol, the program can collect multiple messages in one
receive message if the TRECV instruction is not called frequently. The UDP and ISO-on-
TCP protocols guarantee that each message is delineated as a separate message.
For example, let us suppose that there is a TCP client that sends four 20-byte messages to
the S7-200 SMART in rapid succession, and your program is not calling the TRECV
instruction. If your program calls the TRECV instruction after all four messages have been
accepted by the CPU, the program sees this as one receive message of 80 bytes. Your
program is responsible for calling the TRECV instruction as often as needed to receive each
message as it is sent.
Assuming the same client and the same messages as in the above example, ISO-on-TCP
and UDP delivers the four messages during four subsequent calls to the TRECV instruction.
These protocols delineate the messages and keep them separate in the CPU until your
program calls the TRECV instruction to retrieve them.
If the CPU receives more bytes than will fit into the user buffer, the TRECV instruction copies
in the maximum number of bytes allowed (Data Length in the table) and discards the rest of
the received bytes. In this situation, the TRECV instruction completes with an error to tell the
user that bytes were discarded.
S7-200 SMART
210 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
Table 7- 11 Definition of TSEND and TRECV instruction TABLE parameter structure for TCP and
ISO-on-TCP
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 211
Program instructions
7.3 Communication
Table 7- 12 Definition of TSEND and TRECV instruction TABLE parameter structure for UDP
S7-200 SMART
212 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
TDCON
You use the TDCON instruction to terminate an existing communication connection. The
instruction terminates the connection when the REQ bit is set. It is recommended that you
put a positive edge trigger on the REQ input. If the your program calls the TDCON instruction
and the connection is already disconnected, then the instruction responds with error code
24, which means no operation pending.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 213
Program instructions
7.3 Communication
S7-200 SMART
214 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.3 Communication
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 215
Program instructions
7.4 Compare
7.4 Compare
Types of comparison
Six comparison types are available:
S7-200 SMART
216 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.4 Compare
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 217
Program instructions
7.4 Compare
Note
The following conditions cause a non-fatal error, set power flow to OFF (ENO bit = 0), and
use value 0 as the result of the comparison
• Illegal indirect address is encountered (any compare instruction)
• Illegal real number (for example, NaN) is encountered for compare real instruction
To prevent these conditions from occurring, ensure that you properly initialize pointers and
values that contain real numbers before executing compare instructions that use these
values.
Compare instructions are executed regardless of the state of power flow.
S7-200 SMART
218 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.4 Compare
LAD STL
Activate I0.1 to load V memory addresses Network 1
with low values that make the compari- LD I0.1
sons FALSE and that set the status indi- MOVW -30000, VW0
cators OFF. MOVD -200000000, VD2
MOVR 1.012E-006, VD6
See also
Constants (Page 73)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 219
Program instructions
7.4 Compare
LDS<> IN1, IN2 Compare two character strings of STRING data type:
OS<> IN1, IN2 The result is TRUE, if string IN1 does not equal string IN2.
AS<> IN1, IN2
S7-200 SMART
220 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.4 Compare
Note
The following conditions cause a non-fatal error, set power flow to OFF (ENO bit = 0), and
use value 0 as the result of the comparison:
• Illegal indirect address is encountered (any compare instruction)
• A variable string with a length greater than 254 characters is encountered (Compare
String instruction)
• A variable string whose starting address and length are such that it will not fit in the
specified memory area (Compare String instruction)
To prevent these conditions from occurring, ensure that you properly initialize pointers and
memory locations that are intended to hold ASCII strings prior to executing compare
instructions that use these values. Ensure that the buffer reserved for an ASCII string can
reside completely within the specified memory area.
Compare instructions are executed regardless of the state of power flow.
If a constant string parameter is entered directly in the program editor (126 characters
maximum) or a variable string is initialized in the data block editor (254 characters
maximum), the string assignment must begin and end with double quote characters.
See also Constants (Page 73)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 221
Program instructions
7.5 Convert
7.5 Convert
Standard conversions
IBCD OUT
Integer to BCD:
Convert the input integer WORD data type value IN to a binary-coded decimal
WORD data type and load the result at the address assigned to OUT. The valid
range for IN is 0 to 9999 integer.
For STL, the IN and OUT parameters use the same address.
S7-200 SMART
222 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
Truncate:
TRUNC IN, OUT
Convert the 32-bit real-number value IN into a double integer value and place
the result at the address assigned to OUT. Only the whole number portion of
the real number is converted, and the fraction is discarded.
Note: If the value that you are converting is not a valid real number or is too
large to be represented in the output, then the overflow bit is set and the output
is not affected.
SEG IN, OUT SEG:
To illuminate the segments of a seven-segment display, the Segment instruc-
tion converts the character byte specified by IN to generate a bit pattern byte at
the address assigned to OUT.
The illuminated segments represent the character in the least significant digit of
the input byte.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 223
Program instructions
7.5 Convert
LAD STL
Network 1
LD I1.0
SEG VB48, AC1
S7-200 SMART
224 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
LAD STL
Convert inches to centimeters: Network 1
1. Load a counter value (inches) into LD I0.0
AC1 (ex. C10=101). ITD C10, AC1
DTR AC1, VD0
2. Convert the value to a real number
(ex. VD0=101.0). MOVR VD0, VD8
*R VD4, VD8
3. Multiply by 2.54 to convert to centi-
ROUND VD8, VD12
meters
(ex. VD4=2.54, VD8=256.54).
4. Convert the value back to an integer
(ex. VD12=257).
See also
Assigning a constant value for instructions
See also
Assigning a constant value for instructions (Page 73)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 225
Program instructions
7.5 Convert
Converting number values to the ASCII character representation (ITA, DTA, and RTA)
ASCII character output number format:
● Positive values are written to the output buffer without a sign.
● Negative values are written to the output buffer with a leading minus sign (-).
● Leading zeros to the left of the decimal point (except the digit adjacent to the decimal
point) are suppressed.
● Values are right-justified in the output buffer.
● Real numbers: Values to the right of the decimal point are rounded to fit in the assigned
number of digits to the right of the decimal point.
● Real numbers: The size of the output buffer must be a minimum of three bytes more than
the number of digits to the right of the decimal point.
S7-200 SMART
226 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
Integer to ASCII
The size of the output buffer is always 8 bytes. The number of digits to the right of the
decimal point in the output buffer is assigned by the nnn field. The valid range of the nnn
field is 0 to 5. If you assign 0 digits to the right of the decimal point, then the value is
converted with no decimal point. For values of nnn greater than 5, the output buffer is filled
with ASCII space characters. The c bit specifies the use of either a comma (c=1) or a
decimal point (c=0) as the separator between whole number and fraction. The most
significant 4 bits must always be zero.
The following figure shows examples of values that are formatted using a decimal point (c=0)
with three digits to the right of the decimal point (nnn=011).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 227
Program instructions
7.5 Convert
The size of the output buffer is always 12 bytes. The number of digits to the right of the
decimal point in the output buffer is assigned by the nnn field. The valid range of the nnn
field is 0 to 5. If you assign 0 digits to the right of the decimal point, then the value is
converted with no decimal point. For values of nnn bigger than 5, the output buffer is filled
with ASCII spaces. The c bit specifies the use of either a comma (c=1) or a decimal point
(c=0) as the separator between whole number and fraction. The most significant 4 bits must
always be zero.
The following figure shows examples of values that are formatted using a decimal point (c=0)
with four digits to the right of the decimal point (nnn=100).
S7-200 SMART
228 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
Real to ASCII
The number (or length) of the resulting ASCII characters is the size of the output buffer and
can be assigned from 3 to 15 bytes or characters.
The real-number format supports a maximum of 7 significant digits. Attempting to display
more than 7 significant digits produces a rounding error.
The following figure describes the format operand (FMT) for the RTA instruction. The size of
the output buffer is assigned by the ssss field. A size of 0, 1, or 2 bytes is not valid. The
number of digits to the right of the decimal point in the output buffer is assigned by the nnn
field. The valid range of the nnn field is 0 to 5. If you assign 0 digits to the right of the decimal
point, then the value is converted without a decimal point. The output buffer is filled with
ASCII spaces for values of nnn greater than 5 or when the assigned output buffer is too
small to store the converted value. The c bit specifies the use of either a comma (c=1) or a
decimal point (c=0) as the separator between whole number and fraction.
The following figure also shows examples of values that are formatted using a decimal point
(c=0) with one digit to the right of the decimal point (nnn=001) and a buffer size of six bytes
(ssss=0110).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 229
Program instructions
7.5 Convert
LAD STL
Network 1
LD I3.2
ATH VB30, VB40, 3
LAD STL
Convert the integer value at VW2 to Network 1
8 ASCII characters starting at VB10, LD I2.3
using a format of 16#0B (a comma ITA VW2, VB10, 16#0B
for the decimal point, followed by 3
digits).
S7-200 SMART
230 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
LAD STL
Convert the real value at VD2 to 10 Network 1
ASCII characters starting at VB10, LD I2.3
using a format of 16#A3 (a period for RTA VD2, VB10, 16#A3
the decimal point, followed by 3 dig-
its).
See also
Assigning a constant value for instructions (Page 73)
If a constant string parameter is entered directly in the program editor (126 characters
maximum) or a variable string is initialized in the data block editor (254 characters
maximum), the string assignment must begin and end with double quote characters.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 231
Program instructions
7.5 Convert
● Real numbers: Values to the right of the decimal point are rounded to fit in the specified
number of digits to the right of the decimal point.
● Real numbers: The size of the output string must be a minimum of three bytes more than
the number of digits to the right of the decimal point.
The length of the output string is always 8 characters. The number of digits to the right of the
decimal point in the output buffer is assigned by the nnn field. The valid range of the nnn
field is 0 to 5. If you assign 0 digits to the right of the decimal point, then the value is
converted without a decimal point. For values of nnn greater than 5, the output is a string of
8 ASCII space characters. The c bit specifies the use of either a comma (c=1) or a decimal
point (c=0) as the separator between whole number and fraction. The most significant 4 bits
of the format must be zero.
The following figure also shows examples of values that are formatted using a decimal point
(c= 0) with three digits to the right of the decimal point (nnn = 011). The value at OUT is the
length of the string stored in the next byte addresses.
S7-200 SMART
232 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
The length of the output string is always 12 characters. The number of digits to the right of
the decimal point in the output buffer is specified by the nnn field. The valid range of the nnn
field is 0 to 5. If you assign 0 digits to the right of the decimal point causes, then the value is
displayed without a decimal point. For values of nnn greater than 5, the output is a string of
12 ASCII space characters. The c bit specifies the use of either a comma (c=1) or a decimal
point (c=0) as the separator between the whole number and the fraction. The upper 4 bits of
the format must be zero.
The following figure also shows examples of values that are formatted using a decimal point
(c= 0) with four digits to the right of the decimal point (nnn = 100). The value at OUT is the
length of the string stored in the next byte addresses.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 233
Program instructions
7.5 Convert
The real-number format used by the CPU supports a maximum of 7 significant digits. An
attempt to display more than the 7 significant digits produces a rounding error.
The length of the output string is specified by the ssss field. A size of 0, 1, or 2 bytes is not
valid. The number of digits to the right of the decimal point in the output buffer is assigned by
the nnn field. The valid range of the nnn field is 0 to 5. If you assign 0 digits to the right of the
decimal point, then the value is displayed without a decimal point. The output string is filled
with ASCII space characters when nnn is greater than 5 or when the assigned length of the
output string is too small to store the converted value. The c bit specifies the use of either a
comma (c=1) or a decimal point (c=0) as the separator between the whole number and the
fraction.
The following figure also shows examples of values that are formatted using a decimal point
(c= 0) with one digit to the right of the decimal point (nnn = 001) and an output string length
of 6 characters (ssss = 0110). The value at OUT is the length of the string stored in the next
byte addresses.
S7-200 SMART
234 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
See Also
Assigning a constant value for instructions (Page 73)
STD IN, INDX, OUT ASCII sub-string to double integer value conversion
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 235
Program instructions
7.5 Convert
String input format for S_I (integer number) and S_DI (double integer number)
[spaces] [+ or -] [digits 0 - 9]
INDX parameter
The INDX value is normally set to 1, which starts the conversion with the first character of
the string. The INDX value can be set to other values to start the conversion at different
points within the string. This can be used when the input string contains text that is not part
of the number to be converted. For example, if the input string is "Temperature: 77.8", you
set INDX to a value of 13 to skip over the word "Temperature: " at the start of the string.
The Substring to Real instruction does not convert strings using scientific notation or
exponential forms of real numbers. The instruction does not produce an overflow error
(SM1.1) but converts the string to a real number up to the exponential and then terminates
the conversion. For example, the string '1.234E6' converts without errors to a real value of
1.234.
The conversion is terminated when the end of the string is reached or when the first invalid
character is found. An invalid character is any character that is not a digit (0 - 9), or one of
the following characters: plus (+), minus (-), comma (,), or period (.).
The overflow error (SM1.1) is set whenever the conversion produces an integer value that is
too large for the output value. For example, the Substring to Integer instruction sets the
overflow error if the input string produces a value greater than 32767 or less than -32768.
The overflow error (SM1.1) is also set if no conversion is possible when the input string does
not contain a valid value. For example, if the input string contains 'A123', the conversion
instruction sets SM1.1 (overflow) and the output value remains unchanged.
S7-200 SMART
236 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.5 Convert
LAD STL
S_I converts the numeric string to an inte- Network 1
ger value. LD I0.0
STI VB0, 7, VW100
STD VB0, 7, VD200
S_DI converts the numeric string to a STR VB0, 7, VD300
double integer value.
See also
Assigning a constant value for instructions (Page 73)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 237
Program instructions
7.5 Convert
DECO IN, OUT Decode sets the bit in the output word OUT that corresponds to the bit number
represented by the least significant "nibble" (4 bits) of the input byte IN. All other
bits of the output word are set to 0.
LAD STL
If AC2 contains error bits: Network 1
1. The DECO instruction LD I3.1
sets the bit in VW40 that DECO AC2, VW40
corresponds to this error ENCO AC3, VB50
code
2. The ENCO instruction
converts the least signif-
icant bit set to an error
code that is stored in
VB50.
S7-200 SMART
238 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
7.6 Counters
STL: R reset input is the top of stack value. CU count up input is loaded in the
second stack level
CTD Cxxx, PV LAD/FBD: The CTD count down instruction counts down from the current
value of that counter each time the CD count down input makes the transition
from OFF to ON. When the current value Cxxx is equal to 0, the counter bit
Cxxx turns ON. The counter resets the counter bit Cxxx and loads the current
value with the preset value PV when the LD load input is set ON. The counter
stops upon reaching zero, and the counter bit Cxxx is set ON.
STL: LD load input is the top of stack value. CD count down input value is
loaded in the second stack level
CTUD Cxxx, PV LAD/FBD: The CTUD count up/down instruction counts up each time the CU
count up input makes the transition from OFF to ON, and counts down each
time the CD count down input makes the transition from OFF to ON. The
current value Cxxx of the counter maintains the current count. The PV preset
value is compared to the current value each time the counter instruction is
executed.
Upon reaching maximum value 32,767, the next rising edge at the count up
input causes the current count to wrap around to the minimum value -32,768.
On reaching the minimum value -32,768, the next rising edge at the count
down input causes the current count to wrap around to the maximum value
32,767.
When the current value Cxxx is greater than or equal to the PV preset value,
the counter bit Cxxx is set ON. Otherwise, the counter bit is OFF. The counter
is reset when the R reset input is set ON, or when the Reset instruction is
executed for the Cxxx address.
STL: R reset input is the top of stack value. CD count down input value is
loaded in the second stack level. CU count Up input value is loaded in the
third stack level
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 239
Program instructions
7.6 Counters
Note
Since there is one current value for each counter, do not assign the same counter number to
more than one counter. (Up Counters, Up/Down Counters, and Down counters with the
same number access the same current value.)
When you reset a counter using the Reset instruction, the counter bit is reset and the
counter current value is set to zero. Use the counter number to reference both the current
value and the counter bit of that counter.
See also Configuring the retentive ranges - system block configuration (Page 134)
Counter operation
1 You can select the current value for the counter to be retentive, but not the counter bit value.
S7-200 SMART
240 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
LAD STL
Count down counter C1 current value Network 1
counts from 3 to 0 LD I0.0
With I0.1 OFF, I0.0 OFF-ON decre- LD I0.1
ments C1 current value CTD C1, +3
I0.1 ON loads countdown preset value
3
Timing diagram
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 241
Program instructions
7.6 Counters
LAD STL
I0.0 counts up Network 1
I0.1 counts down LD I0.0
LD I0.1
I0.2 resets current value to 0
LD I0.2
CTUD C48, +4
Timing diagram
S7-200 SMART
242 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 243
Program instructions
7.6 Counters
HSC operation
A high-speed counter can be used as the drive for a drum timer, where a shaft rotating at a
constant speed is fitted with an incremental shaft encoder. The shaft encoder provides a
specified number of counts per revolution and a reset pulse that occurs once per revolution.
The clock(s) and the reset pulse from the shaft encoder provide the inputs to the high-speed
counter.
The high-speed counter is loaded with the first of several presets, and the desired outputs
are activated for the time period where the current count is less than the current preset. The
counter is set up to provide an interrupt when the current count is equal to preset and also
when reset occurs.
As each current-count-value-equals-preset-value interrupt event occurs, a new preset is
loaded and the next state for the outputs is set. When the reset interrupt event occurs, the
first preset and the first output states are set, and the cycle is repeated.
Since the program interrupts occur at a much lower rate than the counting rates of the high-
speed counters, precise control of high-speed operations can be implemented with relatively
minor impact to the overall PLC scan cycle time. The method of interrupt attachment allows
each load of a new preset to be performed in a separate interrupt routine for easy state
control. (Alternatively, all interrupt events can be processed in a single interrupt routine.)
Note
You must ensure that high-speed counter inputs are correctly filtered and wired, for counting
high frequency signals.
In an S7-200 SMART CPU, all high-speed counter inputs are connected to internal input
filter circuits. The S7-200 SMART default input filter setting is 6.4 ms, which limits the
maximum counting rate to 78 Hz. You must change the filter settings to count higher
frequencies.
Refer to "Noise reduction for high-speed inputs (Page 247)" for details about system block
filter options, maximum counting frequencies, shielding requirements, and external pull-down
circuits.
S7-200 SMART
244 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
● HSC0, HSC2, HSC4, and HSC5 support eight counter modes (mode 0, 1, 3, 4, 6, 7, 9,
and 10).
● HSC1 and HSC3 support only one counter mode (mode 0).
Available HSC counter types
● Single-phase clock counter with internal direction control:
– Mode 0:
– Mode 1: with external reset
● Single-phase clock counter with external direction control:
– Mode 3:
– Mode 4: with external reset
● Two-phase clock counter with 2 clock inputs (clock-up and clock-down):
– Mode 6:
– Mode 7: with external reset
● AB quadrature phase counter:
– Mode 9:
– Mode 10: with external reset
HSC operating rules
● Before you use a high-speed counter, you must execute the HDEF instruction (High-
Speed Counter Definition) to select a counter mode. Use the first scan memory bit,
SM0.1 (this bit is ON for the first scan and OFF for subsequent scans) to execute HDEF
directly, or call a subroutine that contains the HDEF instruction.
● You can use all counter types with or without a reset input.
● When you activate the reset input, it clears the current value and holds it clear until you
deactivate the reset input.
Reference information
Refer to the following sections for further information:
● High-speed counter programming (Page 249)
● High-speed counter summary (Page 246)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 245
Program instructions
7.6 Counters
Clock A Direction Reset Single phase / Dual phase maximum AB quadrature phase maximum
/ Clock B clock / input rate clock / input rate
HSC0 I0.0 I0.1 I0.4 S model CPUs:1 S model CPUs:
• 200 kHz • 100 kHz = Maximum 1x count rate
• 400 kHz = Maximum 4x count rate
C model CPUs:2 C model CPUs:
• 100 kHz • 50 kHz = Maximum 1x count rate
• 200 kHz = Maximum 4x count rate
HSC1 I0.1 S model CPUs:
• 200 kHz
C model CPUs:
• 100 kHz
HSC2 I0.2 I0.3 I0.5 S model CPUs: S model CPUs:
• 200 kHz • 100 kHz = Maximum 1x count rate
• 400 kHz = Maximum 4x count rate
C model CPUs: C model CPUs:
• 100 kHz • 50 kHz = Maximum 1x count rate
• 200 kHz = Maximum 4x count rate
HSC3 I0.3 S model CPUs:
• 200 kHz
C model CPUs:
• 100 kHz
HSC4 I0.6 I0.7 I1.2 SR30 and ST30 model CPUs: SR30 and ST30 model CPUs:
• 200 kHz • 100 kHz = Maximum 1x count rate
• 400 kHz = Maximum 4x count rate
SR20, ST20, SR40, ST40, SR60, SR20, ST20, SR40, ST40, SR60, and
and ST60 model CPUs: ST60 model CPUs:
• 30 kHz • 20 kHz = Maximum 1x count rate
• 80 kHz = Maximum 4x count rate
C model CPUs: C model CPUs:
• n/a • n/a
S7-200 SMART
246 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
Clock A Direction Reset Single phase / Dual phase maximum AB quadrature phase maximum
/ Clock B clock / input rate clock / input rate
HSC5 I1.0 I1.1 I1.3 S model CPUs: S model CPUs
• 30 kHz • 20 kHz = Maximum 1x count rate
• 80 kHz = Maximum 4x count rate
1 S model CPUs: SR20, ST20, SR30, ST30, SR40, ST40, SR60, and ST60
2 C model CPUs: CR20s, CR30s, CR40s, and CR60s
Note
High-speed input wiring must use shielded cables
Use shielded cable with a maximum length of 50 m, when connecting HSC input channels
I0.0, I0.1, I0.2, I0.3, I0.6. I0.7, I1.0, and I1.1.
One or both of the following actions may be necessary to correctly operate a high-speed
counter.
● Adjust the System Block digital input filter time of the input channels used by the HSC
channel. The S7-200 SMART CPU applies input filtering before the counting of pulses by
the HSC channel. This means that if an HSC input pulse occurs at a rate that is filtered
out by the input filtering, then the HSC does not detect any pulses on the input. You must
make sure that you configure the filter time of each input of the HSC to a value that
allows counting at the rate your application requires. This includes direction and reset
inputs. The following table shows the maximum input frequency that an HSC can detect
for each input filter configuration:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 247
Program instructions
7.6 Counters
● If the device generating the HSC input signals does not drive the input signals both high
and low, then signal distortion can occur at high speeds. This can occur if the output of
the device is an open-collector transistor. When the transistor turns off, there is nothing
driving the signal to a low state. The signal transitions to a low state, but the time to do so
is dependent on the input resistance and capacitance of the circuitry. This condition can
result in missed pulses. You can prevent this condition by wiring a pull-down resistor to
the input signals, as seen in the following figure. Since the input voltage of the CPU is 24
V DC, the resistor has to be rated for a high wattage. A 100 ohm, 5 Watt resistor is a
suitable choice.
Figure 7-1 Pull-down resistor wiring for open-collector HSC input drivers
S7-200 SMART
248 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
Note
You must ensure that high-speed counter inputs are correctly filtered and wired for counting
high frequency signals.
In an S7-200 SMART CPU, all high-speed counter inputs are connected to internal input
filter circuits. The S7-200 SMART CPU default input filter setting is 6.4 ms, which limits the
maximum counting rate to 78 Hz. You must change the filter settings to count higher
frequencies.
Refer to "Noise reduction for high-speed inputs (Page 247)" for details about system block
filter options, maximum counting frequency, shielding requirements, and external pull-down
circuits.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 249
Program instructions
7.6 Counters
The HDEF instruction assigns HSC counter mode. The following table shows the physical
inputs assigned for clock, direction control, and reset functions. The same input cannot be
used for two different functions, but you can use any input not being used by the present
mode of its high-speed counter for another purpose. For example, if the present mode of
HSC0 is mode 1, which uses I0.0 and I0.4; then you can use I0.1, I0.2, and I0.3 for edge
interrupts, HSC3, or motion control inputs.
Note
All counting modes of HSC0 always use I0.0 and all counting modes of HSC2 always use
I0.2, so you cannot use these inputs for other purposes when these counters are in use.
S7-200 SMART
250 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 251
Program instructions
7.6 Counters
S7-200 SMART
252 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 253
Program instructions
7.6 Counters
Reset operation
The operation of reset shown in the following figure applies to all modes that use the reset
input. In the figure below, the reset operation is shown with the active state assigned as the
high level.
HSC reset
S7-200 SMART
254 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
HDEF instruction sets the reset active level and counting rate
HSC0, HSC2, HSC4, and HSC5 counters have two control bits that are used to configure the
active state of the reset and to select 1x or 4x counting modes (AB quadrature phase
counters only). These bits are located in the HSC control byte for the respective counter and
are only used when the HDEF instruction is executed. These bits are defined in the following
table.
Note
You must set these two control bits to the desired state before the HDEF instruction is
executed. Otherwise, the counter takes on the default configuration for the counter mode
selected.
Once the HDEF instruction has been executed, you cannot change the counter setup unless
you first place the CPU in STOP mode.
HSC0 HSC1 HSC2 HSC3 HSC4 HSC5 Description (used only when
HDEF is executed)
SM37.0 Not SM57.0 Not SM147.0 SM157.0 Active level control bit for Reset:*
support- support-
• 0 = Reset is active high
ed ed
• 1 = Reset is active low
SM37.2 Not SM57.2 Not SM147.2 SM157.2 Counting rate selection for AB
support- support- quadrature phase counters:*
ed ed
• 0 = 4X counting rate
• 1 = 1X counting rate
* The default setting of the reset input is active high, and the AB quadrature phase counting rate is 4x
(or four times the input clock frequency).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 255
Program instructions
7.6 Counters
LAD STL
MAIN On the first scan: Network 1
1. Select the reset input to be active LD SM0.1
high and select 4x mode. MOVB 16#F8, SMB37
HDEF 0, 10
2. Configure HSC0 for AB quadrature
phase with reset input (mode 10).
HSC instruction enables counters, sets counting direction, and loads preset/current count values
The HSC instruction uses the control byte during execution. After you assign the counter and
the counter mode, you can program the dynamic parameters of the counter. Each high-
speed counter has a control byte in SM memory that allows the following actions:
● Enabling or disabling the counter
● Controlling the direction (modes 0 and 1 only), or the initial counting direction for all other
modes
● Loading the current value
● Loading the preset value
S7-200 SMART
256 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
LAD STL
MAIN Save the value of HSC0 into Network 1
VD200 when I3.0 transitions LD I3.0
from OFF to ON. EU
MOVD HC0, VD200
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 257
Program instructions
7.6 Counters
Use the following steps to write a new current value and/or new preset value to the high-
speed counter (steps 1 and 2 can be done in either order):
1. Load the value to be written into the appropriate SM new current value and/or new preset
value (see the table below). Loading these new values does not affect the high-speed
counter yet.
2. Set or clear the appropriate bits in the appropriate control byte to indicate whether to
update the current and/or preset values (bit x.5 for preset and x.6 for current).
Manipulating these bits does not affect the high-speed counter yet.
3. Execute the HSC instruction referencing the appropriate high-speed counter number.
Executing this instruction causes the control byte to be examined. If the control byte
specifies an update for the current, the preset, or both, then the appropriate values are
copied from the SM new current value and/or new preset value locations into the high-
speed counter internal registers.
Note
Changes to the control byte and the SM locations for new current value and new preset
value does not affect the high-speed counter until the corresponding HSC instruction is
executed.
S7-200 SMART
258 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
LAD STL
MAIN program network Update the current count to 1000 Network 1
and the preset value to 2000 for LD I2.0
HSC0 when I2.0 transitions from EU
OFF to ON. MOVD 1000,
SMD38
MOVD 2000,
SMD42
= SM37.5
= SM37.6
HSC 0
Note
Status bits are valid only while the high-speed counter interrupt routine executes. The
purpose of monitoring the state of the high-speed counter is to enable interrupts for the
events that are of consequence to the operation being performed.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 259
Program instructions
7.6 Counters
Table 7- 14 Status bits for HSC0, HSC1, HSC2, HSC3, HSC4, and HSC5
Reference information
Refer to the following sections for further information:
● High-speed counter instructions (Page 243)
● High-speed counter summary (Page 246)
● Example initialization sequences for high-speed counters (Page 260)
Note
Although the following sequences show how to change direction, current value, and preset
value individually, you can change all or any combination of them in the same sequence by
setting the value of SMB37 appropriately and then executing the HSC0 instruction.
S7-200 SMART
260 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 261
Program instructions
7.6 Counters
S7-200 SMART
262 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 263
Program instructions
7.6 Counters
S7-200 SMART
264 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 265
Program instructions
7.6 Counters
S7-200 SMART
266 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.6 Counters
LAD STL
MAIN On the first scan, call SBR_0. Network 1
LD SM0.1
CALL SBR_0
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 267
Program instructions
7.7 Pulse output
LAD STL
INT0 Program HSC0: Network 1
1. Clear the current value of HSC0. LD SM0.0
MOVD +0, SMD38
2. Select to write only a new current
MOVB 16#C0, SMB37
and leave HSC0 enabled.
HSC 0
3. Configure HSC0.
Reference information
Refer to the following sections for further information:
● High-speed counter instructions (Page 243)
● High-speed counter summary (Page 246)
● High-speed counter programming (Page 249)
● Interrupt instructions (Page 302)
S7-200 SMART
268 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.7 Pulse output
The CPU has three PTO/PWM generators (PLS0, PLS1, and PLS2) that create either a
high-speed pulse train or a pulse width modulated waveform. PLS0 is assigned to digital
output point Q0.0, PLS1 is assigned to digital output point Q0.1, and PLS2 is assigned to
digital output point Q0.3. A designated special memory (SM) location stores the following
data for each generator: a PTO status byte (8-bit value), a control byte (8-bit value), a cycle
time or frequency (unsigned 16-bit value), a pulse width value (unsigned 16-bit value), and a
pulse count value (unsigned 32-bit value).
The PTO/PWM generators and the process image register share the use of Q0.0, Q0.1, and
Q0.3. When a PTO or PWM function is active on Q0.0, Q0.1, or Q0.3, the PTO/PWM
generator has control of the output, and normal use of the output point is inhibited. The
output waveform is not affected by the state of the process image register, the forced value
of the point, or the execution of immediate output instructions. When the PTO/PWM
generator is inactive, control of the output reverts to the process image register. The process
image register determines the initial and final state of the output waveform, causing the
waveform to start and end at a high or low level.
Note
PTO/PWM through the PLS instruction is not possible if the selected output point is already
configured for use with motion control through use of the Motion wizard.
The PTO/PWM outputs must have a minimum load of at least 10% of rated load to provide
crisp transitions from off to on, and from on to off.
Before enabling PTO/PWM operation, set the value of the process image register for Q0.0,
Q0.1, and Q0.3 to 0.
Default values for all control bits, cycle time/frequency, pulse width, and pulse count values
are 0.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 269
Program instructions
7.7 Pulse output
Note
The Pulse Output (PLS) instruction can only be used with the following S7-200 SMART
CPUs:
• SR20 / ST20 (Two channels, Q0.0 and Q0.1)
• SR30 / ST30, SR40 / ST40, and SR60 / ST60 (Three channels, Q0.0, Q0.1, and Q0.3)
F Frequency (Hz)
CT Cycle time (seconds)
See the following table for pulse count and frequency limitations:
Note
When using a PTO with very short cycle times (high frequencies), you should take into
account the switching delay specifications for the output points and how the switching delay
can affect the duty cycle. See Appendix A for the digital output switching delay for your CPU.
S7-200 SMART
270 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.7 Pulse output
The PTO function allows the "chaining" or "pipelining" of pulse trains. When the active pulse
train is complete, the output of a new pulse train begins immediately. This allows continuity
between subsequent output pulse trains.
Note
In single-segment pipelining, the frequency has an upper limit of 65,535 Hz. If a higher
frequency is needed (up to 100,000 Hz), multiple-segment pipelining must be used.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 271
Program instructions
7.7 Pulse output
While the PTO profile is operating, the number of the currently active segment is available in
SMB166, SMB176, or SMB576.
As shown in the following table, setting the pulse width equal to the cycle time (which makes
the duty cycle 100 percent) turns the output on continuously. Setting the pulse width to 0
(which makes the duty cycle 0 percent) turns the output off.
Note
When using a PWM with very short cycle times, you should take into account the switching
delay specifications for the output points and how the switching delay can affect the pulse
width time. See Appendix A for the digital output switching delay for your CPU.
S7-200 SMART
272 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.7 Pulse output
Pulse width time and cycle time and reactions in the PWM function
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 273
Program instructions
7.7 Pulse output
The following conditions set the bits of the status byte (SMB66, SMB76, and SMB566):
● If an "Add Error" occurs in the pulse generator that results in an invalid frequency value,
the PTO function terminates and the Delta Calculation Error bit (SM66.4, SM76.4, or
SM566.4) is set to 1. The output reverts to image register control. To correct this issue,
try adjusting the PTO profile parameters.
● Manually disabling a PTO profile in progress sets the PTO Profile Disabled bit (SM66.5,
SM76.5, or SM566.5) to 1.
● The PTO/PWM overflow/underflow bit (SM66.6, SM76.6, or SM566.6) is set to 1 if either
of these situations occur:
– An attempt is made to load the pipeline while it is full; this is an overflow condition.
– A PTO profile segment is too short to allow the CPU to calculate the next segment,
and an empty pipeline is transferred; this is an underflow condition, and the output
reverts to image register control.
● You must clear the PTO/PWM overflow/underflow bit manually after it is set to detect
subsequent overflows. The transition to RUN mode initializes this bit to 0.
Note
• Ensure that you understand the definition of the PTO/PWM mode select bit (SM67.6,
SM77.6, and SM567.6). The bit definition may not be the same as some legacy products
that support a Pulse instruction. In the S7-200 SMART, the user selects PTO or PWM
mode with the following definition: 0 = PWM, 1 = PTO.
• When you load a cycle time/frequency (SMW68, SMW78, or SMW568), pulse width
(SMW70, SMW80, or SMW570), or pulse count (SMD72, SMD82, or SMD572), also set
the appropriate update bits in the control register before you execute the PLS instruction.
• For a multiple segment pulse train operation, you must also load the starting offset
(SMW168, SMW178, or SMW578) of the profile table and the profile table values before
you execute the PLS instruction.
• If you attempt to change the time base of a PWM output while the PWM is executing, the
request is ignored and a non-fatal error (0x001B - ILLEGAL PWM TIMEBASE CHG) is
created.
S7-200 SMART
274 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.7 Pulse output
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 275
Program instructions
7.7 Pulse output
S7-200 SMART
276 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.7 Pulse output
To achieve the desired number of motor revolutions for this example, the PTO generator
requires the following values:
● Starting and final pulse frequencies of 2 kHz
● A maximum pulse frequency of 10 kHz
● 4000 pulses
During the acceleration portion of the output profile, the output wave form should reach
maximum pulse frequency in approximately 200 pulses. The output wave form should
complete the deceleration portion of the profile in approximately 400 pulses.
The following table lists the values for generating the example waveform. The profile table,
for this example, is in V memory and starts at VB500. You can use any block of V memory
that is available for a PTO profile table. You can include instructions in your program to load
these values into V memory, or you can define the values of the profile in the data block.
The PTO generator begins by running Segment 1. After the PTO generator reaches the
required number of pulses for Segment 1, it automatically loads Segment 2. This continues
until the last segment. After the number of pulses for the last segment is reached, the
S7-200 SMART CPU disables the PTO generator.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 277
Program instructions
7.7 Pulse output
For each segment of the PTO profile, the pulse train begins at the starting frequency
assigned in the table. The PTO generator increases or decreases the frequency at a
constant rate to achieve the ending frequency with the correct number of pulses. However,
the PTO generator limits the frequency to the starting and ending frequencies specified in
the table.
The PTO generator performs repeated additions to the working frequency to create a linear
change in frequency over time. The constant value added to the frequency has a limited
resolution. This limited resolution can introduce some truncation error into the resulting
frequency. Thus, the PTO generator does not guarantee that the pulse train frequency can
reach the ending frequency that was specified for that segment. In the figure below, you can
see that the truncation error affects the accelerating PTO frequency. The output should be
measured to verify that the frequency is within an acceptable frequency range.
If the frequency difference (Δf) between the end of a segment and the beginning of the next
is not acceptable, try adjusting the ending frequency to compensate for the difference. This
adjustment might be an iterative process to get the output within an acceptable frequency
range.
Note that changes in segment parameters affect the time it takes the PTO to complete. You
can use the equation for the time duration of the segment, found later in this section of the
manual, to see what effect this has on the timing. An accurate segment duration time can
require some flexibility in the value of the ending frequency or the number of pulses for a
given segment.
While the simplified example above is useful as an introduction, real applications can require
more complicated waveform profiles. Remember that you can only assign frequencies as an
integer number of Hz and perform the frequency modification at a constant rate. The
S7-200 SMART CPU selects that constant rate and that rate can be different for each
segment.
For legacy projects that were developed in terms of cycle time, instead of frequency, you can
use the following formulas to convert to frequency:
CTFinal = CTInitial + (ΔCT * PC)
FInitial = 1 / CTInitial
FFinal = 1 / CTFinal
where:
S7-200 SMART
278 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.8 Math
The acceleration (or deceleration) and time duration of a given PTO profile segment can be
useful in the process of determining correct profile table values. Use the following formulas
to calculate the length of time, as well as the acceleration for a given profile:
ΔF = FFinal - FInitial
Ts = PC / (Fmin + ( | ΔF | / 2 ) )
As = ΔF / Ts
where:
7.8 Math
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 279
Program instructions
7.8 Math
SM1.1 indicates overflow errors and illegal values. If SM1.1 is set, then the status of SM1.0
and SM1.2 is not valid and the original input operands are not altered. If SM1.1 and SM1.3
are not set, then the math operation has completed with a valid result and SM1.0 and SM1.2
contain valid status. If SM1.3 is set during a divide operation, then the other math status bits
are left unchanged.
S7-200 SMART
280 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.8 Math
LAD STL
Network
LD I0.0
+I AC1, AC0
*I AC1, VW100
/I VW10, VW200
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 281
Program instructions
7.8 Math
LAD STL
Network 1
LD I0.0
+R AC1, AC0
*R AC1, VD100
/R VD10, VD200
S7-200 SMART
282 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.8 Math
7.8.2 Multiply integer to double integer and divide integer with remainder
1 For both of these instructions, SM bits indicate errors and illegal values. If SM1.3 (divide by zero) is set during a divide
operation, then the other math status bits are left unchanged. Otherwise, all supported math status bits contain valid
status upon completion of the math operation.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 283
Program instructions
7.8 Math
LAD STL
Network 1
LD I0.0
MUL AC1, VD100
DIV VW10, VD200
1 VD100 contains: VW100 and VW102, and VD200 contains: VW200 and VW202.
remainder quotient
DIV data 4000 / 41 = 23 97
Data address VW202 VW10 VW200 VW202
VD200
S7-200 SMART
284 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.8 Math
To convert an angle from degrees to radians: Use the MUL_R (*R) instruction to
multiply the angle in degrees by 1.745329E-2 (approximately by π/180).
TAN IN, OUT
For the numeric functions instructions, SM1.1 is used to indicate overflow errors
and illegal values. If SM1.1 is set, then the status of SM1.0 and SM1.2 is not
valid and the original input operands are not altered. If SM1.1 is not set, then the
math operation has completed with a valid result and SM1.0 and SM1.2 contain
valid status.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 285
Program instructions
7.8 Math
S7-200 SMART
286 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.8 Math
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 287
Program instructions
7.9 PID
LAD STL
Network 1
LD I4.0
INCW AC0
DECD VD100
IN OUT
Increment word 125 + 1 = 126
Data address AC0 AC0
7.9 PID
S7-200 SMART
288 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
The PID loop instruction (Proportional, Integral, Derivative Loop) is provided to perform the
PID calculation. The top of the logic stack (TOS) must be ON (power flow) to enable the PID
calculation. The instruction has two operands: a TABLE address which is the starting
address of the loop table and a LOOP number which is a constant from 0 to 7.
Eight PID instructions can be used in a program. If two or more PID instructions are used
with the same loop number (even if they have different table addresses), the PID
calculations will interfere with one another and the output will be unpredictable.
The loop table stores nine parameters used for controlling and monitoring the loop operation
and includes the current and previous value of the process variable, the setpoint, output,
gain, sample time, integral time (reset), derivative time (rate), and the integral sum (bias).
To perform the PID calculation at the desired sample rate, the PID instruction must be
executed either from within a timed interrupt routine or from within the main program at a
rate controlled by a timer. The sample time must be supplied as an input to the PID
instruction via the loop table.
Auto-Tune capability has been incorporated into the PID instruction. Refer to "PID loops and
tuning" (Page 624) for a detailed description of auto-tuning. The "PID Tune control panel"
(Page 632) only works with PID loops created by the PID wizard.
STEP 7-Micro/WIN SMART offers the PID wizard to guide you in defining a PID algorithm for
a closed-loop control process. Select the "Instruction wizard" command from the "Tools"
menu and then select "PID" from the "Instruction wizard" window.
Note
The setpoint of the low range and the setpoint of the high range should correspond to the
process variable low range and high range.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 289
Program instructions
7.9 PID
Screen Description
In this dialog, you select which loops
to configure. You can configure a
maximum of eight loops.
When you select a loop on this dialog,
the tree view on the left side of the PID
wizard updates with all nodes neces-
sary for configuring that loop.
S7-200 SMART
290 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
Screen Description
Set the following loop parameters:
• Gain (Default value = 1.00)
• Sample Time (Default value =
1.00)
• Integral Time (Default value =
10.00)
• Derivative Time (Default value =
0.00)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 291
Program instructions
7.9 PID
Screen Description
You enter the loop output options:
• How the loop output is to be
scaled:
– Analog
– Digital
• Analog scaling parameter:
– Unipolar (default: 0 to 27648;
can edit)
– Bipolar (default: -27648 to
24678; can edit)
– Unipolar 20% offset (range:
5530 to 27648; is set and un-
changeable
• Analog range parameter: Assign
the loop output range. The possible
range is -27648 to +27648, de-
pending on your scaling selection.
S7-200 SMART
292 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
Screen Description
You can make the following code
selections:
• Subroutine: The PID wizard cre-
ates a subroutine for initializing the
selected PID configuration.
• Interrupt: The PID wizard creates
an interrupt routine for the PID loop
execution.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 293
Program instructions
7.9 PID
Screen Description
You can assign the starting address of
the V memory byte where the configu-
ration is placed in the data block. The
wizard can suggest an address that
represents an unused block of
V memory of the correct size.
STEP 7-Micro/WIN SMART includes a PID tune control panel (Page 632) that allows you to
graphically monitor the behavior of your PID loops. In addition, the control panel allows you
to initiate the auto-tune sequence, abort the sequence, and apply the suggested tuning
values or your own tuning values.
S7-200 SMART
294 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 295
Program instructions
7.9 PID
where:
MPn Value of the proportional term of the loop output at sample time n
KC Loop gain
SPn Value of the setpoint at sample time n
PVn Value of the process variable at sample time n
Integral term of the PID equation: The integral term MI is proportional to the sum of the error
(e) over time. The equation for the integral term as solved by the CPU is:
MIn = K1 en + MX = KC * (TS / TI) * (SPn - PVn) + MX
where:
MIn Value of the integral term of the loop output at sample time n
KC Loop gain
TS Loop sample time
TI Integral time (also called the integral time or reset)
S7-200 SMART
296 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
MDn Value of the differential term of the loop output at sample time n
KC Loop gain
TS Loop sample time
TD Differentiation period of the loop (also called the derivative time or rate)
SPn Value of the setpoint at sample time n
SPn-1 Value of the setpoint at sample time n - 1
PVn Value of the process variable at sample time n - 1
PVn-1 Value of the process variable at sample time n - 1
The process variable rather than the error must be saved for use in the next calculation of
the differential term. At the time of the first sample, the value of PVn - 1 is initialized to be
equal to PVn.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 297
Program instructions
7.9 PID
If you do not want integral action (no "I" in the PID calculation), then a value of infinity "INF",
should be specified for the integral time (reset). Even with no integral action, the value of the
integral term might not be zero, due to the initial value of the integral sum MX.
If you do not want derivative action (no "D" in the PID calculation), then a value of 0.0 should
be assigned for the derivative time (rate).
If you do not want proportional action (no "P" in the PID calculation) and you want I or ID
control, then a value of 0.0 should be specified for the gain. Since the loop gain is a factor in
the equations for calculating the integral and differential terms, setting a value of 0.0 for the
loop gain will result in a value of 1.0 being used for the loop gain in the calculation of the
integral and differential terms.
RNorm is the normalized, real number value representation of the real world value
RRaw is the un-normalized or raw, real number value representation of the real world
value
Offset is 0.0 for unipolar values
is 0.5 for bipolar values
Span is the maximum possible value minus the minimum possible value:
= 27,648 for unipolar values (typical)
= 55,296 for bipolar values (typical)
S7-200 SMART
298 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
The following instruction sequence shows how to normalize the bipolar value in AC0 (whose
span is 55,296) as a continuation of the previous instruction sequence:
The following instruction sequence shows how to scale the loop output:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 299
Program instructions
7.9 PID
Modes
There is no built-in mode control for PID loops. The PID calculation is performed only when
power flows to the PID box. Therefore, "automatic" or "auto" mode exists when the PID
calculation is performed cyclically. "Manual" mode exists when the PID calculation is not
performed.
The PID instruction has a power-flow history bit, similar to a counter instruction. The
instruction uses this history bit to detect a 0-to-1 power-flow transition. When the power-flow
transition is detected, it will cause the instruction to perform a series of actions to provide a
bumpless change from manual control to auto control. In order for change to auto mode
control to be bumpless, the value of the output as set by the manual control must be
supplied as an input to the PID instruction (written to the loop table entry for Mn) before
switching to auto control. The PID instruction performs the following actions to values in the
S7-200 SMART
300 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.9 PID
loop table to ensure a bumpless change from manual to auto control when a 0-to-1 power-
flow transition is detected:
● Sets setpoint (SPn) = process variable (PVn)
● Sets old process variable (PVn-1) = process variable (PVn)
● Sets bias (MX) = output value (Mn)
The default state of the PID history bits is "set" and that state is established at startup and on
every STOP-to-RUN mode transition of the controller. If power flows to the PID box the first
time that it is executed after entering RUN mode, then no power-flow transition is detected
and the bumpless mode change actions are not performed.
Error conditions
When it is time to compile, the CPU will generate a compile error (range error) and the
compilation will fail if the loop table start address or PID loop number operands specified in
the instruction are out of range.
Certain loop table input values are not range checked by the PID instruction. You must take
care to ensure that the process variable and setpoint (as well as the bias and previous
process variable if used as inputs) are real numbers between 0.0 and 1.0.
If any error is encountered while performing the mathematical operations of the PID
calculation, then SM1.1 (overflow or illegal value) is set and execution of the PID instruction
is terminated. (Update of the output values in the loop table could be incomplete, so you
should disregard these values and correct the input value causing the mathematical error
before the next execution of the loop's PID instruction.)
Loop table
The loop table is 80 bytes long and has the format shown in the following table.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 301
Program instructions
7.10 Interrupt
7.10 Interrupt
DISI The disable interrupt instruction globally disables processing of all inter-
rupt events.
CRETI The conditional return from interrupt instruction can be used to return
from an interrupt, based upon the condition of the preceding program
logic.
S7-200 SMART
302 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.10 Interrupt
DTCH EVNT The detach interrupt instruction disassociates an interrupt event EVNT from all
interrupt routines and disables the interrupt event.
CEVENT EVNT The clear interrupt event instruction removes all interrupt events of type EVNT
from the interrupt queue. Use this instruction to clear the interrupt queue of un-
wanted interrupt events. If this instruction is being used to clear out spurious
interrupt events, then you should detach the event before clearing the events
from the queue. Otherwise new events will be added to the queue after the clear
event instruction has been executed.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 303
Program instructions
7.10 Interrupt
S7-200 SMART
304 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.10 Interrupt
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 305
Program instructions
7.10 Interrupt
Interrupt processing provides quick reaction to special internal or external events. Optimize
your interrupt routines to perform a specific task, and then return control to the scan cycle.
Note
• You cannot use the disable interrupt (DISI), enable interrupt (ENI), high-speed counter
definition (HDEF), and end (END) instructions in an interrupt routine.
• Keep interrupt routine program logic short and to the point, so execution is quick and
other processes are not deferred for long periods of time. If this is not done, unexpected
conditions can cause abnormal operation of equipment controlled by the main program.
Sharing data between the main program and the interrupt routines
You can share data between the main program and one or more interrupt routines. Because
it is not possible to predict when the CPU might generate an interrupt, it is desirable to limit
the number of variables that are used by both the interrupt routine and elsewhere in the
program. Problems with the consistency of shared data can result due to the actions of
interrupt routines when the execution of instructions in your main program is interrupted by
interrupt events. Use the interrupt block "variable table" (block call interface table) to ensure
that your interrupt routine uses only the temporary memory and does not overwrite data used
somewhere else in your program.
S7-200 SMART
306 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.10 Interrupt
7.10.4 Types of interrupt events that the S7-200 SMART CPU supports
I/O interrupts
I/O interrupts include rising/falling edge interrupts, high-speed counter interrupts, and pulse
train output interrupts. The CPU can generate an interrupt on rising and/or falling edges of
an input for input channels I0.0, I0.1, I0.2, and I0.3 (and for I7.0 and I7.1 for standard CPUs
with an optional digital input signal board). The rising edge and the falling edge events can
be captured for each of these input points. These rising/falling edge events can be used to
signify a condition that must receive immediate attention when the event happens.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of signal boards.
The high-speed counter interrupts allow you to respond to conditions such as the current
value reaching the preset value, a change in counting direction that might correspond to a
reversal in the direction in which a shaft is turning, or an external reset of the counter. Each
of these high-speed counter events allows action to be taken in real time in response to high-
speed events that cannot be controlled at programmable logic controller scan speeds.
The pulse train output interrupts provide immediate notification of completion of the output of
the prescribed number of pulses. A typical use of pulse train outputs is stepper motor control.
You enable each of the above interrupts by attaching an interrupt routine to the related I/O
event.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 307
Program instructions
7.10 Interrupt
Time-based interrupts
Time-based interrupts include timed interrupts and the timer T32/T96 interrupts. You can
specify actions to be taken on a cyclic basis using a timed interrupt. The cycle time is set in
1-ms increments from 1 ms to 255 ms. You must write the cycle time in SMB34 for timed
interrupt 0, and in SMB35 for timed interrupt 1.
The timed interrupt event transfers control to the appropriate interrupt routine each time the
timer expires. Typically, you use timed interrupts to control the sampling of analog inputs or
to execute a PID loop at regular intervals.
A timed interrupt is enabled and timing begins when you attach an interrupt routine to a
timed interrupt event. During the attachment, the system captures the cycle time value, so
subsequent changes to SMB34 and SMB35 do not affect the cycle time. To change the cycle
time, you must modify the cycle time value, and then re-attach the interrupt routine to the
timed interrupt event. When the re-attachment occurs, the timed interrupt function clears any
accumulated time from the previous attachment and begins timing with the new value.
After being enabled, the timed interrupt runs continuously and executes the attached
interrupt routine, at the end of each successive time interval. If you exit RUN mode or detach
the timed interrupt, the timed interrupt is disabled. If the global DISI (disable interrupt)
instruction is executed, timed interrupts continue to occur, but the attached interrupt routine
is not processed yet. Each occurrence of the timed interrupt is queued (until either interrupts
are enabled or the queue is full).
The timer T32/T96 interrupts allow timely response to the completion of a specified time
interval. These interrupts are only supported for the 1-ms resolution on-delay (TON) and off-
delay (TOF) timers T32 and T96. The T32 and T96 timers otherwise behave normally. Once
the interrupt is enabled, the attached interrupt routine is executed when the active timer's
current value becomes equal to the preset time value during the normal 1-ms timer update
performed in the CPU. You enable these interrupts by attaching an interrupt routine to the
T32 (event 21) and T96 (event 22) interrupt events.
Interrupt service
Interrupts are serviced by the CPU on a first-come-first-served basis within their respective
priority group. Only one user-interrupt routine is ever being executed at any point in time.
Once the execution of an interrupt routine begins, the routine is executed to completion. It
cannot be pre-empted by another interrupt routine, even by a higher priority routine.
Interrupts that occur while another interrupt is being processed are queued for later
processing. The following table shows the three interrupt queues and the maximum number
of interrupts they can store.
It is possible that more interrupts can occur than a queue can hold. Therefore, queue
overflow memory bits (identifying the type of interrupt events that have been lost) are
maintained by the system. The following table shows the interrupt queue overflow bits. You
should use these bits only in an interrupt routine because they are reset when the queue is
emptied, and control is returned to the scan cycle.
If multiple interrupt events occur at the same time, the priority (group and within a group)
determines which interrupt event is processed first. Once the highest priority has been
S7-200 SMART
308 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.10 Interrupt
handled, the queue is examined to find the current highest priority event that remains in the
queue and the interrupt routine attached to that event is executed. This continues until the
queue is empty and control is returned to the scan cycle.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 309
Program instructions
7.10 Interrupt
S7-200 SMART
310 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.10 Interrupt
LAD STL
MAIN On the first scan: Network 1
Network 1 1. Define interrupt routine LD SM0.1
INT_0 to be a falling-edge ATCH INT_0, 1
interrupt for I0.0. ENI
2. Globally enable interrupts.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 311
Program instructions
7.10 Interrupt
LAD STL
MAIN On the first scan, call subrou- Network 1
Network 1 tine 0. LD SM0.1
CALL SBR_0
S7-200 SMART
312 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.10 Interrupt
LAD STL
SBR 1 HSC instruction wizard: Network 1
Network 1 Set control bits, write preset. LD SM0.0
MOVB 16#A0, SMB47
MOVD +6, SMD52
ATCH HSC1_STEP1, 13
PV = 6
Attach interrupt
HSC1_STEP1:
CV = PV for HC1
Configure HSC 1.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 313
Program instructions
7.11 Logical operations
7.11.1 Invert
LAD STL
Invert word value in AC0. Result is put in AC0. Network 1
LD I4.0
INVW AC0
S7-200 SMART
314 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.11 Logical operations
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 315
Program instructions
7.12 Move
LAD STL
Network 1
LD I4.0
ANDW AC1, AC0
ORW AC1, VW100
XORW AC1, AC0
S7-200 SMART
316 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.12 Move
7.12 Move
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 317
Program instructions
7.12 Move
S7-200 SMART
318 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.12 Move
LAD STL
Move (copy) data in source four byte Network 1
address sequence (VB20 to VB23) to LD I2.1
destination four byte address se- BMB VB20, VB100, 4
quence (VB100 to VB103).
LAD STL
Network 1
LD I2.1
SWAP VW50
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 319
Program instructions
7.12 Move
BIW IN, OUT The Move Byte Immediate Write instruction reads the data from the memory
address IN and writes to physical output OUT, and the corresponding process
image location.
S7-200 SMART
320 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
NEXT The NEXT instruction marks the end of the FOR loop program segment.
Use the FOR and NEXT instructions to execute a program segment in a loop that is
repeated for the assigned count. Each FOR instruction requires one NEXT instruction. You
place a FOR-NEXT loop within a FOR-NEXT loop to a maximum nesting depth of eight.
If you enable a FOR-NEXT loop, the execution loop continues until it finishes the iterations,
unless you change the FINAL value from within the loop itself. You can change the values
while the FOR-NEXT loop is in the looping process. When the loop is enabled again, it
copies the INIT value to the INDX value (current loop number).
For example, given an INIT value of 1 and a FINAL value of 10, the instructions between the
FOR instruction and the NEXT instruction are executed 10 times with the INDX value being
incremented: 1, 2, 3, ... 10.
If the INIT value is greater than the FINAL value, the loop is not executed. After each
execution of the instructions between the FOR instruction and the NEXT instruction, the
INDX value is incremented and the result is compared to the final value. If the INDX is
greater than the final value, the execution loop is terminated.
For STL, if the top of the logic stack value is 1 when your program enters the FOR-NEXT
loop, then the top of the logic stack will be 1 when your program exits the FOR-NEXT loop.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 321
Program instructions
7.13 Program control
LAD STL
When I2.0 is ON, the outside Network 1
loop (Network 1 - 4) is exe- LD I2.0
cuted 100 times. FOR VW100, +1,
+100
You can use the JMP (Jump) instruction in the main program, in subroutines, or in interrupt
routines. The JMP and its corresponding LBL (Label) instruction must be located within the
same program segment either in the main program, a subroutine, or an interrupt routine.
Note
You cannot jump from the main program to a label in either a subroutine or an interrupt
routine. Likewise, you cannot jump from a subroutine or interrupt routine to a label outside
that subroutine or interrupt routine.
You can use a Jump instruction within an SCR program segment, but the corresponding
Label instruction must be located within the same SCR program segment.
S7-200 SMART
322 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
LBL N The LBL (Label) instruction marks the location of the jump destination n.
LAD STL
If the retentive data has not been Network 1
lost, jump to label 4. LDN SM0.2
JMP 4
Label 4 Network 2
LBL 4
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 323
Program instructions
7.13 Program control
WARNING
S bit usage in POUs
Do not use the same S bit in more than one POU. For example, if you use S0.1 in the main
program, do not use it in a subroutine.
Multiple POUs accessing the same S bit could result in unexpected process operation,
possibly resulting in death or severe personal injury.
Check your program to ensure that multiple POUs do not access the same S bit.
Note
SCR programming restrictions
• You cannot jump into or out of an SCR segment; however, you can use Jump and Label
instructions to jump around SCR segments or to jump within an SCR segment.
• You cannot use the END instruction in an SCR segment.
S7-200 SMART
324 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
CSCRE
The SCRT instruction identifies the SCR bit to be enabled (the next
S_bit to be set). When power flows to the coil or FBD box, the CPU
turns on the referenced S_bit and turns off the S_bit of the LSCR
SCRE
instruction (that enabled this SCR segment).
The CSCRE (conditional SCR end) instruction, for STL and FBD,
terminates execution of the SCR segment when enabled. For LAD,
a conditional contact placed before a SCRE coil performs the condi-
tional SCR end function.
The SCRE (unconditional SCR end) instruction, for STL and FBD,
terminates execution of the SCR segment. For LAD, an SCRE coil
connected directly to the power rail performs the unconditional SCR
end function.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 325
Program instructions
7.13 Program control
S7-200 SMART
326 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
LAD STL
On the first scan enable state 1. Network 1
LD SM0.1
S S0.1, 1
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 327
Program instructions
7.13 Program control
LAD STL
End of SCR region for state 2. Network 9
SCRE
The divergence of control streams can be implemented in an SCR program by using multiple
SCRT instructions enabled by the same transition condition, as shown in the following
example.
S7-200 SMART
328 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
LAD STL
Beginning of state L control region Network 1
LSCR S3.4
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 329
Program instructions
7.13 Program control
LAD STL
Beginning of state L control region Network 1
LSCR S3.4
When both State L' and State M' are activated: Network 7
LD S3.5
• Enable State N (S5.0)
A S6.5
• Reset State L' (S3.5) S S5.0, 1
• Reset State M' (S6.5) R S3.5, 1
R S6.5, 1
S7-200 SMART
330 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
LAD STL
Beginning of state L control region Network 1
LSCR S3.4
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 331
Program instructions
7.13 Program control
LAD STL
When an I/O error is detected, force Network 1
the transition to STOP mode. LD SM5.0
STOP
S7-200 SMART
332 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.13 Program control
Note
If you expect your scan time to exceed 500 ms, or if you expect a burst of interrupt activity
that prevents returning to the main scan for more than 500 ms, you should use the watchdog
reset instruction to retrigger the watchdog timer.
Use the watchdog reset instruction carefully. If program execution loops prevent scan
completion or excessively delay the completion of the scan, then the following processes are
inhibited until the scan cycle is completed.
• Communications (except Freeport mode)
• I/O updating (except Immediate I/O)
• Forced values updating
• SM bit updating (SM0, SM5 to SM29 are not updated)
• RUN-time diagnostics
• STOP instruction, when used in an interrupt routine
Non-fatal run-time errors also affect certain special memory error flag addresses that can be
evaluated along with the GET_ERROR instruction to determine the cause of a run-time fault.
In the event that the generic error flag SM4.3 = 1 (Run-time programming problem) is active,
a GET_ERROR execution can be used to identify the specific error.
Non-fatal error code 0000H indicates that no actual error currently exists. In the case of a
temporary run-time non-fatal error, a GET_ERROR (ECODE output) produces a non-zero
error value and then the next program scan can produce a zero ECODE value.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 333
Program instructions
7.14 Shift and rotate
You should use compare logic to save the ECODE value in another memory location. Your
program can then test the saved error code value and begin a programmatic reaction.
Note
The error codes for the ECODE output are listed in the PLC non-fatal error codes table (see
reference below). The error code values are in hexadecimal (16#xxxx).
See Also
PLC non-fatal error codes (Page 823)
PLC non-fatal error SM flags (Page 825)
Shift instructions (only the byte size LAD box is illustrated, the others are similar)
S7-200 SMART
334 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.14 Shift and rotate
Rotate instructions (only the byte size LAD box is illustrated, the others are similar)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 335
Program instructions
7.14 Shift and rotate
LAD STL
Network 1
LD I4.0
RRW AC0, 2
SLW VW200, 3
S7-200 SMART
336 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.14 Shift and rotate
Use the following equation to compute the address of the most significant bit of the Shift
Register (MSB.b):
MSB.b = [(Byte of S_BIT) + ([N] - 1 + (bit of S_BIT)) / 8].[remainder of the division by 8]
For example: if S_BIT is V33.4 and N is 14, the following calculation shows that the MSB.b is
V35.1.
MSB.b = V33 + ([14] - 1 +4)/8
= V33 + 17/8
= V33 + 2 with a remainder of 1
= V35.1
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 337
Program instructions
7.14 Shift and rotate
The following figure shows bit shifting for negative and positive values of N.
LAD STL
Network 1
LD I0.2
EU
SHRB I0.3, V100.0, +4
S7-200 SMART
338 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.15 String
7.15 String
SCAT IN, OUT The concatenate string instruction appends the string assigned by IN to the
end of the string assigned by OUT.
Note: The STR_CPY and STR_CAT instructions operate on bytes and not characters. Because Chinese characters are not
represented by a single byte, unexpected results can occur with the STR_CPY and STR_CAT instructions with strings
containing Chinese characters. If you know the number of bytes that a character string occupies, you can use the
STR_CPY and STR_CAT instructions with the correct number of bytes.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 339
Program instructions
7.15 String
LAD STL
1. Append the string "WORLD" to the Network 1
string at VB0. LD I0.0
2. Copy the string at VB0 to a new string SCAT "WORLD", VB0
at VB100. SCPY VB0, VB100
3. Get the length of the string that starts SLEN VB100, AC0
at VB100.
S7-200 SMART
340 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.15 String
AD STL
Starting at the seventh byte after the Network 1
byte count in the string at VB0, copy 5 LD I0.0
bytes to a new string at VB20. SSCPY VB0, 7, 5, VB20
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 341
Program instructions
7.15 String
Note: Because Chinese characters are not represented by a single byte, and the string instructions operate on bytes and
not characters, unexpected results can occur with the STR_FIND and CHR_FIND instructions with strings containing
Chinese characters.
S7-200 SMART
342 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.15 String
LAD STL
1. Set AC0 to 1. (AC0 is used Network 1
as the OUT parameter.) LD I0.0
2. Search the string at VB0 for MOVB 1, AC0
the string at VB20 ('On'), SFND VB0, VB20, AC0
starting at the first position
(AC0=1).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 343
Program instructions
7.15 String
LAD STL
1. Set AC0 to 1. (AC0 is used as the Network 1
OUT parameter and points to the LD I0.0
first character position in the MOVB 1, AC0
string.) CFND VB0, VB20, AC0
2. Find the first numeric character in STR VB0, AC0, VD200
the string stored at VB0.
3. Convert the string to a real num-
ber value.
S7-200 SMART
344 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.16 Table
7.16 Table
Note
To create a table, first make an entry for the maximum number of table entries. If you do not
do this, then you cannot make any entries in the table.
Edge trigger instructions must activate all table read and table write instructions.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 345
Program instructions
7.16 Table
LAD STL
On the first scan only, load the maximum table Network 1
length 6 to VW200. LD SM0.1
MOVW +6, VW200
S7-200 SMART
346 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.16 Table
Note
All table read and table write instructions must be activated by edge trigger instructions.
To create a table, you must first make an entry for the maximum number of table entries
before any entries can be put in the table.
LAD STL
Network 1
LD I4.1
FIFO VW200, VW400
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 347
Program instructions
7.16 Table
Network 1
LD I0.1
LIFO VW200, VW300
S7-200 SMART
348 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.16 Table
LAD STL
Network 1
LD I2.1
FILL +0, VW200, 10
A table can have up to 100 data entries. The data entries (area to be searched)
are numbered from 0 to a maximum value of 99.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 349
Program instructions
7.16 Table
Note
When you use the table find instruction with tables generated with the Add-to-table, Last-in-
first-out, and First-in-first-out instructions, the entry count and the data entries correspond
directly. The maximum-number-of-entries word required for the Add-to-table, Last-in-first-out,
or First-in-first-out instructions is not required by the Table find instruction. See the following
figure.
Consequently, you should set the TBL operand of a Find instruction to one-word address
(two bytes) higher than the TBL operand of a corresponding the Add-to-table, Last-in-first-
out, or First-in-first-out instruction.
Differences in table formats for ATT, LIFO, FIFO, and TBL_FIND instructions
S7-200 SMART
350 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.16 Table
LAD STL
Network 1
LD I2.1
FND= VW202, 16#3130, AC1
Example: Table
The following program creates a table with 20 entries. The first memory location of the table
contains the length of the table (in this case 20 entries). The second memory location shows
the current number of table entries. The other locations contain the entries. A table can have
up to 100 entries. It does not include the parameters defining the maximum length of the
table or the actual number of entries (here VW0 and VW2). The actual number of entries in
the table (here VW2) is automatically incremented or decremented by the CPU with every
command.
Before you work with a table, assign the maximum number of table entries. Otherwise, you
cannot make entries in the table. Also, be sure that all read and write commands are
activated with edge instructions.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 351
Program instructions
7.16 Table
To search the table, the index (VW106) must set to 0 before doing the find. If a match is
found, the index will have the table entry number, but if no match is found, the index will
match the current entry count for the table (VW2).
LAD STL
Create table with 20 entries start- Network 1
ing with memory location 4. LD SM0.1
• On the first scan, define the MOVW +20, VW0
maximum length of the table.
S7-200 SMART
352 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.17 Timer
7.17 Timer
TONR Txxx, PT Use TONR On-delay retentive timers for accumulating the time value of many timed
intervals.
TOF Txxx, PT Use the TOF Off-delay timer for extending a time interval past an OFF (or FALSE)
condition, such as a delay time for cooling a motor.
Timer resolution
TON, TONR, and TOF timers are available in three resolutions. The resolution is determined
by the timer number, as shown below. Each unit of the current value is a multiple of the time
base. For example, a count of 50 on a 10 ms timer represents 500 ms of elapsed time.
Your Txxx timer number assignment determines the resolution of the timer. When a valid
timer number is assigned, the resolution is displayed in LAD or FBD timer boxes.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 353
Program instructions
7.17 Timer
Note
Avoid timer number conflicts
You cannot use the same timer number for both a TON and TOF timer. For example, you
cannot have both a TON T32 and a TOF T32.
Note
To guarantee a minimum time interval, increase the preset value (PV) by 1.
For example: To ensure a minimum timed interval of at least 2100 ms for a 100-ms timer, set
the PV to 22.
S7-200 SMART
354 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.17 Timer
Type Current >= Preset State of IN, the enabling input Power cycle / first scan
TON Timer bit ON ON: Current value = timing value Timer bit = OFF
Current value continues OFF: Timer bit OFF, current value Current value = 0
timing to 32,767 =0
TONR1 Timer bit ON ON: Current value = timing value Timer bit = OFF
Current value continues OFF: Timer bit and current value Current value can be
timing to 32,767 maintain last state and value maintained1
TOF Timer bit OFF ON: Timer bit ON, current value = Timer bit = OFF
Current = Preset, stops 0 Current value = 0
timing OFF: Timer begins timing after
ON-to-OFF transition
1 The retentive timer current value can be assigned for retention through a power cycle. See Config-
uring the retentive ranges for details (Page 134).
Note
Using the Reset instruction with timer instructions
The TONR timer can only be reset with the Reset (R) instruction.
The TON and TOF timers can be reset by the timer's enable input and also the Reset (R)
instruction.
The Reset instruction performs the following actions:
• Timer bit = OFF
• Timer current value = 0
• After a reset, TOF timers require the enable input to make the transition from ON-to-OFF
in order restart the OFF-delay timer.
Timer types
You can use timers to implement time-based counting functions. The S7-200 instruction set
provides three different types of timers.
● On-Delay Timer (TON) for timing a single interval
● Retentive On-Delay Timer (TONR) for accumulating a number of timed intervals
● Off-Delay Timer (TOF) for extending time past an off (or false condition), such as for
cooling a motor after it is turned off
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 355
Program instructions
7.17 Timer
1-millisecond resolution
The 1-ms timers count the number of 1-ms timer intervals that have elapsed since the active
1-ms timer was enabled. The execution of the timer instruction starts the timing; however,
the 1-ms timers are updated (timer bit and timer current) every millisecond asynchronous to
the scan cycle. In other words, the timer bit and timer current are updated multiple times
throughout any scan that is greater than 1 ms.
The timer instruction is used to turn the timer on, reset the timer, or, in the TONR timer, to
turn the timer off.
Since the timer can be started anywhere within a millisecond, the preset must be set to one
time interval greater than the minimum desired timer interval. For example, to guarantee a
timed interval of at least 56 ms using a 1-ms timer, the preset time value should be set to 57.
10-millisecond resolution
The 10-ms timers count the number of 10-ms timer intervals that have elapsed since the
active 10-ms timer was enabled. The execution of the timer instruction starts the timing;
however the 10-ms timers are updated at the beginning of each scan cycle (in other words,
the timer current and timer bit remain constant throughout the scan), by adding the
accumulated number of 10-ms intervals (since the beginning of the previous scan) to the
current value for the active timer.
Since the timer can be started anywhere within a 10-ms interval, the preset must be set to
one time interval greater than the minimum desired timer interval. For example, to guarantee
a timed interval of at least 140 ms using a 10-ms timer, the preset time value should be set
to 15.
100-millisecond resolution
The 100-ms timers count the number of 100-ms timer intervals that have elapsed since the
active 100-ms timer was last updated. These timers are updated by adding the accumulated
number of 100-ms intervals (since the previous scan cycle) to the timer’s current value when
the timer instruction is executed.
The current value of a 100-ms timer is updated only if the timer instruction is executed.
Consequently, if a 100-ms timer is enabled but the timer instruction is not executed each
scan cycle, the current value for that timer is not updated and it loses time. Likewise, if the
same 100-ms timer instruction is executed multiple times in a single scan cycle, the number
of 100-ms intervals is added to the timer’s current value multiple times, and it gains time.
100-ms timers should only be used where the timer instruction is executed exactly once per
scan cycle.
S7-200 SMART
356 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.17 Timer
Since the timer can be started anywhere within a 100-ms interval, the preset must be set to
one time interval greater than the minimum desired timer interval. For example, to guarantee
a timed interval of at least 2100 ms using a 100-ms timer, the preset time value should be
set to 22.
LAD STL
100 ms timer T37 times out after 1 s Network 1
(10 x 100 ms) LD I0.0
• I0.0 ON = T37 enabled, TON T37, +10
Timing Diagram
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 357
Program instructions
7.17 Timer
LAD STL
10 ms timer T33 times out after 1 s Network 1
(100 x 10 ms). LDN M0.0
M0.0 pulse is too fast to monitor with TON T33, +100
Status view.
S7-200 SMART
358 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.17 Timer
LAD STL
10 ms TONR timer T1 times out at Network 1
PT = 1 s (100 x 10 ms). LD I0.0
TONR T1, +100
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 359
Program instructions
7.17 Timer
LAD STL
10-ms timer T33 times out after 1 s Network 1
(100 x 10 ms). LD I0.0
• I0.0 ON-to-OFF = T33 enabled TOF T33, +100
Timing Diagram
Effect of timer resolution on when timer bits and current time values are updated
● 1 ms timer: The timer bit and the current value are updated asynchronous to the scan
cycle. For scans greater than 1 ms, the timer bit and the current value are updated
multiple times throughout the scan.
● 10 ms timer: The timer bit and the current value are updated at the beginning of each
scan cycle. The timer bit and current value remain constant throughout the scan. Time
intervals that accumulate during the scan are added to the current value at the start of
each scan.
● 100 ms timer: The timer bit and current value are updated when the instruction is
executed; therefore, ensure that your program executes the instruction for a 100-ms timer
only once per scan cycle in order for the timer to maintain the correct timing.
S7-200 SMART
360 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.17 Timer
10 ms timer
Q0.0 is never turned ON, because the timer bit T33 is turned ON from the top of the scan to
the point where the timer box is executed. Once the timer box has been executed, the
timer’s current value and its T–bit are set to zero. When the normally open contact T33 is
executed, T33 is OFF and Q0.0 is turned OFF.
100 ms timer
Q0.0 is always turned ON for one scan whenever the timer’s current value reaches the
preset value.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 361
Program instructions
7.17 Timer
CITIM IN, OUT The Calculate interval time instruction calculates the time difference between the
current time and the time provided at IN. The difference is stored in OUT. The
maximum timed interval for a DWORD millisecond value is 2 raised to the 32
power or 49.7 days. CITIM automatically handles the one millisecond timer rollo-
ver that occurs within the maximum interval, depending on when the BITIM in-
struction was executed.
LAD STL
Capture the time that Q0.0 Network 1
turned ON. LD Q0.0
EU
BITIM VD0
Ex1_Interval_time_net1
S7-200 SMART
362 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.18 Subroutine
7.18 Subroutine
To add a new subroutine, select the Edit ribbon strip then Insert Object and Subroutine
command. STEP 7-Micro/WIN SMART automatically adds an unconditional return from each
subroutine. You can also add conditional return CRET instructions within the subroutine.
From the main program, you can nest subroutines (place a subroutine call within a
subroutine) to a depth of eight.
From an interrupt routine, you can nest subroutines to a depth of four.
Note
Recursion (a subroutine that calls itself) is not prohibited, but you should use caution when
using recursion with subroutines.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 363
Program instructions
7.18 Subroutine
S7-200 SMART
364 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.18 Subroutine
Parameter Description
IN Parameters are passed into the subroutine. If the parameter is a direct address (such as VB10), the
value at the specified location is passed into the subroutine. If the parameter is an indirect address (such
as *AC1), the value at the location pointed to is passed into the subroutine. If the parameter is a data
constant (16#1234) or an address (&VB100), the constant or address value is passed into the subrou-
tine.
IN_OUT The value at the specified parameter location is passed into the subroutine, and the result value from the
subroutine is returned to the same location. Constants (such as 16#1234) and addresses (such as
&VB100) are not allowed for input/output parameters.
OUT The result value from the subroutine is returned to the specified parameter location. Constants (such as
16#1234) and addresses (such as &VB100) are not allowed as output parameters. Since output param-
eters do not retain the value assigned by the last execution of the subroutine, you must assign values to
outputs each time the subroutine is called.
TEMP Any local memory that is not used for passed parameters can be used for temporary storage within the
subroutine.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 365
Program instructions
7.18 Subroutine
LAD STL
STL only:
Network 1
LD I0.0
CALL SBR_0, I0.1, VB10, I1.0, &VB100, *AC1, VD200
Note
There are two STL examples provided above. STL programmers can use the first simplified
STL instructions, which can only be displayed in the STL editor. This is because the BOOL
parameters used as LAD/FBD power flow inputs are not saved to L memory.
The second set of compiler generated STL instructions can be displayed in the LAD, FBD,
and STL editors, because L memory is used by the program compiler to save the state of the
BOOL input parameters that are assigned as power flow inputs in LAD/FBD.
Address parameters such as IN4 (&VB100) are passed into a subroutine as a DWORD
(unsigned double word) value. The type of a constant parameter must be specified for the
parameter in the calling routine with a constant descriptor in front of the constant value. For
example, to pass an unsigned double word constant with a value of 12,345 as a parameter,
the constant parameter must be specified as DW#12345. If the constant describer is omitted
from the parameter, the constant can be assumed to be a different type.
S7-200 SMART
366 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.18 Subroutine
There are no automatic data type conversions performed on the input or output parameters.
For example, if the variable table specifies that a parameter has the data type REAL, and in
the calling routine a double word (DWORD) is specified for that parameter, the value in the
subroutine will be a double word.
When values are passed to a subroutine, they are placed into the local memory of the
subroutine. The left-most column of the variable table shows the local memory address for
each passed parameter. Input parameter values are copied to the subroutine's local memory
when the subroutine is called. Output parameter values are copied from the subroutine's
local memory to the specified output parameter addresses when the subroutine execution is
complete.
The data element size and type are represented in the coding of the parameters.
Assignment of parameter values to local memory in the subroutine is as follows:
● Parameter values are assigned to local memory in the order specified by the call
subroutine instruction with parameters starting at L 0.0.
● One to eight consecutive bit parameter values are assigned to a single byte starting with
Lx.0 and continuing to Lx.7.
● Byte, word, and double word values are assigned to local memory on byte boundaries
(LBx, LWx, or LDx).
In the Call Subroutine instruction with parameters, parameters must be arranged in order
with input parameters first, followed by input/output parameters, and then followed by output
parameters.
If you are programming in STL, the format of the CALL instruction is:
CALL subroutine number, parameter 1, parameter 2, ... , parameter 16
LAD STL
MAIN On the first scan, call subroutine 0 Network 1
for initialization. LD SM0.1
CALL SBR_0
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 367
Program instructions
7.18 Subroutine
STL
LAD
MAIN Network 1
LD I0.0
SCPY "string1", VB100
AENO
MOVD &VB100, VD0
MAIN Network2
LD I0.1
SCPY "string2", VB200
AENO
MOVD &VB200, VD0
MAIN Network3
LD I0.2
CALL SBR_0, *VD0
MAIN Network4
LD I0.3
CALL SBR_0, "string3"
SBR0 Network 1
LD SM0.0
SSCPY *LD0, VB300
S7-200 SMART
368 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.19 PROFINET
7.19 PROFINET
Note
For any legacy instruction that can access the I or Q memory area, it accesses to the I or Q
memory area of a PROFINET network.
WRREC Req, Table, Done, Status Use the WRREC instruction to write a data record to
PROFINET device.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 369
Program instructions
7.19 PROFINET
Note
The supported maximum data record length is 1024 bytes.
S7-200 SMART
370 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.19 PROFINET
Table 7- 23 TABLE
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 371
Program instructions
7.19 PROFINET
Table 7- 24 STATUS
Error Description
code
0 No error.
1 The data length parameter is 0 or is greater than the supported maximum length (1024
bytes).
2 The data buffer is not in I, Q, M, or V memory areas.
3 The data buffer does not fit in the memory area.
4 The table doesn't match with the memory.
5 The device number is invalid and not within the range: from 1 to 8.
6 An instance mismatch: The connection is busy with another instance, whose device num-
ber, API number, slot number and subslot number are same as the requested instance,
but with a different buffer size and data address.
7 The PROFINET device is not connected.
8 The size of the received buffer exceeds 1024 bytes.
9 Call sequence is invalid.
10 Parameters are invalid (for example, out-of-range).
11 The AR is created afresh in the meanwhile.
12 The RPC reports a timeout error.
13 The RPC reports a communication error.
14 The RPC Server of the IOD signaled “busy” (for example, the call can be repeated later).
15 CLRPC reports an error or the PDU cannot be parsed.
16 CM response is OK, but has a PROFINET protocol defined error.
17 The instruction parameter is invalid.
24 REQ is not enabled.
25 The buffer length is smaller than the actual data record length.
63 Unknown error.
S7-200 SMART
372 System Manual, V2.4, 03/2019, A5E03822230-AG
Program instructions
7.19 PROFINET
7.19.3 Read and Write multiple bytes between physical PROFINET and memory
address
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 373
Communication 8
The S7-200 SMART offers several types of communication between CPUs, programming
devices, and HMIs:
● Ethernet:
– Exchange of data from the programming device to the CPU
– Exchange of data between HMIs and the CPU
– S7 peer-to-peer communication with other S7-200 SMART CPUs
– Open User Communication (OUC) with other Ethernet-capable devices
– PROFINET communication with PROFINET devices
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
● PROFIBUS:
– High speed communications for distributed I/O (up to 12 Mbps)
– One bus master connects to many I/O devices (supports 126 addressable devices).
– Exchange of data between the master and I/O devices
– EM DP01 module is a PROFIBUS I/O device.
● RS485:
– Provides a STEP 7-Micro/WIN SMART connection for programming when using a
USB-PPI cable
– Supports a total of 126 addressable devices (32 devices per network segment)
– Supports PPI (point-to-point interface) protocol
– Exchange of data between HMIs and the CPU
– Exchange of data between devices and the CPU using Freeport (XMT/RCV
instructions)
● RS232:
– Supports a point-to-point connection to one device
– Supports PPI protocol
– Exchange of data between HMIs and the CPU
– Exchange of data between devices and the CPU using Freeport (XMT/RCV
instructions)
S7-200 SMART
374 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.1 CPU communication connections
Note
You can program an S7-200 SMART CPU through the Ethernet port if your CPU model
supports it. Only one PG can monitor one CPU at a time.
Note
The S7-200 SMART CPU uses the GET and PUT instructions for CPU-to-CPU
communications.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
● Integrated RS485 port (Port 0): Four connections to support HMI devices and one
connection reserved for programming with STEP 7-Micro/WIN SMART.
Note
You can make the following RS485 communication connections:
• Use a USB-PPI cable to program all CPU models through any serial port, including the
RS485 port, the signal board port, and the DP01 PROFIBUS port.
• Use the RS485 and RS232 ports for HMI access (Data read/write) and Freeport
communications.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 375
Communication
8.2 CPU communication ports
● PROFIBUS port: Each EM DP01 PROFIBUS DP module can support six connections.
● CM01 Signal Board (SB) RS232/RS485 port (Port 1): Four connections to support HMI
devices.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not
support the use of expansion modules or signal boards.
S7-200 SMART
376 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.3 HMIs and communication drivers
HMIs
The S7-200 SMART supports the HMIs from the following Siemens HMI families:
● COMFORT HMIs (PROFINET and PROFIBUS):
– SIMATIC HMI TP700 COMFORT
– SIMATIC HMI TP900 COMFORT
– SIMATIC HMI TP1200 COMFORT
– SIMATIC HMI KP400 COMFORT
– SIMATIC HMI KP700 COMFORT
– SIMATIC HMI KP900 COMFORT
– SIMATIC HMI KP1200 COMFORT
– SIMATIC HMI KTP400 COMFORT
● SMART HMIs (PROFINET and PROFIBUS):
– SMART 700 IE
– SMART 1000 IE
● BASIC HMIs (PROFINET):
– SIMATIC HMI KTP400 BASIC MONO PN
– SIMATIC HMI KTP600 BASIC MONO PN
– SIMATIC HMI KTP600 BASIC COLOR PN
– SIMATIC HMI KTP1000 BASIC COLOR PN
– SIMATIC HMI TP1500 BASIC COLOR PN
– SIMATIC HMI KP300 BASIC MONO PN
● BASIC HMIs (PROFIBUS):
– SIMATIC HMI KTP600 BASIC COLOR DP
– SIMATIC HMI KTP1000 BASIC COLOR DP
● Micro HMIs (PROFIBUS):
– TD 400C TEXT DISPLAY, 4 LINES
Communication drivers
Communication drivers for your S7-200 SMART HMIs can be selected in two locations:
● WinCC Flexible software
● TIA portal
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 377
Communication
8.4 Ethernet
WinCC Flexible
In the WinCC Flexible software package, you can select the required "Communication driver"
with the following menu selections:
● Communications
● Connections table
In the "Connections table", select the "SIMATIC S7 200 SMART" driver. If the SMART driver
is not in the list, select the "SIMATIC S7 200" driver.
TIA portal
In the TIA portal, you can select the required "Communication driver" with the following menu
selections:
● HMI tags
● Connections
In "Connections", select the "SIMATIC S7 200" driver.
Note
If the HMI panel is using a PROFIBUS DP connection (RS485), then also set the "Network
Profile" to PPI.
8.4 Ethernet
8.4.1 Overview
An Ethernet network is a differential (multi-point) network that can have up to 32 segments
and 1,024 nodes. Ethernet allows for data transfer at a high speed (up to 100 Mbit/s) and
long distances (Copper: Maximum approximately 1.5km; Optical: Maximum approximately
4.3km).
Possible Ethernet connections include connections for the following:
● Programming devices
● CPU-to-CPU GET/PUT communication
● HMI displays
● Open User Communication (OUC)
● PROFINET Communication
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and no functions related to the use of Ethernet communications.
S7-200 SMART
378 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 379
Communication
8.4 Ethernet
The Ethernet port on the CPU does not contain an Ethernet switching device. A direct
connection between a programming device or HMI and a CPU does not require an Ethernet
switch. However, a network with more than two CPUs or HMI devices requires an Ethernet
switch.
① CSM1277 Ether-
net switch
You can use the rack-mounted CSM1277 4-port Ethernet switch for connecting multiple
CPUs and HMI devices.
S7-200 SMART
380 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
The subnet mask, when combined with the device IP address in a logical AND operation,
defines the boundaries of an IP subnet.
Note
In a World Wide Web scenario, where your programming devices, network devices, and IP
routers will communicate with the world, unique IP addresses must be assigned to avoid
conflict with other network users. Contact your company IT department personnel, who are
familiar with your plant networks, for assignment of your IP addresses.
Note
A secondary network adapter card is useful when you do not want your CPU on your
company LAN. During initial testing or commissioning tests, this arrangement is particularly
useful.
Assigning or checking the IP address of your programming device using "My Network Places" (on
your desktop)
If you are using Windows 7, you can assign or check your programming device's IP address
with the following menu selections:
● "Start"
● "Control Panel"
● "Network and Sharing Center"
● "Local Area Connection" for the network adapter connected to your CPU
● "Properties"
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 381
Communication
8.4 Ethernet
● In the "Local Area Connection Properties" dialog, in the "This connection uses the
following items:" field:
– Scroll down to "Internet Protocol Version 4 (TCP/IPv4)".
– Click "Internet Protocol Version 4 (TCP/IPv4)".
– Click the "Properties" button.
– Select "Obtain an IP address automatically" or "Use the following IP address" (to enter
a static IP address).
● If you have selected "Obtain an IP address automatically" you might want to change the
selection to "Use the following IP address" to connect to the S7-200 SMART CPU:
– Select an IP address on the same subnet as the CPU (192.168.2.1).
– Set the IP address to an address with the same Network ID (for example,
192.168.2.200).
– Select a subnet mask of 255.255.255.0.
– Leave the default gateway blank.
– This will allow you to connect to the CPU.
Note
The Communication Interface (for Ethernet, a network interface card (NIC)) and the
CPU must be on the same subnet to allow STEP 7-MicroWIN SMART to find and
communicate to the CPU.
Consult your IT personnel to help you set up a network configuration to allow you to connect
to the S7-200 SMART CPU.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
S7-200 SMART
382 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
● IP address: Each CPU or device must have an Internet Protocol (IP) address. The CPU
or device uses this address to deliver data on a more complex, routed network. Each IP
address is divided into four 8-bit segments and is expressed in a dotted, decimal format
(for example, 211.154.184.16). The first part of the IP address is used for the Network ID
(What network are you on?), and the second part of the address is for the Host ID
(unique for each device on the network). An IP address of 192.168.x.y is a standard
designation recognized as part of a private network that is not routed on the Internet.
Note
All S7-200 SMART CPUs have a default IP address of: 192.168.2.1
Note
You must have a unique IP address for each device on your network.
Note
A subnet mask of 255.255.255.0 is generally suitable for a local network.
● Default gateway IP address: Gateways (or IP routers) are the link between LANs. Using a
gateway, a computer in a LAN can send messages to other networks, which might have
other LANs behind them. If the data destination is not within the LAN, the gateway
forwards the data to another network or group of networks where it can be delivered to its
destination. Gateways rely on IP addresses to deliver and receive data packets.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 383
Communication
8.4 Ethernet
There are three ways to configure or change the IP information for the onboard Ethernet port
of a CPU or device:
● Configuring the IP information in the "Communications" dialog (dynamic IP information)
● Configuring the IP information in the "System Block" dialog (static IP information)
● Configuring the IP information in the user program (dynamic IP information)
Note
You can have static or dynamic IP information in the CPU:
• Static IP information: If the "IP address data is fixed to the values below and cannot be
changed by other means" checkbox in the system block is checked, then the Ethernet
network information that you enter is static. Static IP information must be downloaded
to the CPU before it is active in the CPU, and, if you want to change the IP
information, this IP information can only be changed in the system block dialog and
once again downloaded to the CPU.
• Dynamic IP information: If the "IP address data is fixed to the values below and cannot
be changed by other means" checkbox in the system block is not checked, then you
change the IP address of the CPU through other means and this IP address
information is considered to be dynamic. You can change the IP address information
in the Communications dialog or with the SIP_ADDR instruction in the user program.
• For both static and dynamic IP, the information is stored in persistent memory.
S7-200 SMART
384 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
For "Found CPUs" (CPUs located on your local network), use the "Communications dialog"
to connect with your CPU:
● Click the "Communication Interface" dropdown list, and select the "TCP/IP" Network
Interface Card (NIC) for your programming device.
● Click the "Find CPUs" button to display all operational CPUs ("Found CPUs") on the local
Ethernet network. All CPUs have a default IP address.
● Highlight a CPU, and then click "OK".
For "Added CPUs" (CPUs on the local or remote networks), use the "Communications
dialog" to connect with your CPU:
● Click the "Communication Interface" dropdown list, and select the "TCP/IP" Network
Interface Card (NIC) for your programming device.
● Click the "Add CPU" button to do one of the following:
– Enter the IP address of a CPU that is accessible from the programming device, but is
not on the local network.
You can add these CPUs, select them as the communication partner in STEP
7-Micro/WIN SMART, and program and operate these CPUs in the same way you
would a CPU on the local network. As long as there is a valid network path through
routers, STEP 7-Micro/WIN SMART can communicate with any S7-200 SMART CPU.
– Enter the IP address of a CPU directly that is on the local network.
You can add multiple CPUs, on the local network and/or remote network. As always,
STEP 7-Micro/WIN SMART communicates with one CPU at a time. All CPUs have a
default IP address.
● Highlight a CPU, and then click "OK".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 385
Communication
8.4 Ethernet
S7-200 SMART
386 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 387
Communication
8.4 Ethernet
Note
The Station Name follows the standard DNS (Domain Name System) naming
conventions. The S7-200 SMART CPUs limit the Station Name to a maximum of 63
characters. The Station Name can consist of the lower case letters a through z, the
digits 0 through 9, the hyphen character (minus sign), and the period character.
Certain names are not allowed and this can depend on the tool used to set the Station
Name. The Station Name must not have the format "n.n.n.n" where n is a value of 0
through 999. The Station Name cannot begin with the string "port-nnn" or the string
"port-nnn-nnnnn" where "n" is a digit 0 through 9 (for example, "port-123" and "port-
123-45678" are illegal). The Station Name cannot start or end with the hyphen or
period.
S7-200 SMART
388 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
When you check the "IP address data is fixed to the values below and cannot be changed by
other means" checkbox in the system block dialog, the IP information that you enter for the
onboard Ethernet port is static. Static IP information must be downloaded to the CPU before
it is active in the CPU. If you want to change the IP information, this IP information can only
be changed in the system block dialog and once again downloaded to the CPU.
Note
If the "IP address data is fixed to the values below and cannot be changed by other means"
checkbox is checked, then the IP information cannot be set in the Communications dialog.
In order to use the SIP_ADDR instruction, the "IP address data is fixed to the values below
and cannot be changed by other means" checkbox must be unchecked.
After completing the IP information configuration, download the project to the CPU. All CPUs
and devices that have valid IP addresses are displayed in the Communications dialog.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 389
Communication
8.4 Ethernet
IP information or changes done through the SIP_ADDR instruction are immediate and do not
require a download of the project. The IP address information set with the SIP_ADDR
instruction is stored in permanent memory in the CPU.
Refer to the "Get IP address and set IP address (Ethernet)" (Page 202) instructions for more
information.
S7-200 SMART
390 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
Note
Each CPU is loaded at the factory with a permanent, unique MAC address. You cannot
change the MAC address of a CPU.
The MAC address is printed on the front, upper-left corner of the CPU. Note that you have to
open the upper door to see the MAC address information.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 391
Communication
8.4 Ethernet
① MAC address
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
S7-200 SMART
392 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
Note
The rack-mounted CSM1277 4-port Ethernet switch can be used to connect your CPUs
and HMI devices. The Ethernet port on the CPU does not contain an Ethernet switching
device.
● Supported functions:
– The HMI can read/write data to the CPU.
– Messages can be triggered, based upon information retrieved from the CPU.
– System diagnostics
To ensure that your CPU and HMI are communicating properly, follow the sequence of steps
in the table below:
Step Task
1 Establishing the hardware communications connection
An Ethernet interface establishes the physical connection between an HMI and a CPU. Since Auto-Cross-Over
functionality is built into the CPU, you can use either a standard or crossover Ethernet cable for the interface.
An Ethernet switch is not required to connect an HMI and a CPU.
Refer to "Establishing the hardware communications connection" (Page 29) for more information.
2 If you have already created a project with a CPU, open your project in STEP 7-Micro/WIN SMART. If not, cre-
ate a project and insert a CPU In the project.
3 Configuring an IP address in your project
Use the same configuration process; however, you must configure IP addresses for the HMI and the CPU. You
must download the configuration for each CPU and HMI device.
Refer to "Configuring or changing an IP address for a CPU or device in your project" (Page 382) for more in-
formation.
Note
You can restrict communication writes to a specific range of V memory; this can affect HMI
communications. See "Configuring system security" (Page 135) for more information.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 393
Communication
8.4 Ethernet
8.4.7.1 Protocols
Open User Communication (OUC) provides a mechanism for your program to transmit and
receive messages over an Ethernet network. You can select the Ethernet protocol used as
the transport mechanism: UDP, TCP, or ISO-on-TCP
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
ISO-on-TCP
ISO-on-TCP is a protocol add-on using RFC 1006. The main advantage of ISO-on-TCP is
that you have a clear data end sign in the data so that you know when the entire message
has been received. SPS7 protocol (Put/Get) utilizes ISO-on-TCP protocol. ISO-on-TCP only
uses port 102 and utilizes TSAPs (Transport Services Access Point) to route the message to
the proper receiver instead of a port as in TCP.
The ISO-on-TCP protocol delineates each message received. For example, a client sends
three messages to a server using the ISO-on-TCP protocol. Even if the server waits for all
messages to accumulate before checking for a received message, the server will get each
S7-200 SMART
394 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
message as it was sent and see three distinct messages. This is the difference between
TCP protocol and the ISO-on-TCP protocol.
8.4.7.2 Connections
The S7-200 SMART CPU has two OUC instructions to perform connection management:
● The TCON instruction to establish an active connection (client) or open a passive
connection (server)
● The TDCON instruction to force a disconnection (for example, close a connection). A
RUN-to-STOP transition forces the closure of all open connections by the CPU.
The CPU supports two types of connections for OUC:
● Active: A connection established and maintained by the local CPU. The local CPU is
responsible for issuing the connection request to another device and maintaining the
connection so that the connection does not time out due to inactivity.
● Passive: A passive connection is one in which the local CPU opens a port and/or TSAP to
accept the connection request from another device.
The CPU supports eight active and eight passive connections.
The CPU creates a passive or active connection based upon the connection table passed to
the TCON instruction. UDP connections are always passive. TCP and ISO-on-TCP protocol
connections use a configuration parameter to determine the type of connection.
Ports
The UDP and TCP protocols allow you to select the local and remote port numbers. The port
number is fixed at port 102 when you select the ISO-on-TCP protocol.
Port numbers must be in the range of 1 to 49151. It is recommended that port numbers be in
the range of 2000 to 5000. The S7-200 SMART CPU range and restriction rules for port
numbers are shown in the tables below:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 395
Communication
8.4 Ethernet
You cannot use the port numbers shown in the following table for local port numbers in the
S7-200 SMART CPU. You have no restrictions for the remote port number:
You can have multiple active connections use the same port number for the local and remote
port numbers. For example, a TCP client can connect to multiple servers on port 2500. Both
the local and remote ports would normally be port 2500 for the active connection.
You cannot have multiple passive connections use the same port number as the local port
number. For example, the CPU does not allow multiple TCP servers (multiple passive
connections) to be on local port 2500. The CPU does not know to which of the multiple 2500
ports to route the messages.
TSAPs
Using Transport Service Access Points (TSAPs), ISO-on-TCP protocol allows multiple
connections to a single IP address. TSAPs uniquely identify these communication end point
connections to an IP address.
The ISO-on-TCP protocol utilizes port 102 exclusively. You cannot set the port number for
this protocol; however, you can set the TSAP for the local and remote partner.
The TSAP rules are shown below:
● You always enter TSAPs as an S7-200 SMART string data type (a length byte followed
by the string characters).
● TSAPs must be at least 2 characters and no more than 16 ASCII characters in length.
● The local TSAP cannot start with string "SIMATIC-"
● The local TSAP must begin with the hexadecimal character "0xE0" if the TSAP is exactly
2 characters long. For example, the TSAP "$E0$01" is legal but the TSAP "$01$01" is not
legal. (The "$" character denotes that the following value is a hexadecimal character.)
S7-200 SMART
396 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
8.4.8 PROFINET
8.4.8.1 Introduction
Note
You can have a maximum of 8 PROFINET devices and 64 modules or submodules on
your S7-200 SMART PROFINET network.
Objectives of PROFINET
The objectives of PROFINET are:
● Industrial networking, based on Industrial Ethernet (open Ethernet standard)
● Compatibility of Industrial Ethernet and standard Ethernet components
● High robustness due to Industrial Ethernet devices. Industrial Ethernet devices are suited
to the industrial environment (such as temperature and noise immunity).
● Real-time capability
● Seamless integration of other fieldbus systems
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 397
Communication
8.4 Ethernet
S7-200 SMART
398 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
2. Click the "Browse" button in the "Manage general station description files" dialog.
Note
The next time you import GSDML files, the dialog displays the file path you navigate to
last time.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 399
Communication
8.4 Ethernet
4. Select the GSDML file you want to import. You can also import multiple GSDML files.
Note
The GSDML file must conform to the GSDML Specification.
For any issue about GSDML files, contact the manufacture.
Note
The maximum number of imported GSDML file is 20.
5. Click the "Open" button. The GSDML file and the installation date displays in the
"Imported GSDML files" field.
S7-200 SMART
400 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 401
Communication
8.4 Ethernet
● Open the Tools folder in the project tree; select the "Find PROFINET Devices" node and
press Enter, or double-click the "Find PROFINET Devices" node.
Configuring the PROFINET device name in the "Find PROFINET Devices" dialog
To assign a name to a device, proceed with the following steps:
1. Open the "Find PROFINET Devices" tool.
The "Find PROFINET Devices" dialog detects all connected and available PROFINET
devices on the local Ethernet network. After selecting a PROFINET device, STEP 7-
Micro/WIN SMART displays the following detailed information about the device:
– MAC Address
– IP Address
– Subnet Mask
– Default Gateway
– Device name
2. Click the "Communication Interface" dropdown list, and select the "TCP/IP" Network
Interface Card (NIC) for your programming device.
S7-200 SMART
402 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
3. Click the ''Find Devices" button to display all available PROFINET devices on the local
Ethernet network.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 403
Communication
8.4 Ethernet
Note
The device name follows the standard DNS (Domain Name System) naming conventions.
The naming rule is as follows:
• The maximum supported characters is 63.
• The device name can consist of the lower case letters a through z, the digits 0 through
9, the hyphen character "-", and the period character ".".
• The device name can consist of the Chinese characters (Simplified or Traditional).
• The device name must not have the format n.n.n.n where n is a value of 0 through
999.
• You cannot begin the device name with the string port-nnn or the string port-nnn-
nnnnn where n is a digit 0 through 9. For example, port-123 and port-123-45678 are
illegal device names.
• The device name cannot start or end with the hyphen character "-" or the period
character ".".
6. Click the "Set" button. The device name is assigned to the device.
7. When finished, click "OK".
PROFINET IO system
A PROFINET system is comprised of a PROFINET controller and its assigned PROFINET
devices.
Requirement
● You have imported the GSDML file for the PROFINET devices. (Page 398)
● The system block includes the PROFINET controller (Page 126).
Note
You can only use ST/SR 20, ST/SR 30, ST/SR 40, ST/SR 60 as PROFINET a IO
controller. The firmware version must ve V2.4 or higher.
● You have assigned the names to the PROFINET devices (Page 401).
S7-200 SMART
404 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
Procedure
To assign a device to the PROFINET controller, follow these steps:
1. Open the PROFINET configuration Wizard.
2. Select the PLC role as "PROFINET controller".
Note
If you change the role from 'PROFINET controller" to "PROFINET disabled", the existing
PROFINET configuration in this project is lost.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 405
Communication
8.4 Ethernet
3. To enter the configure page, click "Next" in the bottom of the window or click the CPU
name in the PROFINET network tree.
① PROFINET network tree The structure tree of the editing PROFINET network.
③ PROFINET device catalog PROFINET device catalog for which you imported the GSDML
tree files.
Note:
For the unicode character, STEP 7-Micro/WIN SMART supports
importing the GSDML file that contains MBCS (Multi-Bytes
Charecter Set) character. If you import the GSDML file that
contains special unicode characters, for example, "Ä" and "È",
STEP 7-Micro/WIN SMART cannot display GSDML file descrip-
tion and GSDML parameters normally and the question mark
"?" shows in the PROFINET wizard.
④ PROFINET device descrip- The description of the device you have currently select.
tion
⑤ Device table Lists the devices configured in the PROFINET network. You can
enter the device name, assign an IP address or add comments
(optional) for the devices in the device table.
S7-200 SMART
406 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
⑥ Controller parameters Parameters of the PROFINET controller. You can assign "send
clock" and "start up time" for the controller here.
Note: Your setting for the "start up time" impacts the amount of
time the PROFINET Controller takes to switch to RUN mode.
The default value for "start up time" is 10 s, and the maximum
value is one minute.
• If "start up time" is set as zero, the CPU switches to RUN
mode immediately.
• If the full connection is established within the "start up time",
the CPU switches to RUN mode after the connection is es-
tablished.
• If the connection is not established after the "start up time",
the CPU switches to RUN mode after the "start up time".
Result: The PROFINET device is added in the device table, network view, and
PROFINET network tree.
6. Enter the device name and comments. Double click the blank column to set the IP
address.
Note: For any PROFINET device, make sure you use the same name in the device table
as when you assigned the name in the "Find PROFINET Device" dialog.
Note: The comments that you enter in the PROFINET wizard are not downloaded to PLC.
The comments are only saved in the project file.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 407
Communication
8.4 Ethernet
7. Click "Next" or modules in the PROFINET network tree to enter the module configuration
dialog.
① PROFINET network tree The structure tree of the editing PROFINET network.
② Submodule table for The table lists the module and submodules for the selected de-
device vices in the PROFINET network. You can assign the PNI/PNQ
start address for the device here.
For the range of the PNI/PNQ start address, refer to Memory
ranges and features (Page 867).
③ Module catalog tree The list for the selected devices.
8. Click the module or submodule from the module catalog tree. The slots where you can
add a module or submodule turn green.
Note: Make sure the module type you select exists in your real network.
S7-200 SMART
408 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.4 Ethernet
9. Click the "Add" button or drag and drop the module to the slot.
10.Click the module name in the PROFINET network tree to configure the module or to
check the detailed information of the module.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 409
Communication
8.4 Ethernet
Result
The PROFINET devices and modules are added to the network and are ready for
downloading.
S7-200 SMART
410 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
8.5 PROFIBUS
The PROFIBUS protocol is designed for high-speed communications with distributed I/O
devices (remote I/O). A PROFIBUS system uses a bus master to poll DP I/O devices
distributed in a multi-drop fashion on an RS485 serial bus.
There are many PROFIBUS devices available from a variety of manufacturers. These
devices range from simple input or output modules to motor controllers and PLCs. A
PROFIBUS DP device is any peripheral device which processes information and sends its
output to the master. The DP device forms a passive station on the network (since it does
not have bus access rights) and can only acknowledge received messages or send
response messages to the master upon request. All PROFIBUS DP devices have the same
priority, and all network communication originates from the master.
A PROFIBUS master forms an "active station" on the network. PROFIBUS DP defines two
classes of masters. A class 1 master (normally a central programmable controller (PLC) or a
PC running special software) handles the normal communication or exchange of data with
the DP devices assigned to it. A class 2 master (usually a configuration device, such as a
laptop or programming console used for commissioning, maintenance, or diagnostics
purposes) is a special device primarily used for commissioning DP devices and for
diagnostic purposes.
PROFIBUS networks typically have one master and several DP I/O devices. (Refer to the
figure below.) You configure the master device to know what types of DP devices are
connected and at what addresses. The master initializes the network and verifies that the
DP devices on the network match the configuration. The master continuously writes output
data to the DP devices and reads input data from them.
When a PROFIBUS DP master configures a DP device successfully, it then owns that
DP device. If there is a second master device on the network, it has very limited access to
the DP devices owned by the first master.
The EM DP01 PROFIBUS DP module connects the S7-200 SMART CPU to a PROFIBUS
network as a DP device. The EM DP01 can be the communications partner of DP V0/V1
masters. You can access the EM DP01 GSD file at Siemens Customer Support.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
In the figure below, the S7-200 SMART CPU is a DP device for an S7-1200 controller:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 411
Communication
8.5 PROFIBUS
You can configure two PROFIBUS EMs per S7-200 SMART CPU (ST and SR models only).
The local CPU stores the PROFIBUS EM configuration data, and you set the PROFIBUS
addresses with switches on each module. This allows simple replacement of these
communications modules when necessary.
S7-200 SMART
412 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
configuration to the DP device. The DP master then reads the diagnostics from the
DP device to verify that the DP device accepted the parameters and the I/O configuration.
The DP master then begins to exchange I/O data with the DP device. Each transaction with
the DP device writes outputs and reads inputs. The data exchange mode continues
indefinitely. The DP devices can notify the DP master if there is an exception condition, and
the DP master then reads the diagnostic information from the DP device.
Once a DP master has written the parameters and I/O configuration to a DP device, and the
DP device has accepted the parameters and configuration from the DP master, the
DP master owns that DP device. The DP device only accepts write requests from the
DP master that owns it. Other DP masters on the network can read the DP device's inputs
and outputs, but they cannot write anything to the DP device.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
As a PROFIBUS DP device, the EM DP01 accepts several different I/O configurations from
the DP master, allowing you to tailor the amount of data transferred to meet the
requirements of the application. Unlike many DP devices, the EM DP01 does not transfer
only I/O data. The EM DP01 also transfers inputs, counter values, timer values, or any other
values that you move to the variable memory in the S7-200 SMART CPU. Likewise, the
EM DP01 transfers data from the DP master to the variable memory in the S7-200 SMART
CPU. You can then move this data from variable memory to other data areas.
You can attach the DP port of the EM DP01 PROFIBUS DP module to a DP master on the
network and still communicate as an MPI device with other master devices such as SIMATIC
HMI devices or S7-300 / S7-400 CPUs on the same network. The following figure shows a
PROFIBUS network with an S7-200 SMART CPU SR20 and an EM DP01 PROFIBUS DP
module:
● The S7-300 with CPU 315-2 is the DP master and has been configured by a SIMATIC
programming device with STEP 7 programming software. The S7-315-2 DP can read
data from or write data to the EM DP01, from 1 byte up to 244 bytes.
● The S7-200 SMART CPU SR20 is a DP device owned by the CPU 315-2. The ET 200 I/O
module is also a DP device owned by the CPU 315-2.
● The S7-400 CPU is attached to the PROFIBUS network and is reading data from the
CPU SR20 by means of X_GET instructions in the S7-400 CPU user program. (Other
SIMATIC CPUs can use DB1 to access V memory in the S7-200 SMART CPU.)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 413
Communication
8.5 PROFIBUS
Procedure
1. To use the S7-200 SMART EM DP01 PROFIBUS DP module as a DP device, you must
set the station address of the DP port to match the address in the configuration of the
DP master. The station address is set with the rotary switches on the EM DP01.
2. You must power cycle the S7-200 SMART CPU after you have made a switch change in
order for the new DP device address to take effect.
Result
The DP master device exchanges data with each of its DP devices by sending information
from its output area to the DP device's output buffer. The DP device responds to the
message from the DP master by returning an input buffer which the DP master stores in an
input area.
S7-200 SMART
414 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
Configuration steps
The S7-200 SMART EM DP01 PROFIBUS DP module can be configured by the DP master
to accept output data from the DP master and return input data to the DP master. The output
and input data buffers reside in the variable memory (V memory) of the S7-200 SMART
CPU. When you configure the DP master, you define the byte location in V memory where
the output data buffer starts as part of the parameter assignment information for the
EM DP01. You also define the I/O configuration as the amount of output data to be written to
the S7-200 SMART CPU and amount of input data to be returned from the S7-200 SMART
CPU. The EM DP01 determines the size of the input and output buffers from the I/O
configuration. The DP master writes the parameter assignment and I/O configuration
information to the EM DP01. The EM DP01 then transfers the V memory address and input
and output data lengths to the S7-200 SMART CPU. These values are available in the
special memory (SM) of the S7-200 SMART CPU for use in the user program. Refer to the
SM status information in "User program considerations" (Page 422) for further details.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 415
Communication
8.5 PROFIBUS
DP master consistency
Consistency in the DP master CPU is not always buffer consistent. The DP master CPUs do
not handle the entire DP message as one indivisible object unless it is very small. The
DP master CPUs usually move the PROFIBUS data in smaller pieces. They can either move
the data to the I/O area or the user can control the movement with DPRD_DAT (Read
consistent data for DP devices) and DPWR_DAT (Write consistent data for DP devices)
instructions. Using the DPRD_DAT and DPWR_DAT instructions, you obtain the information
for one configuration "slot" at a time. Since we allow two configuration slots, it can take two
DPRD_DAT instructions to obtain all of the data. Consistency is only guaranteed for each
DPRD_DAT instruction.
We can mix and match any two of these configurations in an EM DP01 configuration. Here
are two examples:
● A configuration of 32 bytes input and output plus a configuration of 8 bytes input and
output yields a total of 40 input bytes and 40 output bytes.
● A configuration of 122 bytes input and output plus a configuration of 122 bytes input and
output yields a total of 244 input bytes and 244 output bytes.
The EM DP01 allows a maximum of 244 input bytes and 244 output bytes. If you use two
configurations for the EM DP01, all of the input data is contiguous, and all of the output data
is contiguous. Refer to "Example of V memory and I/O address area" (Page 421) for further
information.
S7-200 SMART
416 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
4. In the Source path, using the dropdown button, locate the EM DP01 GSD file that you
have previously loaded on your computer.
5. Select the check box for the GSD file line.
6. Click the Install button:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 417
Communication
8.5 PROFIBUS
7. This action installs the EM DP01 GSD file in the Hardware catalog as shown in the
following figure:
S7-200 SMART
418 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 419
Communication
8.5 PROFIBUS
In the "Properties", "General" tab area navigation, click on "I/O addresses" to display the
input/output address configuration fields. In the "Input/output type:" field, you must make one
of the following selections for the universal module in this slot:
● Input
● Output
● Input/output
Then, you can configure the Input and/or output address ranges for your application.
Note
"Empty slot" is the default selection for the "Input/output type:" field. You must change
"Empty slot" to 'Input", "Output", or "Input/output" in order to configure your I/O addresses.
Note
In the examples above, the CPU 315-2 DP is the configured DP master. Depending on the
master CPU type, the EM DP01 "Properties" can appear slightly different than those shown
here.
S7-200 SMART
420 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
In this example, the DP master has defined an I/O configuration consisting of two slots and a
V memory offset of 1000. The example configures the first slot as 32 bytes in and out and
the second slot as 8 bytes in and out. The output and input buffers in the S7-200 SMART
CPU are both 40 bytes (32 + 8). The output data (from the DP master) buffer starts at
V1000; the input data (to the DP master) buffer immediately follows the output buffer and
begins at V1040.
All of the output data (all 40 bytes) is treated as one buffer consistent block of data in the
EM DP01 and SMART CPU. The output data in the S7-300 is treated with different
consistencies depending on whether the user utilizes the I and Q areas or whether they use
the DPRD_DAT (Read consistent data for DP devices) and DPWR_DAT (Write consistent
data for DP devices) instructions. Even using the DPRD_DAT and DPWR_DAT instructions,
the data is only consistent within the 32 byte and 8 bytes blocks. The entire 40 bytes is
consistent only if the user manages this by not reading or writing the data in user interrupt
blocks.
Note
If you are working with a data unit (consistent data) greater than four bytes, you can use the
DPRD_DAT instruction to read the inputs of the DP device and the DPWR_DAT instruction
to address the outputs of the DP device. For further information, refer to "Data consistency"
and the System Software for S7-300 and S7-400 System and Standard Functions Reference
Manual.
You can configure the location of the input and output buffers to be anywhere in the
V memory of the S7-200 SMART CPU. The default address for the input and output buffers
is VB0. The location of the input and output buffers is part of the parameter assignment
information that the DP master writes to the S7-200 SMART CPU. You configure the
DP master to recognize its DP devices and to write the required parameters and I/O
configuration to each of its DP devices.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 421
Communication
8.5 PROFIBUS
You configure SIMATIC S7 DP masters using STEP 7 programming software. For detailed
information about using this configuration and programming software package, refer to the
manuals for these devices. For detailed information about the PROFIBUS network and its
components, refer to the ET 200 Distributed I/O System Manual.
See also
Data consistency (Page 415)
Status information
There are 50 bytes of special memory (SM) allocated to each expansion module based upon
its physical position. The module updates the SM locations corresponding to the modules'
relative position to the CPU (with respect to other modules). If it is the first module, it updates
SMB1400 through SMB1449. If it is the second module, it updates SMB1450 through
SMB1499, and so on. Refer to the table below:
S7-200 SMART
422 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
These SM locations show default values if DP communications have not been established
with a DP master. After a DP master has written parameters and I/O configuration to the
EM DP01 PROFIBUS DP module, these SM locations show the configuration set by the DP
master. You should check the protocol status byte (for example SMB1424 for slot 0) to be
sure that the EM DP01 is currently in data exchange mode with the DP master before using
the information in the SM locations shown in the following table or data in the V memory
buffer.
Note
You cannot configure the EM DP01 PROFIBUS DP I/O buffer sizes or buffer location by
writing to SM memory locations. Only the DP master can configure the EM DP01
PROFIBUS DP module for DP operation.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 423
Communication
8.5 PROFIBUS
Note
If DP communications are lost, which forces the EM DP01 to exit Data Exchange Mode, the
DX MODE LED turns OFF and the DP ERROR LED turns red. This condition persists until
the S7-200 SMART CPU is powered off or Data Exchange Mode is resumed.
The following table summarizes the status indications signified by the EM DP01 status LEDs:
S7-200 SMART
424 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
Note
An S7-1200 PROFIBUS DP master cannot access an S7-200 SMART CPU using GET/PUT
functions. The S7-1200 DP master can still access the S7-200 SMART CPU using
PROFIBUS Data Exchange Mode.
When the EM DP01 PROFIBUS DP module is used for MPI communications, the address
parameter of the XGET/XPUT functions must be set to the address of the EM DP01
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 425
Communication
8.5 PROFIBUS
(address switches). MPI messages sent to the EM DP01 are passed on to the
S7-200 SMART CPU.
Messages from MPI and HMI devices are (serviced during)/(subject to) the communication
background time in the S7-200 SMART CPU. The communication background time can be
increased to provide faster responses to the MPI and HMI requests.
A maximum of six connections (six devices) in addition to the DP master can be connected
to the EM DP01. In order for the EM DP01 to communicate with multiple masters, all masters
must be operating at the same baud rate. Refer to the figure below for one possible network
configuration:
S7-200 SMART
426 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
Parameters Values
#Profibus_DP
GSD_Revision =5
Vendor_Name = "Siemens"
Model_Name = "EM DP01 PROFIBUS-DP"
Revision = "V01.00.00"
Ident_Number = 0x81C7
Protocol_Ident =0
Station_Type =0
FMS_supp =0
Hardware_Release =1
Software_Release = "V01.00.00"
;
9.6_supp =1
19.2_supp =1
45.45_supp =1
93.75_supp =1
187.5_supp =1
500_supp =1
1.5M_supp =1
3M_supp =1
6M_supp =1
12M_supp =1
;
MaxTsdr_9.6 = 40
MaxTsdr_19.2 = 40
MaxTsdr_45.45 = 40
MaxTsdr_93.75 = 40
MaxTsdr_187.5 = 40
MaxTsdr_500 = 40
MaxTsdr_1.5M = 40
MaxTsdr_3M = 50
MaxTsdr_6M = 100
MaxTsdr_12M = 200
;
Redundancy =0
Repeater_Ctrl_Sig =2
24V_Pins =2
Implementation_Type = "DPC31"
Bitmap_Device = "EM_DP01N"
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 427
Communication
8.5 PROFIBUS
Table 8- 7 Slave-Specification
Parameters Values
OrderNumber = "6ES7 288-7DP01-0AA0"
Periphery = "SIMATIC S7"
Info_Text = "PROFIBUS module for SMART CPU family."
Slave_Family = 10@TdF@SIMATIC
Freeze_Mode_supp =1
Sync_Mode_supp =1
Set_Slave_Add_Supp =0
Auto_Baud_supp =1
Min_Slave_Intervall =1
Fail_Safe =0
;
Modular_Station =1
Max_Module =2
Modul_Offset =0
;
Max_Input_len = 244
Max_Output_len = 244
Max_Data_len = 488
Max_Diag_Data_Len =6
Parameters Values
DPV1_Slave =1
C1_Read_Write_supp =1
C2_Read_Write_supp =1
C1_Max_Data_Len = 240
C2_Max_Data_Len = 240
C1_Response_Timeout = 100
C2_Response_Timeout = 100
C1_Read_Write_required =0
C2_Read_Write_required =0
C2_Max_Count_Channels =6
Max_Initiate_PDU_Length = 64
Ident_Maintenance_supp =1
DPV1_Data_Types =0
WD_Base_1ms_supp =0
S7-200 SMART
428 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
Parameters Values
Check_Cfg_Mode =0
Publisher_supp =0
Table 8- 9 UserPrmData-Definition
Parameters Values
ExtUserPrmData = 1 "I/O Offset in the V-memory"
Unsigned16 0 0-20479
EndExtUserPrmData
Parameters Values
Max_User_Prm_Data_Len =5
Ext_User_Prm_Data_Const (0) = 0x00,0x00,0x00,0x00,0x00
Ext_User_Prm_Data_Ref (3) =1
Parameters Values
Module = " 4 Bytes In/Out" 0xF1
20
EndModule
Module = " 8 Bytes In/Out" 0xF3
21
EndModule
Module = " 16 Bytes In/Out" 0xF7
22
EndModule
Module = " 32 Bytes In/Out" 0xFF
23
EndModule
Module = " 64 Bytes In/Out" 0xC0, 0xDF, 0xDF
24
EndModule
Module = "122 Bytes In/Out" 0xC0, 0xFC, 0xFC
25
EndModule
Module = "128 Bytes In/Out" 0xC0, 0xFF, 0xFF
26
EndModule
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 429
Communication
8.5 PROFIBUS
SMB1406 DP Status
SMB1401 Master Address
SMW1402 V memory offset of outputs
SMB1404 Number of bytes of output data
SMB1405 Number of bytes of input data
VD1000 Output Data Pointer
VD1004 Input Data Pointer
S7-200 SMART
430 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.5 PROFIBUS
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 431
Communication
8.6 RS485
8.6 RS485
An RS485 network is a differential (multi-point) network and can have up to 126 addressable
nodes per network and up to 32 devices per segment. Repeaters are used to segment the
network. Repeaters are not addressable nodes; therefore, they are not included in the count
of addressable nodes, but are counted in the devices per segment.
RS485 allows for data transfer at a high speed (from 100 m at 12 Mbit/s to 1 km at 187.5
Kbit/s).
RS485 can operate with the PPI protocol and Freeport:
● PPI protocol: Can operate on RS485 or RS232 (half-duplex). Possible connections
include:
– PPI protocol devices
– RS485 HMI displays
● Freeport: Can operate on RS485 or RS232 (half-duplex). Possible connections include:
– RS485-compatible devices (for example, a bar code scanner)
– Devices that have RS485 interfaces (for example, a control system)
– Third-party devices using Freeport
– Modems
S7-200 SMART
432 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
Definition
PPI is a master-slave protocol: the master devices send requests to the slave devices, and
the slave devices respond. See the following figure. Slave devices do not initiate messages,
but wait until a master sends them a request or polls them for a response.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 433
Communication
8.6 RS485
Baud rate
The speed that data is transmitted across the network is the baud rate, which is typically
measured in units of kilobits (Kbps) or megabits (Mbps). The baud rate measures how much
data can be transmitted within a given amount of time. For example, a baud rate of
19.2 Kbps describes a transmission rate of 19,200 bits per second.
Every device that communicates over a given network must be configured to transmit data at
the same baud rate. Therefore, the fastest baud rate for the network is determined by the
slowest device connected to the network.
The following table lists the baud rates supported by the S7-200 SMART CPU.
Network address
The network address is a unique number that you assign to each device on the network. The
unique network address ensures that the data is transferred to or retrieved from the correct
device. The S7-200 SMART CPU supports network addresses from 0 to 126. The following
table lists the default (factory) settings for the S7-200 SMART devices.
S7-200 SMART
434 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
8.6.2.2 Setting the baud rate and network address for the S7-200 SMART CPU
Introduction
To communicate over the RS485 network with STEP 7-Micro/WIN SMART or SIMATIC HMIs
(Page 377), you must configure the RS485 network address and baud rate for the
S7-200 SMART CPU.
The RS485 port network address must be unique for all devices on the RS485 network, and
the RS485 port baud rate must be the same as the other devices on the RS485 network.
The default RS485 port network address is 2, and the default RS485 port baud rate for each
CPU port is 9.6 Kbps.
The system block of the CPU stores the RS485 port network address and baud rate. After
you select the parameters for the CPU, you must download the system block to the
S7-200 SMART CPU.
Procedure
To access the "System Block" dialog, click one of the following:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 435
Communication
8.6 RS485
After you select the "System Block" dialog, you perform the following steps:
1. Select the network address and baud rate for the RS485 port.
2. Download the system block to the CPU.
Note
Freeport protocol baud rates are set using SM memory.
Introduction
The following network configurations are possible using only S7-200 SMART devices:
● Single-master PPI networks
● Multi-master and multi-slave PPI networks
● Complex PPI networks
S7-200 SMART
436 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
In the sample network, the CPU is a slave that responds to requests from the master.
The HMI devices are masters and must have separate network addresses. The
S7-200 SMART CPU is a slave.
The following figure shows a PPI network with multiple masters communicating with multiple
slaves. In this example, the HMI can request data from any CPU slave.
All devices (masters and slaves) have different network addresses. The
S7-200 SMART CPUs are slaves.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 437
Communication
8.6 RS485
8.6.4.1 Configuring or changing an RS485 address for a CPU or device in your project
You must enter the following information for each S7-200 SMART CPU that is attached to
your RS485 network:
● RS485 address: Each CPU or device must have an RS485 address. The CPU or device
uses this address to deliver data over the network.
● Baud rate: The speed that data is transmitted across the network is the baud rate, which
is typically measured in units of Kbps or Mbps. The baud rate measures how much data
can be transmitted within a given amount of time (for example, a transmission rate of
19.2 Kbps).
① RS485 port
You must configure or change RS485 network information for the onboard RS485 port of a
CPU or device in the "System Block" dialog and download the configuration to the CPU.
S7-200 SMART
438 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
After completing the RS485 network configuration, download the project to the CPU.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 439
Communication
8.6 RS485
All CPUs and devices that have valid RS485 port addresses are displayed in the
"Communications" dialog.
You can access CPUs in one of two ways:
● "Found CPUs": CPUs located on the RS485 network
● "Added CPUs": CPUs on the RS485 network (for example, enter the RS485 network
address of a CPU directly that is on the RS485 network)
For "Found CPUs" (CPUs located on your local network), use the "Communications" dialog
to connect with your CPU:
● Click the "Communication Interface" dropdown list, and select "PC/PPI cable.PPI.1" for
your RS485 network.
● Click the "Find CPUs" button to display all operational CPUs ("Found CPUs") on the
RS485 network. All CPUs default their RS485 network settings to address 2 and
9.6 Kbps.
● Highlight a CPU, and then click "OK".
Note
You can open multiple copies of STEP 7-Micro/WIN SMART on a computer. Be aware that
when you open a second copy of STEP 7-Micro/WIN SMART or use the "Find CPUs" button
in either copy, the communication connection to the CPU in your first/other copy of
STEP 7-Micro/WIN SMART might be disconnected.
S7-200 SMART
440 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
For "Added CPUs" (CPUs on the RS485 network), use the "Communications" dialog to
connect with your CPU:
● Click the "Communication Interface" dropdown list, and select "PC/PPI cable.PPI.1" for
your RS485 network.
● Click the "Add CPU" button, and enter the following access information for a CPU that
you wish to access directly on the RS485 network:
– RS485 network address
– RS485 network baud rate
You can add multiple CPUs on the RS485 network. As always, STEP 7-Micro/WIN
SMART communicates with one CPU at a time. All CPUs default their RS485 network
settings to address 2 and 9.6 Kbps.
● Highlight a CPU, and then click "OK".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 441
Communication
8.6 RS485
S7-200 SMART
442 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
Note
When you press the "Find CPUs" button, the EM DP01 PROFIBUS DP module autobauds
and displays in the "Found CPUs " folder at 9.6 Kbps. If you want to communicate through a
DP01 modules at a higher baud rate, you must press the "Add CPU" button and add the EM
DP01 module using the module's network address and specify a baud rate such as 187.5
Kbps.
You must power cycle the DP01 module to connect at the new baud rate.
NOTICE
Avoiding unwanted current flow
Interconnecting equipment with different reference potentials can cause unwanted currents
to flow through the interconnecting cable.
These unwanted currents can cause communications errors or can damage equipment.
Be sure all equipment that you are about to connect with a communications cable either
shares a common circuit reference or is isolated to prevent unwanted current flows.
8.6.5.2 Determining the distances, transmission rates, and cable lengths for your network
As shown in the following table, the maximum length of a network segment is determined by
two factors: isolation (using an RS485 repeater) and baud rate.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 443
Communication
8.6 RS485
Isolation is required when you connect devices at different ground potentials. Different
ground potentials can exist when grounds are physically separated by a long distance. Even
over short distances, load currents of heavy machinery can cause a difference in ground
potential.
S7-200 SMART
444 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
Specifications Description
Cable type Shielded, twisted pair
Loop resistance ≤115 /km
Effective capacitance 30 pF/m
Nominal impedance Approximately 135 to 160
(frequency = 3MHz to 20 MHz)
Attenuation 0.9 dB/100 m (frequency=200 kHz)
Cross-sectional core area 0.3 mm2 to 0.5 mm2
Cable diameter 8 mm +0.5 mm
Table 8- 17 Pin assignments for the S7-200 SMART CPU integrated RS485 port (Port 0)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 445
Communication
8.6 RS485
The CM01 signal board is RS485-compatible. The following table shows the connector that
provides the physical connection for the signal board and describes the pin assignments.
Table 8- 18 Pin assignments for the S7-200 SMART CM01 Signal Board (SB) port (Port 1)
Pin number Connector Signal CM01 Signal Board (SB) port (Port 1)
1 Ground Chassis ground
2 Tx/B RS232-Tx/RS485-B
3 Request-to- RTS (TTL)
Send
4 M-ground Logic common
5 Rx/A RS232-Rx/RS485-A
6 +5 V DC +5 V, 100 Ω series resistor
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
the use of expansion modules or signal boards.
S7-200 SMART
446 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
Both connectors have two sets of terminal screws to allow you to attach the incoming and
outgoing network cables. Both connectors also have switches to bias and terminate the
network selectively. The following shows typical biasing and termination for the cable
connectors.
Cable must be terminated and biased at both ends. Bare shielding: Approximately 12 mm (1/2 in)
must contact the metal guides of all locations.
Switch position = On: Termination and biased Switch position = Off: No termination or bias
① Pin number
② Network connector
③ Cable shield
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 447
Communication
8.6 RS485
① Terminal name
② Terminal block
③ Cable shield
Introduction
The S7-200 SMART CPU supports many types of RS485 HMI devices from Siemens and
also from other manufacturers. While some of these HMI devices (such as the TD400C) do
not allow you to select the communication protocol used by the device, other devices (such
as the KP and TP product lines) allow you to select the communication protocol for that
device.
Guidelines
If your HMI device allows you to select the communication protocol, consider the following
guideline. For an HMI device connected to the communication port of the CPU, with no other
devices on the network, select the PPI protocol for the HMI device.
For more information about how to configure the HMI device, refer to the specific manual for
your device (see the following table). These manuals are included in the
STEP 7-Micro/WIN SMART documentation CD.
S7-200 SMART
448 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
Introduction
Freeport mode allows your program to control the communication port of the
S7-200 SMART CPU. You can use Freeport mode to implement user-defined
communication protocols to communicate with many types of intelligent devices. Freeport
mode supports both ASCII and binary protocols.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 449
Communication
8.6 RS485
Freeport mode is active only when the CPU is in RUN mode. Setting the CPU to STOP
mode halts all Freeport communication, and the communication port then reverts to the PPI
protocol with the settings which were configured in the system block of the CPU.
Note
Since the compact CRs models (CR20s, CR30s, CR40s and CR60s) have no Ethernet port,
the RS485 port is the programming port. This creates a conflict if the user program is using
the RS485 port for Freeport. While the user program is using the RS485 port for Freeport,
STEP 7-Micro/WIN SMART V2.4 cannot communicate to the the CPU.
Attaching a USB-PPI cable to the CPU's RS485 port forces the CPU to exit Freeport mode
and enable PPI mode. This allows STEP 7-Micro/WIN SMART V2.4 to regain control of the
the CPU.
If you have attached a USB-PPI cable to the CPU's RS485 port, the CPU cannot enable
Freeport. The CPU will not automatically restart Freeport when you remove the USB-PPI
cable.
The CPU utilizes pin 9 of the RS485 connector to detect when you connect a USB-PPI
cable. Only the CRs models perform the check for USB-PPI cables. The ST and SR models
ignore the state of pin 9. Ensure that any cables used for Freeport do not connect to pin 9 for
the CRs models.
S7-200 SMART
450 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.6 RS485
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 451
Communication
8.6 RS485
8.6.6.2 Using the RS232/PPI Multi-Master cable and Freeport mode with RS232 devices
Purpose
You can use the RS232/PPI Multi-Master cable and the Freeport communication functions to
connect the S7-200 SMART CPU to many devices that are compatible with the RS232
standard. The cable must be set to PPI/Freeport mode (switch 5 = 0) for Freeport operation.
Switch 6 selects either Local mode (DCE) (switch 6 = 0), or Remote mode (DTE) (switch
6 = 1). In CRs models only, set switch 7 = 1 to allow Freeport mode.
The RS232/PPI Multi-Master cable is in Transmit mode when data is transmitted from the
RS232 port to the RS485 port. The cable is in Receive mode when it is idle or is transmitting
data from the RS485 port to the RS232 port. The cable changes from Receive to Transmit
mode immediately when it detects characters on the RS232 transmit line.
The CM01 signal board (SB) (S CPUs only) supports both RS232 half-duplex and RS485.
With the CM01 signal board, you can connect an RS232 device directly to the CPU SB
RS232 port without using a RS232/PPI cable.
The cable switches back to Receive mode when the RS232 transmit line is in the idle state
for a period of time defined as the turnaround time of the cable. The baud rate selection of
the cable determines the turnaround time, as shown in the table.
S7-200 SMART
452 System Manual, V2.4, 03/2019, A5E03822230-AG
Communication
8.7 RS232
If you use the RS232/PPI Multi-Master cable in a system which uses Freeport
communications, the program in the S7-200 SMART CPU must comprehend the turnaround
time for the following situations:
● The CPU responds to messages transmitted by the RS232 device.
After the CPU receives a request message from the RS232 device, the CPU must delay
the transmission of a response message for a period of time greater than or equal to the
turnaround time of the cable.
● The RS232 device responds to messages transmitted from the CPU.
After the CPU receives a response message from the RS232 device, the CPU must delay
the transmission of the next request message for a period of time greater than or equal to
the turnaround time of the cable.
In both situations, the delay allows the RS232/PPI Multi-Master cable sufficient time to
switch from Transmit mode to Receive mode so that data can be transmitted from the RS485
port to the RS232 port.
8.7 RS232
An RS232 network is a point-to-point connection between two devices. RS232 allows for
data transfer at relatively slow speeds (up to 115.2 Kbps) and short distances (up to 50 feet).
Possible RS232 connections include the following:
● Freeport
● Modems
● RS232-compatible devices (for example, a bar code scanner)
● Devices that have RS232 interfaces (for example, a control system)
● RS232 displays
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 453
Libraries 9
9.1 Library types (Siemens and user-defined)
Library types
Siemens provides two types of libraries with the installation of STEP 7-Micro/WIN SMART:
● Siemens-supplied (Modbus RTU (Page 459), Modbus TCP (Page 478), Open User
Communication (Page 495),PN Read Write Record library (Page 536), SINAMICS Library
(Page 556) and USS protocol (Page 539))
● User-defined (Page 609) (libraries that you create from project POUs or obtain from other
sources)
Note
You must start STEP 7-Micro/WIN SMART with a "Run as administrator" command to
create a user-defined library.
Note
You cannot give a user-defined library the same name as a Siemens-supplied library.
Note
Only call the library functions from either the main program or from interrupt routines, but not
both.
Modbus RTU
STEP 7-Micro/WIN SMART makes communicating to Modbus devices easier by including
pre-configured subroutines and interrupt routines for Modbus communication through the
serial ports of the CPUs. With the Modbus RTU instructions, you can configure the S7-
200 SMART to act as a Modbus RTU master or slave device.
You can find these instructions in the Libraries folder of the Instructions folder in the project
tree (Page 100). When you put a Modbus RTU library instruction in your program,
STEP 7-Micro/WIN SMART automatically puts one or more associated subroutines and
interrupt routines in your project.
Modbus TCP
STEP 7-Micro/WIN SMART makes communicating to Modbus devices easier by including
preconfigured subroutines that are specifically designed for Modbus communication over
Industrial Ethernet. With the Modbus TCP protocol instructions, you can configure the S7-
200 SMART to act as a Modbus TCP client or server device.
S7-200 SMART
454 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.1 Library types (Siemens and user-defined)
You can find these instructions in the Libraries folder of the Instructions folder in the project
tree (Page 100). When you put a Modbus TCP library instruction in your program, STEP
7-Micro/WIN SMART automatically puts one or more associated subroutines in your project.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
SINAMICS library
STEP 7-Micro/WIN SMART makes controlling the drive easier by including pre-configured
subroutines that are specifically designed for the SINAMICS library. With the SINAMICS
instructions, you can control the position and speed of a physical drive, and read or modify
the drive parameters.
You can find these instructions in the Libraries folder of the Instructions folder in the project
tree (Page 100). When you put a SINAMICS library instruction in your program, STEP
7-Micro/WIN SMART automatically puts one or more associated subroutines in your project.
USS protocol
The USS protocol library supports Siemens drives. The STEP 7-Micro/WIN SMART USS
instruction libraries make controlling drives easier by including preconfigured subroutines
and interrupt routines that are specifically designed for using the USS protocol to
communicate with the drive. With the USS instructions, you can control the physical drive
and the read/write drive parameters.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 455
Libraries
9.2 Overview of Modbus communication
You can find these instructions in the Libraries folder of the Instructions folder in the project
tree (Page 100). When you put a USS library instruction in your program,
STEP 7-Micro/WIN SMART automatically puts one or more associated subroutines in your
project
WARNING
Security: Protecting networks against physical access and possible reads and writes of
PLC data
Communication through Modbus RTU, Open User Communication, and USS Protocol
library instructions have no security features. If an attacker can physically access your
networks through one of these forms of communication, the attacker can possibly read and
write PLC data. Unauthorized access to PLC data can result in death or severe personal
injury.
You must protect these forms of communication by limiting physical access. For security
information and recommendations, refer to the following document: Operational Guidelines
for Industrial Security (http://www.industry.siemens.com/topics/global/en/industrial-
security/Documents/operational_guidelines_industrial_security_en.pdf)
S7-200 SMART
456 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.2 Overview of Modbus communication
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 457
Libraries
9.2 Overview of Modbus communication
Note
1CPU 2.4 supports the updated memory address: Q128.0 - Q1151.7, and I128.0 - I1151.7.
For the detailed information, refer to Memory ranges and features (Page 867).
See also
MBUS_MSG / MB_MSG2 instruction (Page 465)
S7-200 SMART
458 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 459
Libraries
9.3 Modbus RTU library
Open the Libraries folder in the Instruction folder of the project tree for access to the Modbus
instructions. When you place a Modbus instruction in your program, STEP 7-Micro/WIN
SMART places one or more associated POUs in your project.
Note
Only call the library functions from either the main program or from interrupt routines, but not
both.
Note
For the compact CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s, do
not connect pin 9 of the RS485 cable used for Modbus RTU communication. The CRs CPU
uses pin 9 to disable Freeport mode.
Note
To change the CPU communication port from Modbus back to PPI so that you can
communicate with an HMI device, set the mode parameter of the MBUS_CTRL /
MB_CTRL2 instruction to a zero (0).
S7-200 SMART
460 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
Note
To change the CPU communication port from Modbus back to PPI so that you can
communicate with an HMI device, set the mode parameter of the MBUS_INIT
instruction to a zero (0).
Execution of the MBUS_MSG / MB_MSG2 instruction extends the scan time, especially in
calculating the Modbus CRC for the request and response. The CRC (Cyclic Redundancy
Check) ensures the integrity of the communications message. Each word in request and
in the response extends the PLC scan time by about 86 microseconds. A maximum
request/response (read or write of 120 words) extends the scan time to approximately
10.3 milliseconds. A read request extends the scan mainly when the program is receiving
a response from a slave, and to a lesser extent when sending the request. A write
request extends the scan mainly when sending data to a slave, and to a lesser extent
when receiving a response.
● Modbus RTU slave protocol: Modbus communication uses a CRC (cyclic redundancy
check) to ensure the integrity of the communications messages. The Modbus slave
protocol uses a table of pre-calculated values to decrease the time required to process a
message. The initialization of this CRC table requires about 11.3 milliseconds. The
MBUS_INIT instruction performs this initialization, which normally happens during the first
scan after entering RUN mode. You are responsible for resetting the watchdog timer if
the time required by the MBUS_INIT instruction and any other user initialization exceeds
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 461
Libraries
9.3 Modbus RTU library
the 500 millisecond scan watchdog time. Writing to the outputs of the module resets the
output module watchdog timer.
MBUS_SLAVE extends the scan time when it services a request. Calculating the Modbus
CRC extends the scan time by about 40 microseconds for every byte in the request and
in the response. A maximum request/response (read or write of 120 words) extends the
scan time by approximately 4.8 milliseconds.
Procedure
To use the Modbus RTU master instructions in your S7-200 SMART program, follow these
steps:
1. Insert the MBUS_CTRL / MB_CTRL2 instruction in your program and execute it on every
scan. You can use the MBUS_CTRL / MB_CTRL2 instruction either to initiate or to
change the Modbus communications parameters. When you insert the MBUS_CTRL /
MB_CTRL2 instruction, STEP 7-Micro/WIN SMART adds several protected subroutines
and interrupt routines to your program.
2. Click the Memory button from the Libraries area of the File menu ribbon strip to
assign a starting address for the V-Memory that the Modbus library requires.
Alternatively, you can right-click the Program Block node in the project tree and select
"Library Memory" from the context menu.
S7-200 SMART
462 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
3. Place one or more MBUS_MSG / MB_MSG2 instructions in your program. You can add
as many MBUS_MSG / MB_MSG2 instructions to your program as you require, but only
one of these instructions can be active at a time.
4. Connect a communications cable between the S7-200 SMART CPU port you assigned
with the MBUS_CTRL / MB_CTRL2 port parameter and the Modbus slave device.
NOTICE
Avoiding unwanted current flow
Interconnecting equipment with different reference potentials can cause unwanted
currents to flow through the interconnecting cable. These unwanted currents can cause
communications errors or damage equipment.
Ensure that you connect all equipment that with a communications cable that either
shares a common circuit reference or is isolated to prevent unwanted current flows.
The program must call the MBUS_CTRL / MB_CTRL2 instruction every scan (including the
first scan) to allow it to monitor the progress of any outstanding messages initiated with the
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 463
Libraries
9.3 Modbus RTU library
MBUS_MSG / MB_MSG2 instruction. The Modbus master protocol does not operate
correctly unless the program executes MBUS_CTRL / MB_CTRL2 every scan.
The value for the Mode input selects the communications protocol. An input value of 1
assigns the CPU port to Modbus protocol and enables the protocol. An input value of 0
assigns the CPU port to PPI system protocol and disables Modbus protocol.
Parameter Parity is set to match the parity of the Modbus slave device. All settings use one
start bit and one stop bit. The allowed values are: 0 (no parity). 1 (odd parity), and 2 (even
parity).
Parameter Port sets the physical communication port (0 = RS-485 integrated in CPU, 1 =
RS-485 or RS-232 located on the optional CM01 signal board).
Parameter Timeout is set to the number of milliseconds to wait for the response from the
slave. The Timeout value can be set anywhere in the range of 1 millisecond to 32767
milliseconds. A typical value would be 1000 milliseconds (1 second). The Timeout parameter
should be set to a value large enough so that the slave device has time to respond at the
selected baud rate.
The Timeout parameter is used to determine if the Modbus slave device is responding to a
request. The Timeout value determines how long the Modbus Master will wait for the first
character of the response after the last character of the request has been sent. The Modbus
master will receive the entire response from the Modbus slave device if at least one
character of the response is received within the Timeout time.
When the MBUS_CTRL / MB_CTRL2 instruction completes, the instruction returns TRUE for
the Done output.
The Error output contains the result of executing the instruction.
See also Modbus RTU master execution error codes (Page 468)
S7-200 SMART
464 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
The MBUS_MSG / MB_MSG2 instruction initiates a master request to a Modbus slave when
both the EN input and the First inputs are ON. Sending the request, waiting for the response,
and processing the response usually requires several PLC scan times. The EN input must
be ON to enable the send request, and must remain ON until the instruction returns ON
(True) for the Done bit.
Only one each of MBUS_MSG or MB_MSG2 instruction can be active at a time. If the
program enables more than one MBUS_MSG instruction or more than one MB_MSG2
instruction, then the CPU processes the first MBUS_MSG instruction or MB_MSG2
instruction and all subsequent MBUS_MSG or MB_MSG2 instructions will abort with an error
code 6.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 465
Libraries
9.3 Modbus RTU library
Set parameter First ON for only one scan when there is a new request to send. Pulse the
First input through an edge detection element (for example, Positive Edge), which causes
the program to transmit the request one time. See the example program (Page 474) for
details.
Parameter Slave is the address of the Modbus slave device. The allowed range is 0 through
247. Address 0 is the broadcast address. Use address 0 only for write requests. There is no
response to a broadcast request to address 0. Not all slave devices support the broadcast
address. The S7-200 SMART Modbus slave library does not support the broadcast address.
Use parameter RW to indicate whether this message is to be a read or a write: 0 (Read) and
1 (Write).
Discrete outputs (coils) and holding registers support both read and write requests. Discrete
inputs (contacts) and input registers only support read requests.
Parameter Addr is the starting Modbus address. S7-200 SMART supports the following
ranges of addresses:
● 00001 to 09999 for discrete outputs (coils)
● 10001 to 19999 for discrete inputs (contacts)
● 30001 to 39999 for input registers
● 40001 to 49999 and 400001 to 465535 for holding registers
The addresses that the Modbus slave device supports determine the actual range of values
for Addr.
Parameter Count assigns the number of data elements to read or write in this request. The
Count is the number of bits for the bit data types, and the number of words for the word data
types.
● Address 0xxxx Count is the number of bits to read or write
● Address 1xxxx Count is the number of bits to read
● Address 3xxxx Count is the number of input register words to read
● Address 4xxxx or 4yyyyy Count is the number of holding register words to read or write
The MBUS_MSG / MB_MSG2 instruction reads or writes a maximum of 120 words or 1920
bits (240 bytes of data). The actual limit on the value of Count depends on the limits in the
Modbus slave device.
The parameter DataPtr is an indirect address pointer that points to the V memory in the CPU
for the data associated with the read or write request. For a read request, set the DataPtr to
the first CPU memory location used to store the data read from the Modbus slave. For a
write request, set DataPtr to point to the first CPU memory location of the data to be sent to
the Modbus slave.
The program passes the DataPtr value to MBUS_MSG / MB_MSG2 as an indirect address
pointer. For example, if the data to be written to a Modbus slave device starts at address
S7-200 SMART
466 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
VW200 in the CPU, the value for the DataPtr would be &VB200 (address of VB200).
Pointers must always be a type VB even if they point to word data.
Memory layout
Holding registers (address 4xxxx or 4yyyyy) and input registers (address 3xxxx) are word
values (2 bytes or 16 bits). CPU words are formatted the same as Modbus registers. The
lower numbered V memory address is the most significant byte of the register. The higher
numbered V memory address is the least significant byte of the register. The table below
shows how the CPU byte and word addressing corresponds to the Modbus register format.
CPU memory byte address CPU memory word address Modbus holding register address
Address Hex data Address Hex data Address Hex data
VB200 12 VW200 12 34 40001 12 34
VB201 34
VB202 56 VW202 56 78 40002 56 78
VB203 78
VB204 9A VW204 9A BC 40003 9A BC
VB205 BC
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 467
Libraries
9.3 Modbus RTU library
Outputs
The Done output is FALSE after the program has sent a request and is receiving a response.
The Done output is TRUE when the response is complete or when the MBUS_MSG /
MB_MSG2 instruction aborts because of an error.
The Error output (Page 468) is valid only when the Done output is TRUE.
MBUS_CTRL Description
error code
0 No error
1 Invalid parity type
2 Invalid baud rate
3 Invalid timeout
4 Invalid mode
9 Invalid port number
10 Signal board port 1 missing or not configured
MBUS_MSG Description
error code
0 No error
1 Parity error in response: This is only possible if even or odd parity is used. The
transmission was disturbed and possibly incorrect data was received. This error is
usually caused by an electrical problem such as incorrect wiring or electrical noise
affecting the communication.
2 Not used
3 Receive timeout: There was no response from the slave within the Timeout time.
Some possible causes are bad electrical connections to the slave device, master and
slave are set to a different baud rate / parity setting, and incorrect slave address.
4 Error in request parameter: One or more of the input parameters (Slave, RW, Addr,
or Count) is set to an illegal value. Check the documentation for allowed values for
the input parameters.
5 Modbus master not enabled: Call MBUS_CTRL on every scan prior to calling
MBUS_MSG.
S7-200 SMART
468 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
MBUS_MSG Description
error code
6 Modbus is busy with another request: Only one MBUS_MSG instruction can be ac-
tive at a time.
7 Error in response: The response received does not correspond to the request. This
indicates some problem in the slave device or that the wrong slave device answered
the request.
8 CRC error in response: The transmission was disturbed and possibly incorrect data
was received. This error is usually caused by an electrical problem such as incorrect
wiring or electrical noise affecting the communication.
11 Invalid port number
12 Signal board port 1 missing or not configured
101 Slave does not support the requested function at this address: See the required
Modbus slave function support table in the "Using the Modbus master Instructions"
help topic.
102 Slave does not support the data address: The requested address range of Addr plus
Count is outside the allowed address range of the slave.
103 Slave does not support the data type: The Addr type is not supported by the slave
device.
104 Slave device failure
105 Slave accepted the message but the response is delayed: This is an error for
MBUS_MSG and the user program should resend the request at a later time.
106 Slave is busy and rejected the message: You can try the same request again to get a
response.
107 Slave rejected the message for an unknown reason.
108 Slave memory parity error: There is an error in the slave device.
Procedure
To use the Modbus slave instructions in your S7-200 SMART program, follow these steps:
1. Insert the MBUS_INIT instruction in your program and execute the MBUS_INIT instruction
for one scan only. You can use the MBUS_INIT instruction either to initiate or to change
the communications parameters. When you insert the MBUS_INIT instruction, several
hidden subroutines and interrupt routines are automatically added to your program.
2. Click the Memory button from the Libraries area of the File menu ribbon strip to
assign a starting address for the V memory that the Modbus library requires. Alternatively,
you can right-click the Program Block node in the project tree and select "Library
Memory" from the context menu. In addition to this V memory block, you define another V
memory block with the HoldStart and MaxHold parameters of MBUS_INIT. Be careful that
your program assignments in V memory do not overlap. If there is any overlap of the
memory areas, the MBUS_INIT instruction returns an error.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 469
Libraries
9.3 Modbus RTU library
3. Place only one MBUS_SLAVE instruction in your program. This instruction should be
called every scan to service any requests that have been received.
4. Connect a communications cable between the S7-200 SMART CPU port you assigned
with the MBUS_INIT port parameter and the Modbus master device.
NOTICE
Avoiding unwanted current flow
Interconnecting equipment with different reference potentials can cause unwanted
currents to flow through the interconnecting cable. These unwanted currents can cause
communications errors or damage equipment.
Ensure that all equipment that is connected with a communications cable either shares
a common circuit reference or is isolated to prevent unwanted current flows.
The accumulators (AC0, AC1, AC2, AC3) are used by the Modbus slave instructions and
appear in the Cross Reference listing. Prior to execution, the values in the accumulators of a
Modbus slave instruction are saved and restored to the accumulators before the Modbus
slave instruction is complete, ensuring that all user data in the accumulators is preserved
while executing a Modbus slave instruction.
The Modbus slave instructions support the Modbus RTU protocol. These instructions use the
Freeport feature of the S7-200 SMART CPU to support the most common Modbus functions.
The following Modbus functions are supported:
Function Description
1 Read single/multiple coil (discrete output) status. Function 1 returns the on/off status of
any number of output points (Qs).
2 Read single/multiple contact (discrete input) status. Function 2 returns the on/off status
of any number of input points (Is).
3 Read single/multiple holding registers. Function 3 returns the contents of V memory.
Holding registers are word values under Modbus and allow you to read up to 120 words
in one request.
4 Read single/multiple input registers. Function 4 returns analog Input values.
5 Write single coil (discrete output). Function 5 sets a discrete output point to the specified
value. The point is not forced and the program can overwrite the value written by the
Modbus request.
6 Write single holding register. Function 6 writes a single holding register value to the V
memory of the S7-200 SMART.
15 Write multiple coils (discrete outputs). Function 15 writes the discrete output values to
the Q image register of the S7-200 SMART. The starting output point must begin on a
byte boundary (for example, Q0.0 or Q2.0) and the number of outputs written must be a
multiple of eight. This is a restriction for the Modbus slave protocol instructions. The
points are not forced and the program can overwrite the values written by the Modbus
request.
16 Write multiple holding registers. Function 16 writes multiple holding registers to the V
memory of the S7-200 SMART. There can be up to 120 words written in one request.
S7-200 SMART
470 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
The program must execute MBUS_INIT instruction exactly once for each change in
communications state. Therefore, pulse the EN input through an edge detection element, or
execute MBUS_INIT only on the first scan.
The value for the Mode input selects the communications protocol: an input value of 1
assigns Modbus protocol and enables the protocol, and an input value of 0 PPI protocol and
disables Modbus protocol.
Parameter Addr sets the address at inclusive values between 1 and 247.
Parameter Baud sets the baud rate at 1200, 2400, 4800, 9600, 19200, 38400, 57600, or
115200.
Parameter Parity is set to match the parity of the Modbus master. All settings use one stop
bit. The accepted values are: 0 (no parity), 1 (odd parity), and 2 (even parity).
Parameter Port sets the physical communication port (0 = RS-485 integrated in CPU, 1 =
RS-485 or RS-232 located on an optional signal board).
Parameter Delay extends the standard Modbus end-of-message timeout condition by adding
the assigned number of milliseconds to the standard Modbus message timeout. The typical
value for this parameter should be 0 when operating on a wired network. If you are using
modems with error correction, set the delay to a value of 50 to 100 milliseconds. If you are
using spread spectrum radios, set the delay to a value of 10 to 100 milliseconds. The Delay
value can be 0 to 32767 milliseconds.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 471
Libraries
9.3 Modbus RTU library
Parameter MaxIQ sets the number of I and Q points available to Modbus addresses 0xxxx
and 1xxxx at values of 0 to 256. A value of 0 disables all reads and writes to the inputs and
outputs. The suggested value for MaxIQ is 256.
Parameter MaxAI sets the number of word input (AI) registers available to Modbus address
3xxxx at values of 0 to 56. A value of 0 disables reads of the analog inputs. The suggested
value for MaxAI to allow access to all of the CPU analog inputs, is as follows:
● 0 for CPUs CR20s, CR30s, CR40s, and CR60s
● 56 for all other CPU models
Parameter MaxHold sets the number of word holding registers in V memory available to
Modbus address 4xxxx or 4yyyyy. For example, if you want to allow Modbus master access
for 2000 bytes of V memory, set MaxHold to a value of 1000 words (holding registers).
Parameter HoldStart is the address of the start of the holding registers in V memory. This
value is generally set to VB0, so the parameter HoldStart is set to &VB0 (address of VB0).
Other V memory addresses can be specified as the starting address for the holding registers
to allow VB0 to be used elsewhere in the project. The Modbus master has access to
MaxHold number of words of V memory starting at HoldStart.
When the MBUS_INIT instruction completes, the Done output is turned ON.
The Error output (Page 473) byte contains the result of executing the instruction. This output
is only valid if Done is ON. If Done is OFF, the error parameter is not changed.
The Done output is ON when the MBUS_SLAVE instruction responds to a Modbus request.
The Done output is OFF, if there was no request serviced.
S7-200 SMART
472 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
The Error output (Page 473) contains the result of executing the instruction. This output is
only valid if Done is ON. If Done is OFF, the error parameter is not changed.
LAD STL
Initialize the Modbus Slave protocol on Network 1
the first scan. Set the slave address to LD SM0.1
1, set port 0 to 9600 baud with even CALL MBUS_INIT, 1, 1, 9600,
parity, all access to all I, Q and AI val- 2, 0, 128, 32, 1000, &VB0,
ues, allow access to 1000 holding reg- M0.1, MB1
isters (2000 bytes) starting at VB0.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 473
Libraries
9.3 Modbus RTU library
The following program turns on outputs Q0.1 and Q0.2 if the MBUS_MSG instruction returns
an error.
LAD Description
Network 1
Initialize and monitor the Modbus master by calling
MBUS_CTRL on every scan. The Modbus master is set for
9.6 Kbps and no parity. The slave device is allowed 1000
milliseconds (1 second) to respond.
Network 2
On the first scan, reset the enable flags (M2.0 and M2.1)
used for the two MBUS_MSG instructions.
S7-200 SMART
474 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
LAD Description
Network 3
When I0.0 changes from OFF to ON, set the enable flag for
the first MBUS_MSG instruction (M2.0).
Network 4
Call the MBUS_MSG instruction when the first enable flag
(M2.0) is ON. The First parameter must be set for only the
first scan that the instruction is enabled.
This instruction writes (RW = 1) 4 holding registers to
slave 2. The write data is taken from VB100-VB107
(4 words) in the CPU and written to address 40001 - 40004
in the Modbus slave.
Network 5
When the first MBUS_MSG instruction is complete
(Done goes from 0 to 1), clear the enable for the first
MBUS_MSG and set the enable for the second
MBUS_MSG instruction.
If Error (MB1) is not zero, then set Q0.1 to show the error.
Network 6
Call the second MBUS_MSG instruction when the second
enable flag (M2.1) is ON. The First parameter must be set
for only the first scan that the instruction is enabled.
This instruction reads (RW = 0) 4 holding registers from
slave 2. The data is read from address 40010 - 40013 in the
Modbus slave and copied to VB200 - VB207 (4 words) in
the CPU.
Network 7
When the second MBUS_MSG instruction is complete
(Done goes from 0 to 1), clear the enable for the second
MBUS_MSG instruction.
If Error (MB1) is not zero, then set Q0.2 to show the error.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 475
Libraries
9.3 Modbus RTU library
Overview
This topic contains information for advanced users of the Modbus RTU master library. Most
users do not need this information and will not need to modify the default operation of the
Modbus RTU master library.
Retries
The Modbus master instructions automatically resend the request to the slave device if one
of the following errors is detected:
● There is no response within the response timeout time (parameter Timeout on the
MBUS_CTRL / MB_CTRL2) instruction (Error code 3).
● The time between characters of the response exceeded the allowed value (Error code 3).
● There is a parity error in the response from the slave (Error code 1).
● There is a CRC error in the response from the slave (Error code 8).
● The returned function did not match the request (Error code 7).
The Modbus Master resends the request two additional times before setting the Done and
Error output parameters.
You can change the number of retries by finding the symbol mModbusRetries in the Modbus
master symbol table and changing this value after the program executes MBUS_CTRL /
MB_CTRL2. The mModbusRetries value is a BYTE with a range of 0 to 255 retries.
Inter-character timeout
Modbus master execution aborts a response from a slave device if the time between
characters in the response exceeds an assigned time limit. The default time is set to 100
milliseconds which should allow the Modbus master instructions to work with most slave
devices over wire or telephone modems. If the CPU detects this error, the MBUS CTRL /
MB_CTRL2 instruction returns error code 3 in the Error parameter.
Communication might possibly require a longer time between characters, either because of
the transmission medium (for example, telephone modem) or because the slave device itself
requires more time. You can lengthen this timeout by finding the symbol
mModbusCharTimeout in the Modbus master symbol table and changing this value after
MBUS_CTRL / MB_CTRL2 has been executed. The mModbusCharTimeout value is an INT
with a range of 1 to 30000 milliseconds.
S7-200 SMART
476 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.3 Modbus RTU library
The Modbus master protocol allows you to force the MBUS_MSG / MB_MSG2 instruction to
use the multiple bit/word Modbus functions instead of the single bit/word Modbus functions.
You can force the multiple bit/word instructions by finding the symbol mModbusForceMulti in
the Modbus master symbol table and changing this value after the program executes
MBUS_CTRL / MB_CTRL2. Set mModbusForceMulti to TRUE to force the use of the
multiple bit/word functions when writing a single bit or register.
Accumulator usage
The Modbus master instructions use accumulators (AC0, AC1, AC2, AC3), which appear in
the Cross Reference listing. The Modbus master instructions save and restore the values in
the accumulators. All CPU preserves all user data in the accumulators while executing the
instructions.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 477
Libraries
9.4 Modbus TCP library
STEP 7-Micro/WIN SMART provides two Modbus TCP library instructions, which are
available from the Libraries folder of the Instructions folder in the STEP 7-Micro/WIN SMART
project tree:
● MBUS_CLIENT (Page 480)
● MBUS_SERVER (Page 484)
S7-200 SMART
478 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 479
Libraries
9.4 Modbus TCP library
The program execution cycle must call MBUS_CLIENT every scan until the Done output is
TRUE. In each cycle, MBUS_CLIENT exits so that the program can continue to run.
MBUS_CLIENT sets Done to TRUE when the client completes the request.
S7-200 SMART
480 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 481
Libraries
9.4 Modbus TCP library
Establishing a connection
When the Connect input is TRUE, the client attempts to establish a connection with the
server device at the provided IP address and IP Port. If the server device is unreachable, the
connection request eventually times out, which can take several seconds. While a
connection request is in progress, no other operation can interrupt or abort it. If the server is
unavailable, it immediately refuses the client's connection request. If the server is available,
the client establishes a connection and can send a request to the server. The
MBUS_CLIENT instruction returns an error if there are no connections resources available
for the Modbus client.
Processing a request
The client only processes requests when Connect = TRUE. Once the client has established
a connection with the server, the program makes a new request by calling MBUS_CLIENT
with Req = TRUE when no Modbus request is active. When the Modbus client executes the
request, it captures all of the input values. Pulse the Req input through an edge detection
element (for example, Positive Edge), which causes the instruction to transmit the request
one time. Any subsequent changes to the input values while the request is active result in
MBUS_CLIENT returning an error code.
S7-200 SMART
482 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
Once the client has sent a request to the server, the client waits for a response up to the
mReceiveTimeout period of time. While the client is waiting for a response, it is not available
for other Modbus operations. If the client does not receive a response within the
mReceiveTimeout period of time, MBUS_CLIENT returns an error.
If the client receives a valid response from the server, it processes any further actions
depending on the response. The client then returns to a ready state and is available for
additional requests from the program.
Error Description
(decimal)
0 No error
32 Unknown state
Check network connections and check that the program is not modifying any library symbols that intefere with
client/server communication.
33 Connection is busy with another request. A single connection can only service one Modbus request at a time.
34 Addr input is an illegal value.
35 Count input is an illegal value.
36 RW input is an illegal value.
37 Transaction ID of the request does not match the response from the server. This error indicates some problem
in the server device or that the wrong server device answered the request.
Received an invalid protocol ID from the server.
38 Received an invalid protocol ID from the server.
39 Number of bytes that the server sent does not match "Count" input value
40 Unit identifier of the request does not match the response from the server
41 Function code of the request does not match the response from the server
42 The data that the server sent does not match the data that a Modbus TCP write function requested
43 Receive timeout: The server did not respond within the mReceiveTimeout time. Check the connection to the
Modbus server device.
44 The input values do not match the values for the active request.
In addition to the MBUS_CLIENT errors listed above, refer also to the Modbus TCP general
exception codes (Page 494) and Open User Communication error codes (Page 517)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 483
Libraries
9.4 Modbus TCP library
Execute the MBUS_SERVER instruction in every scan in order for the Modbus server to
respond to requests from Modbus clients in a reasonable amount of time. The
MBUS_SERVER instruction handles establishing connections, receiving requests, and
sending responses. The Modbus server cannot operate correctly unless the program calls
MBUS_SERVER on every scan.
S7-200 SMART
484 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
Opening a connection
When Connect = TRUE, the CPU uses a single passive connection resource from the Open
User Communications available connections. Leave the Connect input TRUE while the
program is expecting Modbus operations. You can set Connect to FALSE to free up a
connection resource. The CPU captures the values of the input parameters when the
Modbus server requests a connection. If the input values change while Connect = TRUE,
MBUS_SERVER returns an error.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 485
Libraries
9.4 Modbus TCP library
Error Description
(decimal)
0 No error
32 Unknown state
Check network connections and check that the program is not modifying any library symbols that intefere with
client/server communication.
33 Invalid value for input MaxIQ
34 Invalid value for input MaxAI
35 Invalid value for input MaxHold
36 HoldStart input is not in V memory or the range of holding registers exceeds the V memory range
37 Holding registers overlap Modbus server symbols
38 The input values do not match the values for the current connection. Reset the connection to update the input
values.
In addition to the MBUS_SERVER errors listed above, refer also to the Modbus TCP general
exception codes (Page 494) and Open User Communication error codes (Page 517)
S7-200 SMART
486 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
When CPU Input 0 transitions to TRUE, a sequence starts in which the Modbus client sends
write and read requests to both Modbus servers CPU Input 0 set False turns off the
sequence.
LAD Description
Network 1:
On startup, clear all the
flags and errors.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 487
Libraries
9.4 Modbus TCP library
LAD Description
Network 2:
When both clients complete
the Modbus requests, start
the next Modbus request.
S7-200 SMART
488 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
LAD Description
Network 3
Network 4:
CPU_Input 0 rising edge
triggers the Modbus re-
quest sequence to begin
Write some data in
Vmemory to send to the
Modbus servers.
Set the Req input bit
TRUE.
When the CPU_Input 0 is
False, stop sending Mod-
bus requests.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 489
Libraries
9.4 Modbus TCP library
LAD Description
Network 5:
Set the Read/Write mode
and the address for the
selected Modbus function.
Write Ouputs = Function
Code 5 (signle)/ 15 (multi-
ple).
Read Outputs = Function
Code 1.
Write Holding Registers =
Function Code 6 (signle) /
16 (multiple).
Read Holding Registers =
Function Code 3.
Network 6:
Modbus client 01 estab-
lishes a connection with
Modbus server 01.
When Req is TRUE, send a
Modbus Request to the
server.
Once the Modbus Client
receives and processes the
response from the server,
the MBUS_CLIENT instruc-
tion sets the Done output to
TRUE.
S7-200 SMART
490 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
LAD Description
Network 7:
Modbus client 02 estab-
lishes a connection with
Modbus server 02.
When Req is TRUE, send a
Modbus Request to the
server.
Once the Modbus Client
receives and processes the
response from the server,
the MBUS_CLIENT instruc-
tion sets the Done output to
TRUE.
Overview
This topic contains information for advanced users of the Modbus TCP library. Most users do
not need this information and will not need to modify the default operation of the Modbus
TCP library.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 491
Libraries
9.4 Modbus TCP library
MBUS_CLIENT variables
The table below shows some Modbus client variables that you can modify in your program to
adjust the operation of the Modbus client if the default value is not suitable for your
application:
Retries
The Modbus client instruction automatically restarts the connection and resends the request
to the server device if there is a connection-related error:
The Modbus client resends the request two additional times before setting the Done and
Error output parameters.
You can change the number of retries by finding the symbol mModbusRetries in the Modbus
client symbol table and changing the value before the program executes MBUS_CLIENT.
The mRetries value is a BYTE with a range of 0 to 255 retries.
S7-200 SMART
492 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.4 Modbus TCP library
MBUS_SERVER variables
The table below shows some Modbus server variables that you can modify in your program
to adjust the operation of the Modbus server if the default value is not suitable for your
application:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 493
Libraries
9.4 Modbus TCP library
Error # Description
1 Modbus Exception (code 0x01): Illegal Function - Server does not support requested function
2 Modbus Exception (code 0x02): Illegal Data Address - The requested address range of Addr plus
Count is outside the allowed address range of the Server
3 Modbus Exception (code 0x03): Illegal Data Value - There is an error in the Modbus protocol received
by the Server
4 Modbus Exception (code 0x04): Server Device Failure - An unrecoverable error occurred while the
Server was attempting to perform the requested action
5 Modbus Exception (code 0x05): Acknowledge - Response from Server may be delayed; resend the
request at a later time
6 Modbus Exception (code 0x06): Server Device Busy - Server rejected the message; resend request
7 Modbus Exception (code 0x07): Negative Acknowledgement - Server rejected the message for an
unknown reason
10 Modbus Exception (code 0x0A): Gateway Path Unavailable - Usually means that the gateway is mis-
configured or overloaded. (Modbus TCP only)
11 Modbus Exception (code 0x0B): Gateway Target Device Failed to Respond - Usually means that the
device is not present on the network. (Modbus TCP only)
S7-200 SMART
494 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 495
Libraries
9.5 Open user communication library
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
Note
Only call the library functions from either the main program or from interrupt routines, but not
both.
S7-200 SMART
496 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
connection must have a unique ConnID. The program uses the ConnID to specify the
desired connection for subsequent send, receive, and disconnect operations.
● IPaddr1, IPaddr2, IPaddr3 and IPaddr4: These are the four IP address octets of the
remote device. IPaddr1 is the most significant byte of the IP address, and IPaddr4 is the
least significant byte of the IP address. For example: For the IP address 192.168.2.15,
set these values:
– IPaddr1 = 192
– IPaddr2 = 168
– IPaddr3 = 2
– IPaddr4 = 15
The IP address cannot be any of the following values:
– 0.0.0.0 (for an active connection)
– Any broadcast IP address (for example, 255.255.255.255)
– Any multicast address
– The IP address of the local CPU
You can use the IP address of 0.0.0.0 for a passive connection. By selecting the IP
address of 0.0.0.0, the S7-200 SMART CPU accepts a connection from any remote IP
address. Selecting a non-zero IP address for a passive connection causes the CPU to
only accept a connection from the specified address.
● RemPort: The RemPort is the port number on the remote device. You use port numbers
for TCP and UDP protocols to route the message within the device.
The rules for remote port numbers are as follows:
– The valid port number range is 1 to 49151.
– The suggested range for port numbers is 2000 to 5000.
– The CPU ignores the remote port number for passive connections (You can set it to
zero).
● LocPort: The LocPort parameter is the port number on the local CPU. You use port
numbers for TCP and UDP protocols to route the message within the device. The local
port number must be unique for all passive connections.
The rules for local port numbers are as follows:
– The valid port number range is 1 to 49151.
– You cannot use port numbers 20, 21, 25, 80, 102, 135, 161, 162, 443, and 34962 to
34964. These ports have specific assignments.
– The suggested range for port numbers is 2000 to 5000.
– The local port numbers must be unique for passive connections (no duplicates).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 497
Libraries
9.5 Open user communication library
● RemTsap: The RemTsap (remote Transport Service Access Point (TSAP)) parameter is
a pointer to an S7-200 SMART string data type. You can only use the RemTsap
parameter for the ISO-on-TCP protocol. The remote TSAP string serves the same
purpose as a port number in routing the message to the proper connection.
The rules for the RemTsap are as follows:
– The TSAP is an S7-200 SMART string data type (a length byte followed by the
characters).
– The TSAP string must be at least 2 characters and no more than 16 characters.
● LocTsap: The LocTsap (local Transport Service Access Point (TSAP)) parameter is a
pointer to an S7-200 SMART string data type. You can only use the local TSAP
parameter for the ISO-on-TCP protocol. The local TSAP string serves the same purpose
as a port number in routing the message to the proper connection.
The rules for the LocTsap are as follows:
– The TSAP is an S7-200 SMART string data type (a length byte followed by the
characters).
– The TSAP string must be at least 2 characters and no more than 16 characters.
– If the TSAP is 2 characters, the first character must be a hexadecimal "E0".
– The TSAP cannot start with the string "SIMATIC-".
S7-200 SMART
498 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
The connect operation is asynchronous and can take several scans to complete. The Busy
output has a value of TRUE while the connect operation is pending. When the CPU
completes the operation, the instruction sets either the Done or Error output. If there is an
error, the Status output contains the error code.
You must not change the input parameters of the TCP_CONNECT while the instruction is
busy. The CPU requires this so that it knows that this is a continuation of the call that started
the connection process.
You assign the connection ID (ConnID) input to the connection and then use this ConnID to
reference this connection when sending, receiving, or disconnecting.
The Active input bit determines whether this is an active connection (Active set to TRUE) or
a passive connection (Active set to FALSE).
If this is an active connection (a client), then the S7-200 SMART CPU attempts to contact
and create a connection to the specified IP address and remote port number (RemPort). The
CPU opens a local port (LocPort) to receive messages from the remote device.
When the Active input is set to FALSE, the S7-200 SMART CPU creates a passive (server)
connection. In this case, the CPU opens the requested local port (LocPort) and accepts
connection requests from a remote device. You should set the IP address to 0.0.0.0 if you
wish to accept a connection request from any remote IP address. If the IP address is non-
zero, the CPU accepts a connection request only from the specified IP address. The CPU
ignores the remote port number (RemPort) for a passive connection, and RemPort can be
set to zero.
You can call the TCP_CONNECT instruction anytime to determine the current status of a
connection. Set the Req input to FALSE and provide a valid connection ID (ConnID), and
TCP_CONNECT returns the following:
● Busy if the connect process is still progressing.
● Done if the connection is active and ready to send or receive.
● Error if the connection is not usable. Status contains one of the error codes to specify the
problem.
Note that active connections can require up to 30 seconds to determine if the remote device
will allow the connection or not. Passive connections show a Busy status until a remote
device attempts to connect to the CPU.
Note that the S7-200 SMART does not automatically attempt to reconnect to a device after
the connection has been closed. If the remote device breaks the device connection, your
program must execute another TCP_CONNECT instruction to reconnect the device. This is
true for both active and passive connections.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 499
Libraries
9.5 Open user communication library
Example
This is an example usage of the TCP_CONNECT instruction:
S7-200 SMART
500 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
The connect operation is asynchronous and can take several scans to complete. The
instruction sets the Busy output while the connect operation is pending. When the CPU
completes the operation, the instruction sets either the Done or Error output. If there is an
error, the Status output contains the error code.
You must not change the input parameters of the ISO_CONNECT while the instruction is
busy. The CPU requires this so that it knows that this is a continuation of the call that started
the connection process.
You assign the connection ID (ConnID) input to the connection and then use this ConnID to
reference this connection when sending, receiving, or disconnecting.
The Active input bit determines whether this is an active connection (Active set to TRUE) or
a passive connection (Active set to FALSE).
If this is an active connection (a client), then the S7-200 SMART CPU attempts to contact
and create a connection to the specified IP address and remote TSAP (RemTsap). The CPU
opens a local TSAP (LocTsap) to receive messages from the remote device.
When the Active input is FALSE, the S7-200 SMART CPU creates a passive (server)
connection. In this case, the CPU opens the requested local TSAP (LocTsap) and accepts
connection requests from a remote device. You should set the IP address to 0.0.0.0 if you
wish to accept a connection request from any remote IP address. If the IP address is non-
zero, the CPU accepts a connection request only from the specified IP address. The CPU
ignores the remote TSAP string (RemTsap) for passive connections, and the RemTsap can
be set to an empty string (for example, "").
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 501
Libraries
9.5 Open user communication library
You can call the ISO_CONNECT instruction anytime to determine the current status of a
connection. Set the Req input to FALSE and provide a valid connection ID (ConnID), and
ISO_CONNECT returns the following:
● Busy if the connect process is still progressing.
● Done if the connection is active and ready to send or receive.
● Error if the connection is not usable. Status contains one of the error codes to specify the
problem.
Note that active connections can require up to 30 seconds to determine if the remote device
will allow the connection or not. Passive connections show a Busy status until a remote
device attempts to connect to the CPU.
Note that the S7-200 SMART does not automatically attempt to reconnect to a device after
the connection has been closed. If the remote device breaks the device connection, your
program must execute another ISO_CONNECT instruction to reconnect the device. This is
true for both active and passive connections.
S7-200 SMART
502 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Example
This is an example usage of the ISO_CONNECT instruction:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 503
Libraries
9.5 Open user communication library
The UDP_CONNECT instruction only requires a connection ID and a local port number to
create the connection. One UDP connection can send messages to any number of other
devices since the IP address and remote port are supplied with each UDP_SEND instruction.
You will need multiple UDP connections only if you require multiple local ports. You cannot
use the same local port number for multiple UDP connections. All local port numbers must
be unique.
The connect operation is asynchronous and can take several scans to complete. There is no
active connection establishment with the remote device, nor are we waiting for another
device to connect to this CPU. The Busy output is set while the connect operation is
pending. When the connect operation is complete, the program sets the Done output. The
program sets the Error output only if there is a problem with the input parameters or there is
no passive connection available. The Status output byte contains the error code if the
program sets the Error bit.
You must not change the parameters of the UDP_CONNECT while the instruction is busy so
that the CPU knows this is a continuation of the call that started the connection process.
You can call the UDP_CONNECT instruction to determine the current status of a connection.
Set the Req input FALSE and provide a valid connection ID (ConnID), and the
UDP_CONNECT instruction returns the following:
● The instruction sets the Done output if the connection is active and ready to send or
receive. This only means that you can use the connection. This is not an indication that
there is any remote device present.
● The instruction sets the Busy output if the connect is still processing.
● The instruction sets the Error output if the connection is not usable. The Status output
byte contains one of the error codes to specify the problem.
S7-200 SMART
504 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Example
This is an example usage of the UDP_CONNECT instruction:
The TCP_SEND instruction initiates sending the specified number of bytes when the
following occur:
● The program calls the instruction with the Req input set to TRUE.
● The connection is not currently busy with another send operation.
The Req input is level-triggered. It is recommended that you put a positive edge trigger on
the Req input so that the instruction does not initiate unintended send operations. The
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 505
Libraries
9.5 Open user communication library
program ignores the Req input while the TCP_SEND is busy. The Done, Busy, and Error
outputs and the Status output byte show the status of the TCP_SEND for each call.
The instruction displays the Done or Error status for one call of TCP_SEND after the send
operation is complete. After that, the TCP_SEND responds with error code 24, which means
no operation pending, if called with the Req input set to FALSE. If the Req input is left set to
TRUE, the program initiates another send operation. The figure below shows the relationship
of the input and output parameters.
① Req is set TRUE so that the message send begins. Busy is set TRUE.
② The message send is complete. Done is set, and Busy is cleared.
③ EN is TRUE, and Req is FALSE, but no message send is in progress. So, Error is set with
error code 24.
④ Req is set TRUE again, so another message send begins. Busy is set TRUE.
⑤ The message send is complete. Done is set, and Busy is cleared for one scan.
⑥ Req remains TRUE, so another message send begins.
⑦ The message send is complete.
The maximum amount of data that you can send in one send operation is 1024 bytes. The
program copies the data from the send buffer in user memory to an internal buffer when the
TCP_SEND executes with the Req input set TRUE. You can change the program send
buffer after the TCP_SEND executes and the instruction sets the Busy output.
S7-200 SMART
506 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Example
This is an example usage of the TCP_SEND instruction:
The TCP_RECV instruction only has an EN (Enable) input. The TCP_RECV instruction has
no Req (Request) input. After the first execution of the TCP_RECV instruction, the status bits
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 507
Libraries
9.5 Open user communication library
show the instruction is busy. Subsequent calls to TCP_RECV show a busy status until the
CPU receives data on the specified connection.
After the CPU receives a message on the specified connection, the next execution of the
TCP_RECV instruction performs the following tasks:
● Copies the message data to your program's data area (DataPtr)
● Sets the Length output to the number of bytes received
● Sets the Done output, clears the Busy and Error outputs, and sets the Status output byte
value to zero (no error)
You should assign the receive area/buffer (DataPtr) and the maximum length of the receive
buffer (MaxLen) so there is no possibility of a buffer overrun. If the CPU receives more bytes
than can fit into your program's buffer (as specified by MaxLen), the TCP_RECV instruction
copies MaxLen bytes to your program's data area and discards the rest of the received
bytes. In this situation, the instruction sets the Error output and the Status output byte
displays error code 25, which means the receive buffer is too small.
The maximum amount of data that you can receive in one message is 1024 bytes. The
TCP_RECV instruction always operates in a mode that allows receipt of messages of
varying lengths.
The TCP_RECV instruction operates differently depending on the protocol used. You
selected the protocol for the connection when you called either TCP_CONNECT (TCP
protocol) or ISO_CONNECT (ISO-on-TCP protocol) to create the connection.
Using TCP protocol, the TCP_RECV instruction returns all the bytes received by the
S7-200 SMART CPU on the specified connection since the last time your program called the
TCP_RECV instruction. Your program must call the TCP_RECV instruction often enough to
delineate the messages properly because TCP acts as a "streaming" protocol. There is no
delineation of the messages (no begin or end markers) in TCP protocol. Therefore, the CPU
does not know when messages start or end.
For example, let us suppose that there is a TCP client that sends four 20-byte messages to
the CPU in rapid succession, and your program does not call the TCP_RECV instruction
during this time. When the program does call the TCP_RECV instruction after all four
messages have been accepted by the CPU, the TCP_RECV instruction returns this as one
receive message of 80 bytes. Your program is responsible for calling the TCP_RECV
instruction often enough to receive each message as it is sent.
When you create a connection using the ISO-on-TCP protocol, the protocol itself delineates
the messages. The TCP_RECV instruction receives and holds all messages sent from the
remote device as separate messages in the CPU, no matter when or how often the program
calls the TCP_RECV instruction.
S7-200 SMART
508 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
For example, let us suppose this time there is an ISO-on-TCP client that sends four 20-byte
messages to the CPU in rapid succession. Assume also that your program does not call the
TCP_RECV instruction during this time. The ISO-on-TCP protocol delivers the four
messages during four subsequent calls to the TCP_RECV instruction (one message per
call). This happens because ISO-on-TCP has start and end markers in the protocol to
delineate the messages and separate them in the receiving device.
Example
This is an example usage of the TCP_RECV instruction:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 509
Libraries
9.5 Open user communication library
The UDP_SEND instruction initiates sending the specified number of bytes when the
following occur:
● The program calls the instruction with the Req input set to TRUE.
● The connection is not currently busy with another send operation.
The Req input is level-triggered. It is recommended that you put a positive edge trigger on
the Req input so that the instruction does not initiate unintended send operations. The
program ignores the Req input while the UDP_SEND is busy. The Done, Busy, and Error
outputs and the Status output byte show the status of the UDP_SEND for each call.
The instruction displays the Done or Error status for one call of UDP_SEND after the send
operation is complete. After that, the UDP_SEND responds with error code 24, which means
no operation pending, if called with the Req input set FALSE. If the Req input is left set to
TRUE, the program initiates another send operation. The figure below shows the relationship
of the input and output parameters.
S7-200 SMART
510 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
① Req is set TRUE so that the message send begins. Busy is set TRUE.
② The message send is complete. Done is set, and Busy is cleared.
③ EN is TRUE, and Req is FALSE, but no message send is in progress. So, Error is set with
error code 24.
④ Req is set TRUE again, so another message send begins. Busy is set TRUE.
⑤ The message send is complete. Done is set, and Busy is cleared for one scan.
⑥ Req remains TRUE, so another message send begins.
⑦ The message send is complete.
The maximum amount of data that you can send in one send operation is 1024 bytes. The
program copies the data from the send buffer in user memory to an internal buffer when the
UDP_SEND executes with the Req input set to TRUE. You can change the program send
buffer after the UDP_SEND executes and the instruction sets the Busy output.
The UDP_SEND instruction requires the IP address and port number on the remote device.
When the UDP_CONNECT created the connection, the local port was set. The IP address
(IPaddrx) and the remote port number (RemPort) are subject to the same rules and
restrictions as described earlier. (Refer to "Parameters common to the OUC library
instructions" (Page 496) for these rules.)
Note that UDP messages are not guaranteed to be delivered. There is no error returned if
the remote device is not present.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 511
Libraries
9.5 Open user communication library
Example
This is an example usage of the UDP_SEND instruction:
S7-200 SMART
512 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
The UDP_RECV instruction only has an EN (Enable) input. The UDP_RECV instruction has
no Req (Request) input. After the first execution of the UDP_RECV instruction, the status
outputs show the instruction is busy. Subsequent calls to UDP_RECV show a busy status
until the CPU receives data on the specified connection.
After the CPU receives a message on the specified connection, the next execution of the
UDP_RECV instruction performs the following tasks:
● Copies the message data to your program's data area (DataPtr)
● Sets the returned Length to the number of bytes received
● Sets the IP address to the remote device that sent the message
● Set the remote port number (RemPort) to the remote device’s port
● Sets the Done output, clears the Busy and Error outputs, and sets the Status output byte
value to zero (no error)
You should assign the receive area/buffer (DataPtr) and the maximum length of the receive
buffer (MaxLen) so there is no possibility of a buffer overrun. If the CPU receives more bytes
than can fit into your program's buffer (as specified by MaxLen), the UDP_RECV instruction
copies MaxLen bytes to your program's data area and discards the rest of the received
bytes. In this situation, the instruction sets the Error output and the Status output byte
displays error code 25, which means the receive buffer is too small.
The maximum amount of data that you can receive in one message is 1024 bytes. The
UDP_RECV instruction always operates in a mode that allows receipt of messages of
varying lengths. Each message from a remote device is delineated as a separate message
in the S7-200 SMART CPU. The UDP_RECV instruction only returns one received message
for each call of the instruction.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 513
Libraries
9.5 Open user communication library
The UDP_RECV instruction also returns the IP address and port number of the remote
device. This allows your program to respond to the remote device with a UDP_SEND where
the remote IP address and port are required parameters.
S7-200 SMART
514 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Example
This is an example usage of the UDP_RECV instruction:
The DISCONNECT instruction initiates the connection termination when the program calls
the DISCONNECT instruction with the Req input set TRUE. The Req input is level-triggered.
It is recommended that you put a positive edge trigger on the Req input.
If the requested connection (ConnID) is currently busy connecting, disconnecting, or cannot
be found because the connection has been reused, the DISCONNECT instruction returns an
error.
The DISCONNECT instruction displays the Done or Error output status for at least one call
of the instruction after the disconnect operation is complete. The instruction may return the
status of the DISCONNECT instruction for the specified connection for subsequent calls until
the CPU reuses the connection for another connect operation.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 515
Libraries
9.5 Open user communication library
After the DISCONNECT instruction completes a disconnect, if the program calls the
DISCONNECT instruction with Req set FALSE, the instruction returns error code 24, which
means no operation pending.
Exampled
This is an example usage of the DISCONNECT instruction:
S7-200 SMART
516 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 517
Libraries
9.5 Open user communication library
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
S7-200 SMART
518 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 519
Libraries
9.5 Open user communication library
Network 5: If Done is TRUE, the CPU established the connection to go to the "Idle" state.
If Busy is TRUE, go to the "Connect Wait" state to wait for the connection to be established.
If Error is TRUE, there is probably an error with the input parameters, so check to see what
state to go to next.
In all cases, exit the state machine for this scan. The program continues to the next state on
the next scan.
Network 7: Call the TCP_CONNECT instruction with Req = FALSE and the same
Connection ID (ConnID) as above. Do this to check the connection status and ensure that
the CPU established the connection.
S7-200 SMART
520 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Network 8: If Done is TRUE, this means that the CPU established the connection, so
continue in the "Idle" state.
If Busy is TRUE, stay in the "Connect Wait" state. The TCP_CONNECT instruction
eventually times out and returns an error if the other device is not present, so you do not
need to have a time out mechanism for the connect process.
If Error is TRUE, there is a problem connecting to the passive device. In this case, just try
again by going back to the "Connect" state. Note that if the passive device is present but it
rejects the connection request, the connection errors very quickly and utilizes a great amount
of bandwidth as the CPU continues to attempt to create a connection.
In all cases, exit the state machine for this scan. The program continues to the next state on
the next scan.
Network 10: Capture the interval timer and then change to the "Idle Wait" state to delay until
it is time to transmit again.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 521
Libraries
9.5 Open user communication library
Network 12: Calculate the time since you entered the "Idle" state and, if this is greater than
the "IdleTimeDelay" value, change the state to the "Transmit" state.
Network 15: Send the new message to the passive device. Set Req to TRUE to initiate the
new send operation.
Network 16: If Done is TRUE, the send is complete (probably will never happen this quickly),
so go to the "Receive" state on the next scan.
S7-200 SMART
522 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
If Busy is TRUE (this is the normal situation), go to the "Transmit Wait" state to wait for the
transmit to finish.
If Error is TRUE, check the reason, and you may need to change state if there is a
connection issue.
Network 18: Call the TCP_SEND instruction with Req = FALSE to determine if the send is
complete. Be sure to use the same send length and buffer pointer that you used to initialize
the send request.
Network 19: If Done is TRUE, the send is complete, so go to the "Receive" state.
If Busy is TRUE, stay in the "Transmit Wait" state.
If Error is TRUE, check the reason for the error and change the state if there is a connection
issue.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 523
Libraries
9.5 Open user communication library
Network 21: Clear the receive buffer and the "RecvLength" so that there is no data left from
the last received message.
Capture the current interval time value (in "RecvStartTime") to support a receive timeout and
then go to the "Receive Wait" state.
Network 23: Call the TCP_RECV instruction to get any messages that the CPU has
received.
Network 24: If Done is TRUE, the instruction received new data, so go to the "Receive
Check" state.
If Busy is TRUE, stay in the "Receive" state until you reach the receive timeout value. If you
time out in this state, disconnect the device and then reconnect it.
If Error is TRUE, check the error code to determine what to do next.
S7-200 SMART
524 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Network 26: This program only checks the returned data to ensure that you received the
same amount of data as was sent and that the first word matches the "Fill Pattern". Log
whether the response was good or bad, and then go to the "Idle" state to wait to send the
next message.
Network 29: Initiate the disconnect with the ConnID by calling the DISCONNECT instruction
with Req = TRUE.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 525
Libraries
9.5 Open user communication library
Network 30: If Done is TRUE, this means that the disconnect is complete (probably will
never happen), so go try to reconnect.
If Busy is TRUE (this would be normal), go to the "Disconnect Wait" state.
If Error is TRUE, check the reason, and you may need to change state if there is a
connection issue.
Network 32: Call the DISCONNECT instruction with Req = FALSE to check the status of the
disconnect operation.
Network 33: If Done is TRUE, this means that the disconnect is complete, so try to reconnect
on the next scan.
If Busy is TRUE (this would be normal), stay in the "Disconnect Wait" state.
If there is an error, check the reason, and you may need to change state based upon the
error code.
S7-200 SMART
526 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Network 2: If one of the partners drops the connection, the program displays error codes 8,
12, 13, and 14. The partners are currently disconnected.
In all these cases, reconnect to the partner. Set the state to "Connect".
Network 3: If the error is a parameter error (error codes 1 - 7), stop the program because
there is a configuration error with one of inputs to the function. Correct this in the program.
If the error code is 9 (connect in progress), 10 (disconnect in progress), or 11 (send in
progress), stop because the state machine is broken. The state machine is programmed to
stay in the associated waiting state until the operation is complete, and these errors should
never occur.
If the error code is between 16 and 21, these constitute connect parameter errors and should
not appear here. If these errors occur, there is a malfunction, so stop program execution.
If the SEND and DISCONNECT instructions return error 24, there is no operation currently
pending. This probably means that the operation is complete; however, error 24 should
never appear based upon the state machine. Consider this an error, and go to stop.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 527
Libraries
9.5 Open user communication library
Network 4: The program returns errors 15 and 31 if there are problems with the connection.
Disconnect and then reconnect to correct this problem.
Network 5: The program returns error 25 when the RECV function receives more data than
the buffer can support. In our case, continue as if nothing happened.
S7-200 SMART
528 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 529
Libraries
9.5 Open user communication library
Network 4: Start the connection process. This is a server so set the Active input FALSE. Set
the IPaddr inputs to zero so that the server accepts a connection from any address. Set the
RemPort to zero because you do not need it for a server connection. Call the
TCP_CONNECT instruction with the Req input TRUE to start the connection process.
Network 5: If Done is TRUE, the CPU established the connection so go to the "Idle" state.
If Busy is TRUE, go to the "Connect Wait" state to wait for the connection to be established.
If Error is TRUE, there is probably an error with the input parameters, so check to see what
state to go to next.
In all cases, exit the state machine for this scan. The program continues to the next state on
the next scan.
Network 7: Call the TCP_CONNECT instruction with Req = FALSE and the same
Connection ID (ConnID) as above. Do this to check the connection status.
S7-200 SMART
530 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Network 8: If Done is TRUE, this means that the CPU established the connection so
continue in the "Idle" state.
If Busy is TRUE, stay in the "Connect Wait" state. Since this is a passive connection, stay in
the "Busy" state until the active partner connects to the CPU. There is no timeout for a
passive connection.
If Error is TRUE, a problem occurred so go back and try again to connect on the next scan.
In all cases, exit the state machine for this scan. The program continues to the next state on
the next scan.
Network 10: Call the TCP_RECV instruction to get any messages that the CPU has
received.
Network 11: If Done is TRUE, the CPU received new data so go to the "Receive Check"
state.
If Busy is TRUE, stay in the "Receive" state until you receive some data.
If Error is TRUE, check the error code to determine what to do next.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 531
Libraries
9.5 Open user communication library
In all cases, exit the state machine for this scan. The program continues to the next state on
the next scan.
Network 13: In this program, you echo the data back to the partner. Copy all of the received
bytes to the send buffer.
Change the state to "Transmit", and exit until the next scan.
Network 16: If Done is TRUE, the send is complete (probably never happen this quickly), so
go to the "Receive" state on the next scan.
S7-200 SMART
532 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
If Busy is TRUE (this is the normal situation), go to the "Transmit Wait" state to wait for the
transmit to finish.
If Error is TRUE, check the reason, and you may need to change state if there is a
connection issue.
Network 18: Call the TCP_SEND instruction with Req = FALSE to determine when the send
is complete. Be sure to use the same send length and buffer pointer that you used to
initialize the send request.
Network 19: If Done is TRUE, the send is complete so go to the "Receive" state.
If Busy is TRUE, stay in the "Transmit Wait" state.
If Error is TRUE, check the reason for the error and change the state if there is a connection
issue.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 533
Libraries
9.5 Open user communication library
Initiate a disconnect.
Network 21: Initiate the disconnect with the ConnID by calling the DISCONNECT instruction
with Req = TRUE.
Network 22: If Done is TRUE, this means that the disconnect is complete (probably will
never happen), so try to reconnect.
If Busy is TRUE (this would be normal), go to the "Disconnect Wait" state.
If Error is TRUE, check the reason, and you may need to change state if there is a
connection issue.
Network 24: Call the DISCONNECT instruction with Req = FALSE to check the status of the
disconnect operation.
S7-200 SMART
534 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.5 Open user communication library
Network 25: If Done is TRUE, this means that the disconnect is complete, so try to reconnect
on the next scan.
If Busy is TRUE (this would be normal), stay in the "Disconnect Wait" state.
If there is an error, check the reason, and you may need to change state based upon the
error code.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 535
Libraries
9.6 PN Read Write Record library
S7-200 SMART
536 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.6 PN Read Write Record library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 537
Libraries
9.6 PN Read Write Record library
Table 9- 28 STATUS
Error Description
code
0 No error.
1 The data length parameter is 0 or is greater than the supported maximum length (1024
bytes).
2 The data buffer is not in I, Q, M, or V memory areas.
3 The data buffer does not fit in the memory area.
4 The table doesn't match with the memory.
S7-200 SMART
538 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
Error Description
code
5 The device number is invalid and not within the range: from 1 to 8.
6 An instance mismatch: The connection is busy with another instance, whose device num-
ber, API number, slot number and subslot number are same as the requested instance,
but with a different buffer size and data address.
7 The PROFINET device is not connected.
8 The size of the received buffer exceeds 1024 bytes.
9 Call sequence is invalid.
10 Parameters are invalid (for example, out-of-range).
11 The AR is created afresh in the meanwhile.
12 The RPC reports a timeout error.
13 The RPC reports a communication error.
14 The RPC Server of the IOD signaled “busy” (for example, the call can be repeated later).
15 CLRPC reports an error or the PDU cannot be parsed.
16 CM response is OK, but has a PROFINET protocol defined error.
17 The instruction parameter is invalid.
24 REQ is not enabled.
25 The buffer length is smaller than the actual data record length.
63 Unknown error.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 539
Libraries
9.7 USS library
Note
Only call the library functions from either the main program or from interrupt routines, but not
both.
Note
For the compact CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s, do
not connect pin 9 of the RS485 cable used for USS communication. The CRs CPU uses pin
9 to disable Freeport mode.
S7-200 SMART
540 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
● When performing calculations, the USS instructions use accumulators AC0 to AC3. You
can also use the accumulators in your program; however, the values in the accumulators
will be changed by the USS instructions.
● The USS instructions cannot be used in an interrupt routine.
9.7.1.3 Calculating the time required for communicating with the drive
Communications with the drive are asynchronous to the S7-200 SMART CPU scan. The
CPU typically completes several scans before one drive communications transaction is
completed. The following factors help determine the amount of time required:
● Number of drives present
● Baud rate
● Scan time of the CPU
Some drives require longer delays when using the parameter access instructions. The
amount of time required for a parameter access is dependent on the drive type and the
parameter being accessed.
After a USS_INIT instruction assigns Port 0 to use the USS Protocol (or USS_INIT_P1 for
port 1), the CPU regularly polls all active drives at the intervals shown in the following table.
You must set the time-out parameter of each drive to allow for this task:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 541
Libraries
9.7 USS library
Procedure
To use the USS protocol instructions in your S7-200 SMART program, follow these steps:
1. Insert the USS_INIT instruction in your program and execute the USS_INIT instruction for
one scan only. You can use the USS_INIT instruction either to initiate or to change the
USS protocol communication parameters.
When you insert the USS_INIT instruction, several hidden subroutines and interrupt
routines are automatically added to your program.
2. Place only one USS_CTRL instruction in your program for each active drive.
You can add as many USS_RPM_x and USS_WPM_x instructions as required, but only
one of these can be active at a time.
3. Click the Memory button from the Libraries area of the File menu ribbon strip to
assign a starting address for the V Memory that the USS library requires. Alternatively,
you can right-click the Program Block node in the project tree and select "Library
Memory" from the context menu.
4. Configure the drive parameters to match the baud rate and address used in the program.
5. Connect the communications cable between the S7-200 SMART CPU and the drives.
Ensure that all of the control equipment, such as the S7-200 SMART CPU, that is
connected to the drive be connected by a short, thick cable to the same ground or star
point as the drive.
CAUTION
Avoiding unwanted current flow
Interconnecting equipment with different reference potentials can cause unwanted
currents to flow through the interconnecting cable. These unwanted currents can cause
communications errors or damage equipment.
Ensure that all equipment that is connected with a communications cable either shares
a common circuit reference or is isolated to prevent unwanted current flows.
The shield must be tied to chassis ground or pin 1 on the 9-pin connector. It is
recommended that you tie terminal 2-0V on the drive to chassis ground.
S7-200 SMART
542 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
The instruction is executed on each scan when the "EN" input is on.
Execute the USS_INIT instruction only once for each change in communications state. Use
an edge detection instruction to pulse the "EN" input on. To change the initialization
parameters, execute a new USS_INIT instruction.
Parameter Description
Mode This value selects the communications protocol:
• An input value of 1 assigns the port to USS protocol and enables the protocol.
• An input value of 0 assigns the port to PPI and disables the USS protocol.
Baud Sets the baud rate at 1200, 2400, 4800, 9600, 19200, 38400, 57600, or 115200
Port Sets the physical communication port (0 = RS485 integrated in CPU, 1 = RS485 or
RS232 located on the optional CM01 signal board)
Active Indicates which drives are active. Some drives only support addresses 0 through
30.
Done Turned on when the USS_INIT instruction completes
Error This output byte contains the result of executing the instruction. The USS protocol
execution error codes (Page 553) define the error conditions that could result from
executing the instruction.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 543
Libraries
9.7 USS library
Refer to the USS protocol execution error codes (Page 553) to compute the time between
status polls and the error conditions that could result from executing the instruction.
Network 1 Network 1
LD SM0.1
CALL USS_INIT, 1, 19200, 1, 16#1, M0.0,
VB1
Refer to "Using the USS protocol instructions" (Page 542) for and a listing of USS protocol
instructions and error codes and example programs.
S7-200 SMART
544 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 545
Libraries
9.7 USS library
RUN parameter
RUN (RUN/STOP) indicates whether the drive is on (1) or off (0). When the "RUN" bit is on,
the drive receives a command to start running at the specified speed and direction. In order
for the drive to run, the following must be true:
● Drive must be selected as "Active" in USS_INIT.
● "OFF2" and "OFF3" must be set to 0.
● "Fault" and "Inhibit" must be 0.
When "RUN" is off, a command is sent to the drive to ramp the speed down until the motor
comes to a stop:
● The "OFF2" bit is used to allow the drive to coast to a stop.
● The "OFF3" bit is used to command the drive to stop quickly.
Resp_R parameter
The "Resp_R" (response received) bit acknowledges a response from the drive. All the
Active drives are polled for the latest drive status information. Each time the CPU receives a
response from the drive, the "Resp_R" bit is turned on for one scan and all the following
values are updated:
Parameter Description
F_ACK Bit that acknowledges a fault in the drive. The drive clears the fault ("Fault" bit)
(fault when "F_ACK" goes from 0 to 1.
acknowledge)
DIR Bit that indicates in which direction the drive should move.
(direction)
Drive Input for the address of the drive to which the USS_CTRL command is to be sent.
(drive address) Valid addresses: 0 to 31
Type Input that selects the type of drive
(drive type)
Speed_SP Drive speed as a percentage of full speed:
(speed setpoint)
• Negative values of "Speed_SP" cause the drive to reverse its direction of rota-
tion.
• Range: -200.0% to 200.0%
Error Byte that contains the result of the latest communications request to the drive. The
USS protocol execution error codes (Page 553) define the error conditions that
could result from executing the instruction.
Status Raw value of the status word returned by the drive. The figures below show the
status bits for standard status word and main feedback.
Speed Drive speed as a percentage of full speed. Range: -200.0% to 200.0%
Run_EN Indicates the drive condition:
(RUN enable)
• Running (1)
• Stopped (0)
D_Dir Indicates the drive's direction of rotation
S7-200 SMART
546 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
Parameter Description
Inhibit Indicates the state of the "Inhibit" bit on the drive:
• 0: not inhibited
• 1: inhibited
To clear the "Inhibit" bit, the following bits must be OFF:
• "Fault"
• "RUN"
• "OFF2"
• "OFF3"
Fault Indicates the state of the "Fault" bit:
• 0: no fault
• 1: fault
The drive displays the fault code. (Refer to the manual for your drive). To clear the
"Fault" bit, correct the cause of the fault and turn on the "F_ACK" bit.
Refer to "Using the USS protocol instructions" (Page 542) for a listing of USS protocol
instructions and error codes and example programs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 547
Libraries
9.7 USS library
The USS_RPM_x transactions complete when the drive acknowledges receipt of the
command or when an error condition is posted. The logic scan continues to execute while
this process awaits a response.
The "EN" bit must be on to enable transmission of a request, and should remain on until the
"Done" bit is set, signaling completion of the process. For example, a USS_RPM_x request
is transmitted to the drive on each scan when the "XMT_REQ" input is on. Therefore, the
"XMT_REQ" input should be pulsed on through an edge detection element which causes
one request to be transmitted for each positive transition of the "EN" input.
Parameter Description
XMT_REQ When ON, a USS_RPM_x request is transmitted to the drive on every scan.
(transmit re-
quest)
Drive Address of the drive to which the USS_RPM_x command is to be sent. Valid ad-
dresses of individual drives are 0 to 31.
Param Parameter number
Index Index value of the parameter that is to be read
S7-200 SMART
548 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
Parameter Description
DB_Ptr The address of a 16-byte buffer must be supplied to the "DB_Ptr" input. This buffer
is used by the USS_RPM_x instruction to store the results of the command issued
to the drive.
Done Turned on when the USS_RPM_x instruction completes
Error This output byte contains the result of executing the instruction. The USS protocol
execution error codes (Page 553) define the error conditions that could result from
executing the instruction.
Value Parameter value returned
When the USS_RPM_x instruction completes, the "Done" output is turned on and the "Error"
output byte and the "Value" output contain the results of executing the instruction. The
"Error" and "Value" outputs are not valid until the "Done" output turns on.
Network 1 Network 1
LD M10.5
= L60.0
LD M10.5
EU
= L63.7
LD L60.0
CALL USS_RPM_W, L63.7, 0, 5, 0, &VB20,
M1.1, VB10, VW12
Network 2 Network 2
LD M10.6
= L60.0
LD M10.6
EU
= L63.7
LDN SM0.0
= L63.6
LD L60.0
CALL USS_WPM_W, L63.7, L63.6, 0, 2000, 0,
50.0, &VB40, M1.2, VB14
Refer to "Using the USS protocol instructions" (Page 542) for and a listing of USS protocol
instructions and error codes and example programs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 549
Libraries
9.7 USS library
The USS_WPM_x transactions complete when the drive acknowledges receipt of the
command or when an error condition is posted. The logic scan continues to execute while
this process awaits a response.
S7-200 SMART
550 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
The "EN" bit must be on to enable transmission of a request, and should remain on until the
"Done" bit is set, signaling completion of the process. For example, a USS_WPM_x request
is transmitted to the drive on each scan when "XMT_REQ" input is on. Therefore, the
"XMT_REQ" input should be pulsed on through an edge detection element which causes
one request to be transmitted for each positive transition of the "EN" input.
Parameter Description
XMT_REQ When ON, a USS_WPM_x request is transmitted to the drive on every scan.
(transmit re-
quest)
EEPROM This input enables writing to both RAM and EEPROM of the drive when it is on and
only to the RAM when it is off.
Drive Address of the drive to which the USS_WPM_x command is to be sent. Valid ad-
dresses of individual drives are 0 to 31.
Param Parameter number
Index Index value of the parameter that is to be written
Value Parameter value to be written to the RAM in the drive.
DB_Ptr The address of a 16-byte buffer must be supplied to the "DB_Ptr" input. This buffer
is used by the USS_RPM_x instruction to store the results of the command issued
to the drive.
Done Turned on when the USS_RPM_x instruction completes
Error This output byte contains the result of executing the instruction. The USS protocol
execution error codes (Page 553) define the error conditions that could result from
executing the instruction.
When the USS_WPM_x instruction completes, the "Done" output is turned on and the "Error"
output byte contains the result of executing the instruction. The "Error" output is not valid
until the "Done" output turns on.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 551
Libraries
9.7 USS library
EEPROM
When the "EEPROM" input is turned on, the instruction writes to both the RAM and the
EEPROM of the drive. When the input is turned off, the instruction writes only to the RAM of
the drive.
NOTICE
Do not exceed the maximum number of write cycles to the EEPROM
When you use an USS_WPM_x instruction to update the parameter set stored in drive
EEPROM, you must ensure that the maximum number of write cycles (approximately
50,000) to the EEPROM is not exceeded.
Exceeding the maximum number of write cycles will result in corruption of the stored data
and subsequent data loss, and possible property damage. The number of read cycles is
unlimited.
Do not exceed the maximum number of write cycles to the EEPROM.
Network 1 Network 1
LD M10.5
= L60.0
LD M10.5
EU
= L63.7
LD L60.0
CALL USS_RPM_W, L63.7, 0, 5, 0, &VB20,
M1.1, VB10, VW12
Network 2 Network 2
LD M10.6
= L60.0
LD M10.6
EU
= L63.7
LDN SM0.0
= L63.6
LD L60.0
CALL USS_WPM_W, L63.7, L63.6, 0, 2000, 0,
50.0, &VB40, M1.2, VB14
S7-200 SMART
552 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
Refer to "Using the USS protocol instructions" (Page 542) for and a listing of USS protocol
instructions and error codes and example programs.
Refer to "Using the USS protocol instructions" (Page 542) for and a listing of USS protocol
instructions and error codes and example programs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 553
Libraries
9.7 USS library
Network 1 Network 1:
Initialize USS protocol: On the first scan, enable USS
protocol for port 1 at 19200 with drive address "0"
active.
LD SM0.1
CALL USS_INIT, 1, 19200, 16#00000001,
Q0.0, VB1
Network 2 Network 2:
Control parameters for Drive 0
LD SM0.0
CALL USS_CTRL, M10.0, M10.1, M10.2,
M10.3, M10.4, 0, 1, 100.0, M1.0, VB2,
VW4, VD6, M0.1, M0.2, M0.3, M0.4
Network 3 Network 3:
Read a Word parameter from Drive 0.
Read parameter 5, index 0:
1. Save the state of M10.5 to a temporary location so
that this network displays in LAD.
2. Save the rising edge pulse of I0.5 to a temporary
L location so that it can be passed to the subrou-
tine.
S7-200 SMART
554 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.7 USS library
LD M10.5
= L60.0
LD M10.5
EU
= L63.7
LD L60.0
CALL USS_RPM_W, L63.7, 0, 5, 0, &VB20,
M1.1, VB10, VW12
Network 4 Network 4:
Write a Word parameter to Drive 0. Write parame-
ter 2000, index 0.
Note: This STL code does not compile to LAD or FBD.
LD M10.6
= L60.0
LD M10.6
EU
= L63.7
LDN SM0.0
= L63.6
LD L60.0
CALL USS_WPM_R, L63.7, L63.6, 0, 2000,
0, 50.0, &VB40, M1.2, VB14
Refer to "Using the USS protocol instructions" (Page 542) for and a listing of USS protocol
instructions and error codes and example programs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 555
Libraries
9.8 SINAMICS Library
SINAMICS_Control
SINAMICS_Control uses the following program entities:
● 2 subroutines:
– SINA_POS
– SINA_SPEED
● 3867 bytes of program space
● A 188-byte block of V memory for the instruction symbols
SINAMICS_Parameter
SINAMICS_Parameter uses the following program entities:
● 4 subroutines:
– PN_RD_REC_PARA_S
– PN_WR_REC_PARA_S
– SINA_PARA_S
– ERROR_HANDLER
● 5050 bytes of program space
● A 1314-byte block of V memory for the instruction symbols
S7-200 SMART
556 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
For the SINAMICS_Parameter instruction, if the program is large, you need to use the CPU
ST30, ST40 and ST60.
5. Click "Set PROFINET" from the navigation tree and click "Select telegram".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 557
Libraries
9.8 SINAMICS Library
6. In the "Selection of telegram" field, select "SIEMENS telegram 111" as the current
telegram. The SINA_POS instruction only supports SIEMENS telegram 111.
Note
When you configure the PROFINET network in PROFINET wizard, keep the telegram
consistent with that in this step.
S7-200 SMART
558 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
When you configure the PROFINET network in PROFINET wizard, keep the device name
consistent with the PN station name in this step.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 559
Libraries
9.8 SINAMICS Library
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode of
addressing instruction operands is the indirect addressing.
You must enter an ampersand (&) at the beginning of the input operand and keep the offset
consistent with that in the PROFINET wizard.
S7-200 SMART
560 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 561
Libraries
9.8 SINAMICS Library
Status_table IN DWORD Pointer of the start address of Status_table (Page 564). For example,
&VD9000.
ActVelocity OUT DWORD Actual velocity
ActPosition OUT DWORD Actual position in LU
Warn_code OUT WORD The warning code information from V90. For detailed information, refer to
SINAMICS V90, SIMOTICS S-1FL6 Operating Instruction.
Fault_code OUT WORD The fault code information from V90. For detailed information, refer to
SINAMICS V90, SIMOTICS S-1FL6 Operating Instruction.
Done OUT BOOL Target position is reached when the operating mode is relative positioning
or absolute positioning.
Byte Offset Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
0 Reserved Reserved AckError 1 FlyRef 2 Jog2 3 Jog1 4 Negative 5 Positive 6
1 Reserved
2 OverV 7
3
4 OverAcc 8
5
6 OverDec 9
7
8 ConfigEpos 10
9
10
11
1 AckError: Acknowledging errors. (1= Acknowledging errors is valid, 0 =Acknowledging
errors is invalid)
2FlyRef: flying reference selection (1 = Reference point setting is activated, 0 = Reference
point setting is not activated)
3 Jog2: Jog signal source 2 (1= positive jog is activated, 0 = positive jog is not activated)
4 Jog1: Jog signal source 1 (1= negative jog is activated, 0 = negative jog is not activated)
5Negative: Negative direction (1 = negative rotation is activated, 0 = negative rotation is not
activated)
S7-200 SMART
562 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
default value is 100%. For example, you can set OverV as 60%.
8OverAcc: Acceleration override is active. The value range is 0%-100% and the default
value is 100%. For example, you can set OverAcc as 70%.
9 OverDec: Deceleration override is active. The value range is 0%-100% and the default
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 563
Libraries
9.8 SINAMICS Library
Table 9- 51 Status_table
Byte offset Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
0 Reserved Over- AxisError 2 AxisWarn 3 Lockout 4 AxisRef 5 AxisPosOk 6 Axisena-
range_Error 1 bled 7
1 Error ID 8
2 Actmode 9
3
4 Epos_zsw1 10
5
6 Epos_zsw2 11
7
1Overrange_Error: The data you enter is out of the range. For detailed information, refer to
Error code 3, 4, 5 (Page 565).
2 AxisError: The drive has an error. (Default = 0)
3 AxisWarn: Drive alarm is active. (Default = 0)
4 Lockout: Switching-on inhibit. (Default = 0)
5 AxisRef: Reference point set. (Default = 0)
6 AxisPosOk: Target position of the axis is reached. (Default = 0)
7 Axisenabled: Drive is ready and switched on. (Default = 0)
8 Error ID: Identify the error type. For the detailed information, refer to Error codes for the
S7-200 SMART
564 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Assignment of "Epos_zsw1"
The following table lists the assignment information of "Epos_zsw1":
Table 9- 53 Epos_zsw1
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 565
Libraries
9.8 SINAMICS Library
Assignment of "Epos_zsw2"
The following table lists the assignment information of "Epos_zsw2":
Table 9- 54 Epos_zsw2
Basic requirements
The input operands "CancelTraversing" and "IntermediateStop" are relevant for all modes
except for jog and must be set to "1" when using SINAMICS.
S7-200 SMART
566 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with ModePos=1.
● The device is switched on with "EnableAxis".
● The axis does not have to be referenced or the encoder adjusted.
● The axis is at standstill if selected by an operating mode greater than 3. A change within
the MDI operating modes (1,2,3) is possible at any time.
Sequence
You configure the traversing path and dynamic responses with the following inputs:
● "Position"
● "Velocity"
● "OverV" (velocity override)
● "OverAcc" (acceleration override)
● "OverDec" (deceleration override)
The velocity override refers to the "Velocity". For example, the velocity that takes effect is
500LU/min and the OverV is 120%, the velocity in SINAMICS V90 is 600LU/min.
You must set the signal inputs "CancelTraversing" and "IntermediateStop" to "1". "Jog1" and
"Jog2" have no effect and you must set them to "0" (false).
The direction of travel in relative positioning always results from the sign of the traversing
path. For example, if the position is -1000, the direction is negative. If the position is 1000,
the direction is positive.
Traversing motion is started with a positive edge at "Execute". You can track the current
state of the active command with "EPos_zsw1 / EPos_zsw2".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 567
Libraries
9.8 SINAMICS Library
If the target position is reached, the value of bit "AxisPosOK" in the output signal
"Status_table" is 1. If an error occurs during the traversing motion, the bit "AxisError" in the
output signal "Status_table" is issued.
Note
The current command can be replaced on the fly by a new command with "ExecuteMode".
This is only possible for the "ModePos" 1, 2 or 3 modes.
S7-200 SMART
568 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operand "St_I_add" and "St_Q_add", keep the offset consistent with that in
the PROFINET wizard.
Result: The drive moves 2500 LU on the basis of the previous position distance. For
example, if the previous distance is 5000 LU, the drive stays at the distance of 7500 LU.
The following illustration displays the movement trajectory and dynamic parameters:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 569
Libraries
9.8 SINAMICS Library
① Relative positioning
② Relative positioning
③ Absolute positioning
In this illustration, "v" refers to velocity, "s" refers to position, and "t" refers to time.
S7-200 SMART
570 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with "ModePos"=2.
● The device is switched on with "EnableAxis".
● The axis must be referenced or the encoder adjusted.
● The axis is at a standstill if selected by an operating mode greater than 3. A change
within the MDI operating modes (1,2 or 3) is possible at any time.
Sequence
The traversing path and dynamic responses are specified with the following inputs:
● "Position"
● "Velocity"
● "OverV" (velocity override)
● "OverAcc" (acceleration override)
● "OverDec" (deceleration override)
The velocity override refers to the "Velocity". For example, the velocity that takes effect is
500LU/min and the OverV is 120%, the velocity in SINAMICS V90 is 600LU/min.
You must set the input signal "CancelTraversing" and "IntermediateStop" to "1". "Jog1" and
"Jog2" have no effect and you must set them to "0".
The direction of travel in Absolute positioning always results from the shortest distance to the
target position. The inputs "Positive " and "Negative" are "0".
Note
You can use the parameters "Positive" or "Negative" to specify a preferred direction to
approach the target position for an axis.
Note
You can select the absolute positioning direction with the following positioning control words:
• POS_STW1.9:
• POS_STW1.10:
– 1 = Absolute positioning/MDI direction selectionpositive
– 2 = Absolute positioning/MDI direction selectionnegative
– 3 = Absolute positioning through the shortest distance
Traversing motion is started with a positive edge at "Execute". You can track the current
state of the active command with "EPoszsw1 / EPoszsw2".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 571
Libraries
9.8 SINAMICS Library
If the target position is reached, the value of bit "AxisPosOK" in the output signal
"Status_table" is 1. If an error occurs during the traversing motion, the bit "AxisError" in the
output signal "Status_table" is issued.
Note
The current command can be replaced on-the-fly by a new command via "Execute". This is
only possible for the "ModePos" 1, 2, 3 modes.
S7-200 SMART
572 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operand "St_I_add" and "St_Q_add", keep the offset consistent with that in
PROFINET wizard.
Note
For the operating mode "absolute positioning", you must set a valid reference position by
configuring it in the mode "Referencing (active referencing)" or the "Referencing (set
reference point)".
The following illustration displays the movement trajectory and dynamic parameters:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 573
Libraries
9.8 SINAMICS Library
① Relative positioning
② Relative positioning
③ Absolute positioning
In this illustration, "v" refers to velocity, "s" refers to position, and "t" refers to time.
S7-200 SMART
574 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with "ModePos" = 3.
● The device is switched on using "EnableAxis".
● The axis does not have to be referenced or the encoder adjusted.
● The axis is at a standstill if the operating mode is greater than 3. A change within the MDI
operating modes (1, 2 or 3) is possible at any time.
Sequence
The traversing path and dynamic responses are specified with the following inputs:
● "Positive" or "Negative"
● "Velocity"
● "OverV" (velocity override)
● "OverAcc" (acceleration override)
● "OverDec" (deceleration override)
You must set the input signal "CancelTraversing" and "IntermediateStop" to "1". "Jog1" and
"Jog2" have no effect and you must set them to "0".
The travel direction is determined via "Positive" and "Negative". Simultaneous selection
stops the axis without further alarms or faults.
Traversing motion is started with a positive edge at "Execute". You can track the current
state of the active command with "EPos_zsw1 / EPos_zsw2".
The output signal "AxisPosOk" is set when the setup mode is terminated with reject
traversing task and the axis has stopped.
If an error occurs during the traversing motion, the bit "AxisError" in the output signal
"Status_table" is issued.
Note
The current command can be replaced on-the-fly by a new command via "Execute". This is
only possible for the "ModePos" 1, 2, 3 modes.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 575
Libraries
9.8 SINAMICS Library
S7-200 SMART
576 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operands "St_I_add" and "St_Q_add", keep the offset consistent with that in
the PROFINET wizard.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 577
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with "ModePos"=4.
● The device is switched on using "EnableAxis".
● The axis is at a standstill.
Sequence
The required velocity is saved as a velocity profile in the SINAMICS V90. Further, the preset
acceleration and deceleration values are active in the traversing profile of the axis. The
"OverV" velocity override affects the preconfigured traversing velocity. For example, the
velocity that takes effect is 500LU/min and the OverV is 120%, the velocity in SINAMICS
V90 is 600LU/min.
You must set the input signal "CancelTraversing" and "IntermediateStop" to "1". "Jog1" and
"Jog2" have no effect and you must set them to "0".
The travel direction is determined via "Positive" and "Negative". Simultaneous selection is
not permitted and results in a fault.
S7-200 SMART
578 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 579
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operands "St_I_add" and "St_Q_add", keep the offset consistent with that in
the PROFINET wizard.
3. In the variable "Control_table", if you set V8000.0 as 1 and V8000.1 as 0, the drive moves
toward the positive direction to find the reference point. If you set V8000.1 as 1 and
V8000.0 as 0, the drive moves toward the negative direction to find the reference point.
Note
When the external reference signal connects to PLC directly, you can set V8011.6 as 1
through digital inputs. The drive stops and you set the reference point successfully.
The following picture displays the movement trajectory and dynamic parameters:
S7-200 SMART
580 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with "ModePos"=5.
● The axis can be in closed-loop control, but must be at a standstill.
Sequence
The axis is at a standstill and the reference point is set with a positive edge at "Execute".
If an error occurs while setting the reference point, the bit "AxisError" in the output signal
"Status_table" is issued.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 581
Libraries
9.8 SINAMICS Library
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operands "St_I_add" and "St_Q_add", keep the offset consistent with that in
PROFINET wizard.
The following picture displays the movement trajectory and dynamic parameters:
S7-200 SMART
582 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with "ModePos"=6.
● The device is switched on using "EnableAxis".
● The axis is at a standstill.
● The axis must be referenced or the encoder adjusted.
Sequence
Note
You can use the "Position" input to select the traversing task to start. The value is from 0 to
15.
If the value is out of the range, the error code 5 (Page 565)displays in the "Status_table" bit
"Overrange_Error".
The traversing block parameters in the SINAMICS V90 specify the task modes, the target
positions and dynamic responses. The velocity override "OverV" refers to the velocity
setpoint stored in the traversing block. You must set the operating conditions
"CancelTraversing" and "IntermediateStop" to "1". "Jog1" and "Jog2" have no effect and you
must set them to "0".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 583
Libraries
9.8 SINAMICS Library
The travel direction results from the task mode and the set position setpoint. The "Positive"
and "Negative" are not relevant in this case and you must set them to "0".
Note
You can use the parameters "Positive" or "Negative" to specify a preferred direction to
approach the target position for an axis.
Traversing motion is started with a positive edge at "ExecuteMode". You can track the
current state of the active command with "EPos_zsw1 / EPos_zsw2".
The SINA_POS instruction acknowledges when the end of the traversing path is reached
successfully with "AxisPosOk". If an error occurs during the traversing motion, the bit
"AxisError" in the output signal "Status_table" is issued.
Note
The current command can be replaced on-the-fly by a new command via "Execute". This is
only possible for the same operating mode.
S7-200 SMART
584 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operands "St_I_add" and "St_Q_add", keep the offset consistent with that in
the PROFINET wizard.
The following picture displays the movement trajectory and dynamic parameters:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 585
Libraries
9.8 SINAMICS Library
In this illustration, "v" refers to velocity, "s" refers to position, and "t" refers to time.
9.8.1.10 Jog
The Jog mode is implemented using the "Jog" function of SINAMICS V90 PN. It enables the
position-controlled, velocity-dependent traversing of axes using the integrated position
controller of the SINAMICS V90 PN.
Requirements
● The mode is selected with "ModePos" = 7.
● The device is switched on using "EnableAxis".
● The axis is at standstill.
● The axis does not have to be referenced or adjusted.
Sequence
The specification of the jog velocity is performed via the V-assistant form or the
SINA_PARA_S instruction for the configuration of the operating mode in the SINAMICS V90.
The SINAMICS V90 uses the acceleration and deceleration for the dynamic responses of the
axis.
S7-200 SMART
586 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
The velocity override also applies in this operating mode and is set through "OverV". For
example, the velocity that takes effect is 500LU/min and the OverV is 120%, the velocity in
SINAMICS V90 is 600LU/min.
The input signal "CancelTraversing" and "IntermediateStop" are not relevant for the
operating mode and you must set them to "1".
Note
"Jog1" and "Jog2" are the signal sources for the jog mode in SINA_POS. "Jog1" is the signal
source for negative, and "Jog2" is the signal source for positive.
You can configure the distance of traversing motion in the SINAMICS V90 PN.
Note
The current command can be replaced on-the-fly by a new command via "Jog1" or "Jog2".
This is only possible for the "ModePos" 1, 2 or 3 mode.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 587
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operands "St_I_add" and "St_Q_add", keep the offset consistent with that in
the PROFINET wizard.
3. In the variable "Control_table", if you set V8000.2 as 1 and V8000.3 as 0, the drive moves
toward the negative direction. If you set V8000.3 as 1 and V8000.2 as 0 , the drive moves
toward the positive direction.
4. To pause the drive, set the variable V8000.2 or V8000.3 as 0.
The following illustration displays the movement trajectory and dynamic parameters:
S7-200 SMART
588 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Requirements
● The mode is selected with "ModePos" = 8.
● The device is switched on via "EnableAxis".
● The axis is at standstill.
● The axis does not have to be referenced or adjusted.
Sequence
The specification of the jog velocity is performed via the V-assistant or the SINA_PARA_S
instruction for the configuration of the operating mode in the SINAMICS V90. The SINAMICS
V90 uses the acceleration and deceleration for the dynamic responses of the axis.
The velocity override also applies in this operating mode and is set through "OverV". For
example, the velocity that takes effect is 500LU/min and the OverV is 120%, the velocity in
SINAMICS V90 is 600LU/min.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 589
Libraries
9.8 SINAMICS Library
The operating conditions "CancelTraversing" and "IntermediateStop" are not relevant for the
operating mode and can be set to "1".
Note
"Jog1" and "Jog2" are the signal sources for the jog mode in SINA_POS. Jog 1 is the signal
source for negative, and Jog 2 is the signal source for positive.
You can configure the distance of incremental traversing motion in the SINAMICS V90 PN.
The travel direction when jogging results from the set velocity setpoint. The inputs "Positive"
and "Negative" are not relevant for the operating mode and can be set to "0" as standard.
The current state of the active command can be tracked via "EPosZSW1 / EPosZSW2".
The block displays the current command processing with "AxisEnabled" and acknowledges
the termination of the jog function ("Jog1" or "Jog2" = 0) when the axis is at standstill with bit
"AxisPosOk". If an error occurs during the traversing motion, the bit "AxisError" in the output
signal "Status_table" is issued.
Note
The current command can be replaced on-the-fly by a new command via "Jog1" or "Jog2".
This is only possible when you remain in one of the jog modes.
S7-200 SMART
590 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
The variable value in this example is for your reference, and you need to create the
variable according to your actual situation.
Note
For the four inputs "St_I_add", "St_Q_add", "Control_table", and "Status_table", the mode
of addressing instruction operands is the indirect addressing. You must enter an
ampersand (&) at the beginning of the input operand.
For the input operand "St_I_add" and "St_Q_add", keep the offset consistent with that in
PROFINET wizard.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 591
Libraries
9.8 SINAMICS Library
In this illustration, "v" refers to velocity, "s" refers to position, and "t" refers to time.
S7-200 SMART
592 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
5. Click "Set PROFINET" from the navigation tree and click "Select telegram".
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 593
Libraries
9.8 SINAMICS Library
6. In the "Selection of telegram" field, select "Standard telegram 1" as the current telegram.
The SINA_SPEED instruction only supports Standard telegram 1.
Note
When you configure the PROFINET network in PROFINET wizard, keep the telegram
consistent with that in this step.
S7-200 SMART
594 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
When you configure the PROFINET network in PROFINET wizard, keep the device name
consistent with the PN station name in this step.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 595
Libraries
9.8 SINAMICS Library
CALL SINA_SPEED,EnableAxis,
The SINA_SPEED instruction enables
AckError, SpeedSp, Ref- the speed control of drive movement.
Speed, ConfigAxis Start-
ing_I_add,Starting_Q_add,
AxisEnabled, Lockout,
ActVelocity, Error
Note
For the two inputs "St_I_add" and "St_Q_add", the mode of addressing instruction operands
is indirect addressing.
You must enter an ampersand (&) at the beginning of the input operand and keep the offset
consistent with that in the PROFINET wizard.
S7-200 SMART
596 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 597
Libraries
9.8 SINAMICS Library
Table 9- 57 ConfigAxis
ConfigAxis Meaning
Bit0 OFF2
Bit1 OFF3
Bit2 Inverter enable
Bit3 Enable ramp-function generator
Bit4 Continue ramp-function generator
Bit5 Enable speed setpoint
Bit6 Direction of rotation
Bit7 Unconditionally open holding brake
Bit8 Motorized potentiometer increase setpoint
Bit9 Motorized potentiometer, decrease setpoint
Bit10 Reserved
Bit11 Reserved
Bit12 Reserved
Bit13 Reserved
Bit14 Reserved
Bit15 Reserved
Example
S7-200 SMART
598 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
Note
For the inputs "St_I_add" and "St_Q_add", the mode of addressing instruction operands is
indirect addressing. You must enter an ampersand (&) at the beginning of the input
operand.
For the input operands "St_I_add" and "St_Q_add", keep the offset consistent with that in
the PROFINET wizard.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 599
Libraries
9.8 SINAMICS Library
5. Click "Set PROFINET" from the navigation tree and click "Select telegram".
S7-200 SMART
600 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
6. In the "Selection of telegram" field, select your desired telegram as the current telegram.
The SINA_PARA_S instruction only supports SIEMENS telegram 111 or Standard
telegram 1.
Note
When you configure the PROFINET network in PROFINET wizard, keep the telegram
consistent with that in this step.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 601
Libraries
9.8 SINAMICS Library
Note
When you configure the PROFINET network in PROFINET wizard, keep the device name
consistent with the PN station name that in this step.
S7-200 SMART
602 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
The following table lists the input and output signals of SINA_PARA_S insrtruction:
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 603
Libraries
9.8 SINAMICS Library
Definition of "Device_parameter"
The following table list the bit definitions of Device_parameters:
Table 9- 60 Device_parameters
Byte Offset Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0 Axis number: Select 2 for the V90 drive. For other drives, refer to the related manual.
1 Reserved
2 API number1
3
4
5
6 Slot number1
7
8 Subslot number1
9
Note
1For the API number, Slot number and Subslot number, move to the PROFINET wizard
(Page 404)to check the information.
Table 9- 61 Format
ID Description
02 Integer 8
03 Integer 16
04 Integer 32
05 Unsigned 8
06 Unsigned 16
07 Unsigned 32
08 Floating Point
10 Octet String 8 (16 bit)
S7-200 SMART
604 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
ID Description
13 Time Difference (32 bit)
41 Byte
42 Word
43 Double word
44 Error
Table 9- 62 ErrorNo
Error ID Description
00 hex Illegal parameter number (access to a parameter that does not exist)
01 hex Parameter value cannot be changed (change request for a parameter value that cannot be changed)
02 hex Lower or upper value limit exceeded (change request with a value outside the value limits)
03 hex Incorrect subindex (access to a parameter index that does not exist)
04 hex No array (access with a subindex to non-indexed parameters)
05 hex Incorrect data type (change request with a value that does not match the data type of the parameter)
06 hex Setting not permitted, only resetting (change request with a value not equal to 0 without permission)
07 hex Descriptive element cannot be changed (change request to a descriptive element that cannot be changed)
09 hex Description data not available (access to a description that does not exist, parameter value is available)
0B hex No master control (change request but with no master control)
0F hex Text array does not exist (although the parameter value is available, the request is made to a text array that
does not exist)
11 hex Request cannot be executed due to the operating state (access is not possible for temporary reasons that
are not specified)
14 hex Inadmissible value (change request with a value that is within the limits but which is illegal for other perma-
nent reasons, for example, a parameter with defined individual values)
15 hex Response too long (the length of the actual response exceeds the maximum transfer length)
16 hex Illegal parameter address (illegal or unsupported value for attribute, number of elements, parameter number,
subindex or a combination of these)
17 hex Illegal format (change request for an illegal or unsupported format)
18 hex Number of values not consistent (number of values of the parameter data to not match the number of ele-
ments in the parameter address)
19 hex Drive object does not exist (access to a drive object that does not exist)
20 hex Parameter text cannot be changed
21 hex Service is not supported (illegal or not support request ID)
6B hex A change request for a controller that has been enabled is not possible. (The drive rejects the change re-
quest because the motor is switched on. Please observe the "Can be changed" parameter attribute (U, T) as
given in the parameter list relevant section in the SINAMICS V90, SIMOTICS S-1FL6 Operating Instructions
6C hex Unknown unit.
77 hex Change request is not possible during download
81 hex Change request is not possible during download
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 605
Libraries
9.8 SINAMICS Library
Error ID Description
82 hex Accepting the master control is inhibited
83 hex Desired interconnection is not possible (the connector output does not supply a float value although the con-
nector input requires a float value)
84 hex Inverter does not accept a change request (inverter is busy with internal calculations)
85 hex No access methods defined
87 hex Know-how protection active, access locked
C8 hex Change request below the currently valid limit (change request to a value that lies within the "absolute" limits,
but is however below the currently valid lower limit)
C9 hex Change request above the currently valid limit (example: a parameter value is too large for the drive power)
CC hex Change request not permitted (change is not permitted as the access code is not available)
Table 9- 63 ErrorID[1]
ID Description
0×000 No fault active
0×001 Internal telegram error active
0×002 Parameterization error active
0×003 RDREC and WRREC call error active
0×004 Cancelation of the job during the active data transfer by resetting the Start input to "0"
0×005 Unknown data type detected;
evaluation of the ErrorID[2] shows the parameter with unknown data type in the highest value bit
Table 9- 64 ErrorID[2]
ID Description
0×01 Unknown error
Table 9- 65 STATUS
S7-200 SMART
606 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.8 SINAMICS Library
2 E: 1= an error occurs
3 Error code: The system error code. For detailed information, refer to System-defined error
Table 9- 66 Status_bit
Example
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 607
Libraries
9.8 SINAMICS Library
2. Read the parameters from the drive to get the parameter data type information.
– Set the variable "Read_Write" to 0 to initiate a task of reading drive parameters.
– Enter the device parameter information in the variable "Device_info".
– Enter the axis number in VB16 "Axis number".
– Enter the parameter number in the variable "Parameter_No". Enter the index in the
variable "Index_No".
– Set the variable "Start_pulse" to 1 to start the task.
Result:
If the parameter data type is REAL, the variable "Read_REAL_value" displays the value.
If the parameter data type is DINT, the variable "Read_DINT_value" displays the value.
3. Set the variable "Read_Write" to 1 to initiate a task of writing the parameters to the drive.
S7-200 SMART
608 System Manual, V2.4, 03/2019, A5E03822230-AG
Libraries
9.9 Creating a user-defined library of instructions
Creating a library
To create a user-defined library of instructions, you create standard
STEP 7-Micro/WIN SMART subroutines and group them together. By grouping these
subroutines into a library, you can hide the code. Putting code into a library helps prevent
unwanted changes and provides a higher degree of protection for the technology (know-
how) of the author.
To create a user-defined library, perform the following tasks:
1. Write the program as a standard project and put the function to be included in the library
into subroutines.
2. Ensure that you have assigned a symbolic name to all V memory addresses in the
subroutines or interrupt routines. To minimize the amount of V memory that the library
requires, use sequential V memory addresses.
3. Rename the subroutines to the names that you want to appear in the instruction library.
4. Select the subroutines that you want to include in the library.
5. Click the Create button from the Libraries area of the File menu ribbon strip to
compile and create the new library. If the subroutine references interrupts, STEP 7-
Micro/WIN SMART also includes the interrupt routines in the library.
The libraries that you create are available for new or existing projects. They are not available
for the project from which you created them.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 609
Libraries
9.9 Creating a user-defined library of instructions
Further information
See the STEP 7-Micro/WIN SMART online help library topics for library programming tips
and a user-defined library example.
Note
Using custom libraries
You must be responsible for testing any libraries that you add to your project. Siemens bears
no responsibility for custom libraries.
If the CPU in your project does not support the instructions in your library, you will get errors
when you compile.
S7-200 SMART
610 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting 10
STEP 7-Micro/WIN SMART provides software tools to help you debug and test your
program. These features include viewing the status of the program as it is executed by the
CPU, selecting to run the CPU for a specified number of scans, and forcing values.
Use the hardware troubleshooting guide (Page 622) as a guide for determining the cause
and possible solution when troubleshooting problems with the hardware.
Toggle Bookmark: Click this button to set or remove a bookmark at the pro-
gram network designated by the current cursor location.
Next Bookmark: Click this button to move to the next bookmarked network of
your program.
Previous Bookmark: Click this button to move to the previous bookmarked
network of your program.
Remove All Bookmarks: Click this button to remove all bookmarks in your
program.
Note
You must compile your program in order to view the cross reference table.
Use the cross reference table when you want to know whether a symbolic name or memory
assignment is already in use in your program, and where it is used. The cross reference
table identifies all operands used in the program, and identifies the POU, network or line
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 611
Debugging and troubleshooting
10.1 Debugging your program
location, and instruction context of the operand each time it is used. Double-clicking an
element in the cross-reference table displays that part of your POU.
Element refers to the operands used in your program. You can use the toggle button to
toggle between symbolic and absolute addressing to change the representation of all
operands.
● Block refers to the POU where the operand is used.
● Location refers to the line or network where the operand is used.
● Context refers to the program instruction where the operand is used.
Examples
The following examples show the cross-reference table for a simple program in all three
languages: LAD, FBD, and STL.
FBD
STL
S7-200 SMART
612 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting
10.2 Displaying program status
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 613
Debugging and troubleshooting
10.2 Displaying program status
S7-200 SMART
614 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting
10.2 Displaying program status
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 615
Debugging and troubleshooting
10.3 Using a status chart to monitor your program
Type Select the font type for STL program status text.
Style Select Regular, Italic, Bold, or Bold Italic for the text style.
Size Select the point size for the font.
Watch Values The check boxes and selection boxes allow you to include or re-
move operands, stack values, and instruction status bits (that is,
flags) from the Program Status display.
Number of operands If you chose to include operands in the Program Status display,
you can edit the Operands list box to display more or fewer oper-
ands. The maximum number possible is 17.
Number of Stack Bits If you chose to include logic stack values in the Program Status
display, you can edit the Logic Stack list box to display more or
fewer stack values. The maximum number possible is four.
Instruction Status Bits If you chose to include instruction status bits in the program status
display, select the Instruction Status Bits that you want to be
shown and which (if any) should be omitted.
A check mark indicates that you are choosing to watch a particular
status bit in the program status display; if you deselect the check-
box, STEP 7-Micro/WIN SMART does not display that status bit in
the Program Status.
See also
How to display status in the program editor (Page 613)
S7-200 SMART
616 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting
10.3 Using a status chart to monitor your program
After you successfully insert a new status chart, the new chart appears under "Status Chart"
in the project tree and a new tab appears at the bottom of the Status Chart window.
– From the Insert area of the Edit menu ribbon strip, click the "Row" button.
– Right-click a cell in the status chart to bring up a context menu, and select the menu
command Insert > Row.
The new row is inserted above the current location of the cursor in the status chart.
You can also place the cursor in the last cell of the last row and press the DOWN
ARROW key to insert a row at the bottom of the status chart.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 617
Debugging and troubleshooting
10.4 Forcing specific values
When creating a chart from the program editor, note that only the first 150 addresses can be
added each time you select "Create Status Chart". After STEP 7-Micro/WIN SMART creates
the status chart, you can edit the chart entries.
You can also add an entry to a status chart by pressing the Ctrl key and dragging an
operand from the LAD or FBD program editor to the status chart. From STL, you can select
an address and drag it to a status chart.
Additionally, you can also copy and paste data from a Microsoft Excel spreadsheet.
Note
A project can store a maximum of 32 status charts.
S7-200 SMART
618 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting
10.5 Writing and forcing outputs in STOP mode
● V memory, M memory or PROFINET I/O values can be forced in bytes, words, or double
words.
● Analog values are forced as words only, on even-numbered byte boundaries, such as
AIW6 or AQW14. All forced values are stored in the non-volatile memory of the CPU.
Note
You cannot transfer force information for PROFINET ports with a SD card.
Because the forced data might be changed during the scan cycle (either by the program, by
the I/O update cycle, or by the communication-processing cycle), the CPU reapplies the
forced values at various times in the scan cycle.
● Reading the inputs: The CPU applies the forced values to the inputs as they are read.
● Executing the control logic in the program: The CPU applies the forced values to all
immediate I/O accesses. Forced values are applied for up to 16 memory values after the
program has been executed.
● Processing any communications requests: The CPU applies the forced values to all
read/write communications accesses.
● Writing to the outputs: The CPU applies the forced values to the outputs as they are
written.
Note
The Force function overrides a Read Immediate or Write Immediate instruction. The
Force function also overrides the STOP mode values that you configured in the system
block (Page 126). If the CPU goes to STOP mode, the output reflects the forced value
and not the STOP mode value that you configured for the output in the system block.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 619
Debugging and troubleshooting
10.6 How to execute a limited number of scans
The S7-200 SMART PLCs support writing and forcing outputs (both analog and digital) while
the PLC is in STOP mode. However, as a safety precaution, you must specifically enable
this functionality in STEP 7-Micro/WIN SMART with the "Force in Stop" setting.
WARNING
Effect on process equipment of writing or forcing outputs
If you have connected the S7-200 SMART PLC to process equipment when you write or
force an output, the PLC can transmit these changes to the equipment. This could result in
unanticipated activity in the equipment, which could cause death or serious injury to
personnel, and/ or property damage.
Only write or force outputs when your process equipment can safely accept those changes.
By default, STEP 7-Micro/WIN SMART does not enable "Force in STOP". STEP 7-
Micro/WIN SMART prevents you from writing or forcing outputs while the PLC is in STOP
mode. Clicking the "Force in STOP" button from the Debug menu enables writing and forcing
for the current editing session with the current project. When you open a different project,
"Force in STOP" returns to its default state and STEP 7-Micro/WIN SMART prevents you
from either writing or forcing output addresses while the PLC is in STOP mode.
The status LEDs (Page 90) indicate whether the CPU has any forced data in STOP mode.
S7-200 SMART
620 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting
10.6 How to execute a limited number of scans
2. Enter a value for the desired number of scans, and click "Start" to execute the number of
scans you entered.
Note
When you are ready to resume normal program operation, change the PLC back to RUN
mode (Page 41).
See also
Overview of debugging and monitoring features (Page 611)
How to display status in the editor windows (Page 613)
How to display status in a status chart (Page 616)
How to download a program (Page 78)
Timestamp mismatch error (Page 822) (ensuring that project in programming device
matches project in PLC)
Cross reference and element usage (Page 611) (ensuring that program edits do not cause
duplicate assignments)
Forcing values (Page 618)
Forcing outputs in STOP mode (Page 619)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 621
Debugging and troubleshooting
10.7 Hardware troubleshooting guide
S7-200 SMART
622 System Manual, V2.4, 03/2019, A5E03822230-AG
Debugging and troubleshooting
10.7 Hardware troubleshooting guide
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 623
PID loops and tuning 11
PID auto-tune capability is incorporated into the CPU, and STEP 7-Micro/WIN SMART adds
a PID Tune control panel. Together, these two features greatly enhance the utility and ease-
of-use of the PID function provided.
You can initiate auto-tune in the user program, from an operator panel, or by the PID Tune
control panel. The PID Auto-Tuner computes suggested (near optimum) values for the gain,
integral time (reset), and derivative time (rate) tuning values. You can select tuning for fast,
medium, slow, or very slow response of your loop.
With the PID Tune control panel, you can initiate the auto-tuning process, abort the auto-
tuning process, and monitor the results in a graphical form. The control panel displays any
error conditions or warnings that might be generated. You can apply the gain, reset, and rate
values computed by auto-tune.
The purpose of the PID Auto-Tuner is to determine a set of tuning parameters that provide a
reasonable approximation to the optimum values for your loop. Starting with the suggested
tuning values will allow you to make fine tuning adjustments and truly optimize your process.
The auto-tuning algorithm used in the CPU is based upon a technique called relay feedback
suggested by K. J. Åström and T. Hägglund in 1984. Over the past twenty years, relay
feedback has been used across a wide variety of industries.
The relay feedback concept produces a small, but sustained oscillation in an otherwise
stable process. Based upon the period of the oscillations and the amplitude changes
observed in the process variable, the ultimate frequency and the ultimate gain of the process
are determined. Then, using the ultimate gain and ultimate frequency values, the PID Auto-
tuner suggests a value for the gain, reset, and rate tuning values.
The values suggested depend upon your selection for speed of response of the loop for your
process. You can select fast, medium, slow, or very slow response. Depending upon your
process, a fast response can overshoot and corresponds to an underdamped tuning
condition. A medium speed response can be on the verge of overshoot and corresponds to a
critically-damped tuning condition. A slow response cannot have any overshoot and
corresponds to an overdamped tuning condition. A very slow response cannot have
overshoot and corresponds to a heavily overdamped tuning condition.
In addition to suggesting tuning values, the PID Auto-tuner can automatically determine the
values for hysteresis and peak PV deviation. You use these parameters to reduce the effect
of the process noise, while limiting the amplitude of the sustained oscillations set up by the
PID Auto-Tuner.
The PID Auto-Tuner can determine suggested tuning values for both direct-acting and
reverse-acting P, PI, PD, and PID loops.
S7-200 SMART
624 System Manual, V2.4, 03/2019, A5E03822230-AG
PID loops and tuning
11.1 PID loop definition table
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 625
PID loops and tuning
11.1 PID loop definition table
S7-200 SMART
626 System Manual, V2.4, 03/2019, A5E03822230-AG
PID loops and tuning
11.1 PID loop definition table
Field Description
AT Control (ACNTL)
Input - Byte
W0 Warning: The deviation setting is not four times greater than the hysteresis set-
ting.
W1 Warning: Inconsistent process deviations may result in incorrect adjustment of the
output step value.
W2 Warning: Actual average deviation is not four times greater than the hysteresis
setting.
AH Auto-hysteresis calculation in progress:
0 - not in progress
1 - in progress
IP Auto-tune in progress:
0 - not in progress
1 - in progress
Each time an auto-tune sequence is started the CPU clears the warning bits and sets the in
progress bit. Upon completion of auto-tune, the CPU clears the in progress bit.
AT Result (ARES)
Input/Output - Byte
① Result code
D Done bit:
0 - auto-tune not complete
1 - auto-tune complete
Must be set to 0 before auto-tune can start
Result 00 - completed normally (suggested tuning values available)
Code 01 - aborted by the user
02 - aborted, watchdog timed out waiting for a zero crossing
03 - aborted, process (PV) out-of-range
04 - aborted, maximum hysteresis value exceeded
05 - aborted, illegal configuration value detected
06 - aborted, numeric error detected
07 - aborted, PID instruction executed without having power flow (loop in manual
mode)
08 - aborted, auto-tuning allowed only for P, PI, PD, or PID loops
09 to 7F - reserved
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 627
PID loops and tuning
11.2 Prerequisites
Field Description
AT Config (ACNFG)
Input - Byte
R1 R0 Dynamic response
0 0 Fast response
0 1 Medium response
1 0 Slow response
1 1 Very slow response
DS Deviation setting:
0 - use deviation value from loop table
1 - determine deviation value automatically
HS Hysteresis setting:
0 - use hysteresis value from loop table
1 - determine hysteresis value automatically
Note
The standard PID instruction (Page 288) is not used directly by projects with PID wizard
configurations. If you use a PID wizard configuration, then your program must use
"PIDx_CTRL", to activate the PID wizard subroutine.
To simplify the use of PID loop control in your application, STEP 7-Micro/WIN SMART
provides a PID wizard (Page 290) to configure your PID loops.
11.2 Prerequisites
The loop that you want to auto-tune must be in automatic mode. The loop output must be
controlled by the execution of the PID instruction. Auto-tune will fail if the loop is in manual
mode.
Before initiating an auto-tune operation, your process must be brought to a stable state
which means that the PV has reached setpoint (or for a P-type loop, a constant difference
between PV and setpoint) and the output is not changing erratically.
Ideally, the loop output value needs to be near the center of the control range when auto-
tuning is started. The auto-tune procedure sets up an oscillation in the process by making
small step changes in the loop output. If the loop output is close to either extreme of its
control range, the step changes introduced in the auto-tune procedure can cause the output
value to attempt to exceed the minimum or the maximum range limit.
If this happens, the generation of an auto-tune error condition results, and the determination
of less than near optimal suggested values certainly results.
S7-200 SMART
628 System Manual, V2.4, 03/2019, A5E03822230-AG
PID loops and tuning
11.3 Auto-hysteresis and auto-deviation
Hysteresis parameter
The hysteresis parameter specifies the excursion (plus or minus) from setpoint that the PV
(process variable) is allowed to make without causing the relay controller to change the
output. This value is used to minimize the effect of noise in the PV signal to more accurately
determine the natural oscillation frequency of the process.
If you select to automatically determine the hysteresis value, the PID Auto-Tuner will enter a
hysteresis determination sequence. This sequence involves sampling the process variable
for a period of time and then performing a standard deviation calculation on the sample
results.
In order to have a statistically meaningful sample, a set of at least 100 samples must be
acquired. For a loop with a sample time of 200 msec, acquiring 100 samples takes 20
seconds. For loops with a longer sample time it will take longer. Even though 100 samples
can be acquired in less than 20 seconds for loops with sample times less than 200 msec, the
hysteresis determination sequence always acquires samples for at least 20 seconds.
Once all the samples have been acquired, the standard deviation for the sample set is
calculated. The hysteresis value is defined to be two times the standard deviation. The
calculated hysteresis value is written into the actual hysteresis field (AHYS) of the loop table.
Note
While the auto-hysteresis sequence is in progress, the normal PID calculation is not
performed. Therefore, it is imperative that the process be in a stable state prior to initiating
an auto-tune sequence. This will yield a better result for the hysteresis value and it will
ensure that the process does not go out of control during the auto-hysteresis determination
sequence.
Deviation parameter
The deviation parameter specifies the desired peak-to-peak swing of the PV around the
setpoint. If you select to automatically determine this value, the desired deviation of the PV is
computed by multiplying the hysteresis value by 4.5. The output will be driven proportionally
to induce this magnitude of oscillation in the process during auto-tuning.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 629
PID loops and tuning
11.4 Auto-tune sequence
The tuner continues to sample the PV and waits for the next zero-crossing event. The tuner
requires a total of twelve zero-crossings to complete the sequence. The magnitude of the
observed peak-to-peak PV values (peak error) and the rate at which zero-crossings occur
are directly related to the dynamics of the process.
Early in the auto-tuning process, the output step value is proportionally adjusted once to
induce subsequent peak-to-peak swings of the PV to more closely match the desired
deviation amount. Once the adjustment is made, the new output step amount is written into
the Actual Step Size field (ASTEP) of the loop table.
If the time between zero-crossings exceeds the zero-crossing watchdog interval time, the
auto-tuning sequence is terminated with an error. The default value for the zero-crossing
watchdog interval time is two hours.
The following figure shows the output and process variable behaviors during an auto-tuning
sequence on a direct acting loop. You use the PID Tune control panel to initiate and monitor
the tuning sequence.
Notice how the auto-tuner switches the output to cause the process (as evidenced by the PV
value) to undergo small oscillations. The frequency and the amplitude of the PV oscillations
are indicative of the process gain and natural frequency.
Based upon the information collected about the frequency and gain of the process during the
auto-tune process, the ultimate gain and ultimate frequency values are calculated. From
these values, the suggested values for gain (loop gain), reset (integral time), and rate
(derivative time) are calculated.
Note
Your loop type determines which tuning values are calculated by the auto-tuner. For
example, for a PI loop, the auto-tuner will calculate gain and integral time values, but the
suggested derivative time will be 0.0 (no derivative action).
Once the auto-tune sequence has completed, the output of the loop is returned to its initial
value. The next time the loop is executed, the normal PID calculation will be performed.
S7-200 SMART
630 System Manual, V2.4, 03/2019, A5E03822230-AG
PID loops and tuning
11.5 Exception conditions
Warning conditions
Tuning execution can generate three warning conditions. Tuning execution reports these
warnings in three bits of the ASTAT field of the loop table, and, once set, these bits remain
set until the next auto-tune sequence is initiated:
● Warning 0: Generated if the deviation value is not at least 4X greater than the hysteresis
value. This check is performed when the hysteresis value is actually known, which
depends upon the auto-hysteresis setting.
● Warning 1: Generated if there is more than an 8X difference between the two peak error
values gathered during the first 2.5 cycles of the auto-tune procedure
● Warning 2: Generated if the measured average peak error is not at least 4X greater than
the hysteresis value
Error conditions
In addition to the warning conditions, several error conditions are possible. The following
table lists the error conditions, along with a description of the cause of each error.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 631
PID loops and tuning
11.6 Notes concerning PV out-of-range (result code 3)
● Open the Tools folder in the project tree, select the "PID Tune Control Panel" node and
press Enter; or double-click the "PID Tune Control Panel" node.
STEP 7-Micro/WIN SMART opens the PID control panel if the connected CPU is in RUN
mode:
S7-200 SMART
632 System Manual, V2.4, 03/2019, A5E03822230-AG
PID loops and tuning
11.7 PID Tune control panel
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 633
PID loops and tuning
11.7 PID Tune control panel
● Sampling: In the "Sampling" area, you can select the graphical display sampling rate from
1 to 480 seconds per sample.
You can freeze the graph by clicking the "Pause" button. Click the "Resume" button to
resume sampling data at the selected rate. To clear the graph, select "Clear" from the
right-mouse button within the graph.
● Advanced Options: You can use the "Options" button to further configure parameters for
the auto-tuning process. (See the figure below.)
From the advanced screen, you can check the box that causes the auto-tuner to
automatically determine the values for the Hysteresis and Deviation (default setting), or
you can enter the values for these fields that minimize the disturbance to your process
during the auto-tune procedure.
In the "Dynamic Response" field, use the dropdown button to select the type of loop
response (Fast, Medium, Slow, or Very Slow) that you wish to have for your process.
Depending upon your process, a fast response may have overshoot and would
correspond to an underdamped tuning condition. A medium speed response may be on
the verge of having overshoot and would correspond to a critically damped tuning
condition. A slow response may not have any overshoot and would correspond to an
overdamped tuning condition. A very slow response may not have overshoot and would
correspond to a heavily overdamped tuning condition.
Once you have made the desired selections, click OK to return to the main screen of the
PID Tune Control Panel.
Loop monitoring
After you have completed the auto-tune sequence and have transferred the suggested
tuning parameters to the CPU, you can use the control panel to monitor your loop's response
to a step change in the setpoint.
S7-200 SMART
634 System Manual, V2.4, 03/2019, A5E03822230-AG
PID loops and tuning
11.7 PID Tune control panel
In the figure below, the loop responds to a setpoint change with the original tuning
parameters (before running auto-tune). Notice the overshoot and the long, damped ringing
behavior of the process using the original tuning parameters.
The loop responds to the same setpoint change after applying the values determined by the
auto-tune process using the selection for a fast response. Notice that for this process there is
no overshoot, but there is just a little bit of ringing.
To eliminate the ringing at the expense of the speed of response, select a medium or a slow
response and re-run the auto-tuning process.
After you have a good starting point for the tuning parameters for your loop, you can use the
control panel to tweak the parameters. Then you can monitor the loop's response to a
setpoint change. In this way, you can fine tune your process for an optimum response in
your application.
To simplify the use of PID loop control in your application, STEP 7-Micro/WIN SMART
provides a PID wizard (Page 290) to configure your PID loops.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 635
Open loop motion control 12
The S7-200 SMART CPU provides three methods of open loop motion control:
● Pulse Train Output (PTO): Built into the CPU for speed and position control. See Pulse
Output instruction. (Note: There is no PTO wizard available. Use the Motion wizard
instead.)
● Pulse Width Modulation (PWM): Built into the CPU for speed, position, or duty cycle
control. See Pulse Output instruction.
● Axis of Motion: Built into the CPU for speed and position control
The CPU provides three digital outputs (Q0.0, Q0.1, and Q0.3) that you can configure as
PTO or PWM outputs by the PLS Instruction, PWM outputs by the PWM wizard, or as motion
control outputs by the Motion wizard.
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support
motion control.
When you configure an output for PTO operation, the CPU generates a 50% duty cycle
pulse train for open loop control of the speed and position for either stepper motors or servo
motors. The built-in PTO function only provides the pulse train output. Your application
program must supply direction and limit controls using I/O built into the PLC or provided by
expansion modules.
When you configure an output for PWM operation, the CPU fixes the cycle time of the
output, and your program controls the pulse width or duty cycle of the pulse. You can use the
variations in pulse width to control the speed or position in your application.
The Axis of Motion provides a single pulse train output with integrated direction control and
disable outputs. It also includes programmable inputs which allow the CPU to be configured
for several modes of operation, including automatic reference point seek. The Axis of Motion
provides a unified solution for open loop control of the speed and position for either stepper
motors or servo motors.
To simplify the use of motion control in your application, STEP 7-Micro/WIN SMART
provides a Motion wizard to configure Axis of Motion and a PWM wizard to configure PWM.
The wizards generate motion instructions that you can use to provide dynamic control of
speed and motion in your application. For the Axis of Motion, STEP 7-Micro/WIN SMART
also provides a control panel that allows you to control, monitor, and test your motion
operations.
S7-200 SMART
636 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.1 Using the PWM output
Since the PWM output can be varied from 0% to 100%, it provides a digital output that in
many ways is analogous to an analog output. For example the PWM output can be used to
control the speed of a motor from stop to full speed or it can be used to control the position
of a valve from closed to full open.
● Open the Wizards folder in the project tree and double-click "PWM", or select "PWM" and
press the Enter key.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 637
Open loop motion control
12.1 Using the PWM output
Note
PWM channels are hard-coded to specific outputs:
• PWM0 is assigned to Q0.0.
• PWM1 is assigned to Q0.1.
• PWM2 is assigned to Q0.3.
The Cycle input is a word value that defines the cycle time for the pulse width modulation
(PWM) output. The allowed range is from 2 to 65535 when milliseconds is the time base and
10 to 65535 when microseconds is the time base.
The Pulse input is a word value that defines the pulse width (Duty Cycle) for the PWM
output. The allowed range of values is from 0 to 65535 units of the time base (microseconds
or milliseconds) that was specified within the PWM wizard.
S7-200 SMART
638 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.2 Using motion control
The Error is a byte value returned by the PWMx_RUN subroutine that indicates the result of
execution. See the following table for a description of the possible error codes.
① MAX_SPEED
② SS_SPEED
● MAX_SPEED: Enter the value for the optimum operating speed of your application within
the torque capability of your motor. The torque required to drive the load is determined by
friction, inertia, and the acceleration/deceleration times.
● The Motion wizard calculates and displays the minimum speed that can be controlled by
the Axis of Motion based upon the MAX_SPEED that you specify.
● SS_SPEED: Enter a value within the capability of your motor to drive your load at low
speeds. If the SS_SPEED value is too low, the motor and load could vibrate or move in
short jumps at the beginning and end of travel. If the SS_SPEED value is too high, the
motor could lose pulses on start up, and the load could overdrive the motor when
attempting to stop.
Motor data sheets have different ways of specifying the start/stop (or pull-in/pull-out) speed
for a motor and given load. Typically, a useful SS_SPEED value is 5% to 15% of the
MAX_SPEED value. To help you select the correct speeds for your application, refer to the
data sheet for your motor. The following figure shows a typical motor torque/speed curve.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 639
Open loop motion control
12.2 Using motion control
① MAX_SPEED
② SS_SPEED
③ ACCEL_TIME
④ DECEL_TIME
Note
Motor acceleration and deceleration times are determined by trial and error. You should start
by entering a large value. Optimize these settings for the application by gradually reducing
the times until the motor starts to stall.
S7-200 SMART
640 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.2 Using motion control
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 641
Open loop motion control
12.2 Using motion control
S7-200 SMART
642 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.3 Features of motion control
You specify the target speed and ending position or number of pulses for each step.
Additional steps are entered one at a time. The figure illustrates a one-step, two-step, three-
step, and a four-step profile.
Notice that a one-step profile has one constant speed segment, a two-step profile has two
constant speed segments, and so on. The number of steps in the profile matches the
number of constant speed segments of the profile.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 643
Open loop motion control
12.3 Features of motion control
Signal Description
STP The STP input causes the CPU to stop the motion in progress. You can select the desired operation of
STP within the Motion wizard.
RPS The RPS (Reference Point Switch) input establishes the reference point or home position for absolute
move operations. In some modes, the RPS input is also used to stop the motion in progress after travel-
ling a specified distance.
ZP The ZP (Zero Pulse) input helps establish the reference point or home position. Typically, the motor
driver/amplifier pulses ZP once per motor revolution.
Note: Only used in RP Seek Modes of 3 and 4.
LMT+ LMT+ and LMT- inputs establish the maximum limits for motion travel. The Motion wizard allows you to
LMT- configure the operation of LMT+ and LMT- inputs.
TRIG The TRIG (Trigger) input causes the CPU, in some modes, to stop the motion in progress after travelling
a specified distance.
WARNING
Risks with changes to filter time for digital input channel
If the filter time for a digital input channel is changed from a previous setting, a new "0"
level input value may need to be presented for up to 12.8 ms accumulated duration before
the filter becomes fully responsive to new inputs. During this time, short "0" pulse events of
duration less than 12.8 ms may not be detected or counted.
This changing of filter times can result in unexpected machine or process operation, which
may cause death or serious injury to personnel, and/or damage to equipment.
To ensure that a new filter time goes immediately into effect, cycle the power of the CPU.
S7-200 SMART
644 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.4 Programming an Axis of Motion
Signal Description
P0 P0 and P1 are pulse outputs that control the movement and direction of movement of the motor.
P1
DIS DIS is an output used to disable or enable the motor driver/amplifier.
Note
Make sure to match the measurement system configuration to the pulses/revolution and
distance/revolution specifications of your stepper/servo motor controller system.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 645
Open loop motion control
12.5 Configuring an Axis of Motion
Configuration/profile table
You must create a configuration/profile table for the Axis of Motion in order for the CPU to
control your motion application. The Motion wizard makes the configuration process quick
and easy by leading you step-by-step through the configuration process. Refer to the
"Advanced Topics" section of this chapter for detailed information about the
configuration/profile table.
The Motion wizard also allows you to create the configuration/profile table offline. You can
create the configuration without being connected to a CPU.
S7-200 SMART
646 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.5 Configuring an Axis of Motion
Table 12- 5 STP, RPS, LMT+, LMT-, TRIG, and ZP pin locations
Note
After you configure an input to a specific function (for example, RPS) for a particular Axis of
Motion, you cannot use that input for any other Axis of Motion or for any other input, counter,
or interrupt function.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 647
Open loop motion control
12.5 Configuring an Axis of Motion
Note
High-speed input wiring must use shielded cables
Use shielded cable with a maximum length of 50 m, when connecting HSC input channels
I0.0, I0.1, I0.2, and I0.3.
DIS outputs
If an axis has a DIS output configured, then an entry is present in the mapping table for that
output. The DIS output is also hard-coded to specific outputs based upon the following rules:
● DIS for Axis 0 is always configured for Q0.4.
● DIS for Axis 1 is always configured for Q0.5.
● DIS for Axis 2 is always configured for Q0.6.
Pulse output units are connected to standard 24V outputs.
S7-200 SMART
648 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.5 Configuring an Axis of Motion
WARNING
Risks with changes to filter time for digital input channel
If the filter time for a digital input channel is changed from a previous setting, a new "0"
level input value may need to be presented for up to 12.8 ms accumulated duration
before the filter becomes fully responsive to new inputs. During this time, short "0" pulse
events of duration less than 12.8 ms may not be detected or counted.
This changing of filter times can result in unexpected machine or process operation,
which may cause death or serious injury to personnel, and/or damage to equipment.
To ensure that a new filter time goes immediately into effect, a power cycle of the CPU
must be applied.
● In the "Directional Control" node, you can select the following "Phasing" modes:
– Single phase (2 output)
– Two-phase (2 output)
– AB quadrature phase (2 output)
– Single phase (1 output)
You can also select the "Polarity" (positive or negative) of the outputs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 649
Open loop motion control
12.5 Configuring an Axis of Motion
Phasing
You have four options for the "Phasing" interface to the stepper/servo drive. These options
are as follows:
● Single phase (2 output): If you select the single phase (2 output) option, then one output
(P0) controls the pulsing, and one output (P1) controls the direction. P1 is high (active) if
pulsing is in the positive direction. P1 is low (inactive) if pulsing is in the negative
direction. Single phase (2 output) is shown in the figure below (assuming positive
polarity):
● Two-phase (2 output): If you select the Two-phase (2 output) option, then one output (P0)
pulses for positive directions, and a different output (P1) pulses for negative directions.
Two-phase (2 output) is shown in the figure below (assuming positive polarity):
● AB quadrature phase (2 output): If you select the AB quadrature phase (2 output) option,
then both outputs pulse at the speed specified, but 90 degrees out-of-phase. The AB
quadrature phase (2 output) is a 1X configuration, meaning a generated pulse is
measured from one positive transition of the output to the next positive transition of the
same output. In this case, the direction is determined by which output transitions high
first. P0 leads P1 for the positive direction. P1 leads P0 for the negative direction. AB
quadrature phase (2 output) is shown in the figures below (assuming positive polarity):
P0 leads P1 P1 leads P0
● Single phase (1 output): If you select the single phase (1 output) option, then the output
(P0) controls the pulsing. Only positive motion commands are accepted by the CPU in
this mode. The Motion wizard restricts you from making illegal negative configurations
when you select this mode. You can save an output if your motion application is in one
S7-200 SMART
650 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.5 Configuring an Axis of Motion
direction only. Single phase (1 output) is shown in the figure below (assuming positive
polarity):
Polarity
You can switch positive and negative directions with the "Polarity" parameter. If the motor is
wired in the wrong direction, this is typically done. You can avoid re-wiring the hardware by
setting this parameter to negative. The negative setting changes the output operation as
follows:
● Single phase (2 output): P1 is low (inactive) if pulsing is in the positive direction. P1 is
high (active) if pulsing is in the negative direction. This is shown in the figure below:
● Two-phase (2 output): P0 pulses for negative directions. P1 pulses for positive directions.
This is shown in the figure below:
P1 leads P0 P0 leads P1
● Single phase (1 output): Negative polarity is not allowed in this phasing mode.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 651
Open loop motion control
12.5 Configuring an Axis of Motion
The default setting for the "Directional Control" dialog is "Single phase (2 output)" and
"Positive polarity".
Note
You cannot choose to which pins P0 and P1 are configured; this is hardcoded to a specific
pin. Refer to the Mapping I/O section (preceding this section) for the pin mapping list.
WARNING
Safety precautions when using an Axis of Motion
The limit and stop functions in the Axis of Motion are electronic logic implementations that
do not provide the level of protection provided by electromechanical controls.
Control devices and Axis of Motion functions can fail in unsafe conditions, which can result
in unpredictable operation of controlled equipment. Such unpredictable operations could
result in death or serious personal injury, and/or property damage.
Consider using an emergency stop function, electromechanical overrides, or redundant
safeguards that are independent of the Axis of Motion and the CPU.
S7-200 SMART
652 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.5 Configuring an Axis of Motion
① MAX_SPEED
② JOG_SPEED
③ SS_SPEED
④ JOG_INCREMENT: JOG command is active for less than 0.5 seconds.
⑤ JOG command is active for more than 0.5 seconds.
⑥ JOG command is terminated (Starts ramp from JOG_SPEED to SS_SPEED).
⑦ The speed reached can be anywhere from the SS_SPEED to the JOG_SPEED, depending
on the length of the JOG_INCREMENT.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 653
Open loop motion control
12.5 Configuring an Axis of Motion
Jerk compensation is also known as "S curve profiling". This compensation is applied equally
to the beginning and ending portions of both the acceleration and deceleration curve. Jerk
compensation is not applied to the initial and final step between zero speed and SS_SPEED.
Specify the jerk compensation by entering a time value (JERK_TIME). This is the time
required for acceleration to change from zero to the maximum acceleration rate. A longer
jerk time yields smoother operation with a smaller increase in total cycle time than would be
obtained by decreasing the ACCEL_TIME and DECEL_TIME. A value of 0 ms (the default
value) indicates that no compensation is to be applied.
Note
A good first value for JERK_TIME is 40% of ACCEL_TIME.
Note
Jerk compensation is not available for two speed moves, manual speed change moves,
aborted moves, and automatic deceleration reactions upon reaching a limit or STP input.
S7-200 SMART
654 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.5 Configuring an Axis of Motion
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 655
Open loop motion control
12.5 Configuring an Axis of Motion
5. The Axis of Motion provides a reference point switch (RPS) input that is used when
seeking the RP. The RP is identified by a method of locating an exact position with
respect to the RPS. The RP can be centered in the RPS Active zone, the RP can be
located on the edge of the RPS Active zone, or the RP can be located a specified number
of zero pulse (ZP) input transitions from the edge of the RPS Active zone.
6. You can configure the sequence that the Axis of Motion uses to search for the reference
point. The following figure shows a simplified diagram of the default RP search sequence.
Select one of the following options for the RP search sequence:
– RP Seek mode 0: Does not perform a RP seek sequence
– RP Seek mode 1: The RP is where the RPS input goes active on the approach from
the work zone side. (Default)
– RP Seek mode 2: The RP is centered within the active region of the RPS input.
– RP Seek mode 3: The RP is located outside the active region of the RPS input.
RP_Z_CNT specifies how many ZP (Zero Pulse) input counts should be received after
the RPS becomes inactive.
– RP Seek mode 4: The RP is generally within the active region of the RPS input.
RP_Z_CNT specifies how many ZP (Zero Pulse) input counts should be received after
the RPS becomes active.
RP seek mode 1
Note
The RPS Active region (which is the distance that the RPS input remains active) must be
greater than the distance required to decelerate from the RP_FAST speed to the RP_SLOW
speed. If the distance is too short, the Axis of Motion generates an error.
S7-200 SMART
656 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.5 Configuring an Axis of Motion
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 657
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Note
Because the Motion wizard makes changes to the program block, the data block, and the
system block, you must download all three blocks to the CPU. Otherwise, the Axis of
Motion will not have all the program components that it needs for proper operation.
12.6 Subroutines created by the Motion wizard for the Axis of Motion
You must ensure for each motion action that only one motion subroutine is active at a time in
addition to the AXISx_CTRL, which must be active every scan. Each motion subroutine is
prefixed with an "AXISx_" where "x" is the axis number channel. There are 13 motion
subroutines.
S7-200 SMART
658 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Note
The motion subroutines increase the amount of memory required for your program by up to
1700 bytes. You can delete unused motion subroutines to reduce the amount of memory
required. To prevent the generation of unneeded motion subroutines, uncheck the
"Generate" box for each unneeded subroutine in the "Components" node of the Motion
wizard. To restore generation of a particular motion subroutine, start the Motion wizard
again, navigate to the "Components" node, and check the "Generate" box for the subroutine.
Click the "Generate" button to rebuild the wizard-generated subroutines.
See also
Using the Motion wizard (Page 636)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 659
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
● To move to a specific location, based upon inputs from your program, use the
AXISx_GOTO subroutine.
● To run the motion profiles you configured with the Motion wizard, use the AXISx_RUN
subroutine.
The MOD_EN parameter must be on to enable the other motion subroutines to send
commands to the Axis of Motion. If the MOD_EN parameter turns off, then the Axis of Motion
aborts any command that is in progress and performs a decelerated stop.
The output parameters of the AXISx_CTRL subroutine provide the current status of the Axis
of Motion.
The Done parameter turns on when the Axis of Motion completes any subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
The C_Pos parameter is the current position of the Axis of Motion. Based upon the units of
measurement, the value is either a number of pulses (DINT) or the number of engineering
units (REAL).
The C_Speed parameter provides the current speed of the Axis of Motion. If you configured
the measurement system for the Axis of Motion for pulses, C_Speed is a DINT value
containing the number of pulses/second. If you configured the measurement system for
engineering units, C_Speed is a REAL value containing the selected engineering
units/second (REAL).
S7-200 SMART
660 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Note
The Axis of Motion reads the configuration/profile table only at power-up or when
commanded to load the configuration.
• If you use the Motion wizard to modify the configuration, then the AXISx_CTRL
subroutine automatically commands the Axis of Motion to load the configuration/profile
table every time the CPU changes to RUN mode.
• If you use the Motion control panel to modify the configuration, clicking the Update
Configuration button commands the Axis of Motion to load the new
configuration/profile table.
• If you use another method to modify the configuration, then you must also issue an
AXISx_CFG command to the Axis of Motion to load the configuration/profile table.
Otherwise, the Axis of Motion continues to use the old configuration/profile table.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 661
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Enable the RUN (Run/Stop) parameter to command the Axis of Motion to accelerate to the
specified speed (Speed parameter) and direction (Dir parameter). You can change the value
of the Speed parameter while the motor is running, but the Dir parameter must remain
constant. Disabling the RUN parameter commands the Axis of Motion to decelerate until the
motor comes to a stop.
Enable the JOG_P (Jog Positive Rotation) or the JOG_N (Jog Negative Rotation) parameter
to command the Axis of Motion to jog in either a positive or negative direction. If the JOG_P
or JOG_N parameter remains enabled for less than 0.5 seconds, the Axis of Motion issues
pulses to travel the distance specified in JOG_INCREMENT. If the JOG_P or JOG_N
parameter remains enabled for 0.5 seconds or longer, the Axis of Motion begins to
accelerate to the specified JOG_SPEED.
The Speed parameter determines the speed when RUN is enabled. If you configured the
measuring system of the Axis of Motion for pulses, the speed is a DINT value for
pulses/second. If you configured the measuring system of the Axis of Motion for engineering
units, the speed is a REAL value for units/second. You can change this parameter while the
motor is running.
Note
The Axis of Motion may not react to small changes in the Speed parameter, especially if the
configured acceleration or deceleration time is short and the difference between the
configured maximum speed and start/stop speed is large.
The Dir parameter determines the direction to move when RUN is enabled. You cannot
change this value when the RUN parameter is enabled.
The Error parameter (Page 695) contains the result of this subroutine.
The C_Pos parameter contains the current position of the Axis of Motion. Based upon the
units of measurement selected, the value is either a number of pulses (DINT) or the number
of engineering units (REAL).
The C_Speed parameter contains the current speed of the Axis of Motion. Based upon the
units of measurement selected, the value is either the number of pulses/second (DINT) or
the engineering units/second (REAL).
The C_Dir parameter indicates the current direction of the motor:
● Signal state of 0 = positive
● Signal state of 1 = negative
S7-200 SMART
662 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the DONE
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a GOTO command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
subroutine sends a GOTO command to the Axis of Motion. To ensure that only one GOTO
command is sent, use an edge detection element to pulse the START parameter on.
The Pos parameter contains a value that signifies either the location to move (for an
absolute move) or the distance to move (for a relative move). Based upon the units of
measurement selected, the value is either a number of pulses (DINT) or the engineering
units (REAL).
The Speed parameter determines the maximum speed for this movement. Based upon the
units of measurement, the value is either a number of pulses/second (DINT) or the
engineering units/second (REAL).
The Mode parameter selects the type of move:
● 0: Absolute position
● 1: Relative position
● 2: Single-speed, continuous positive rotation
● 3: Single-speed, continuous negative rotation
The Done parameter turns on when the Axis of Motion completes this subroutine.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 663
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Turn on the Abort parameter to command the Axis of Motion to stop execution of this
command and decelerate until the motor comes to a stop.
The Error parameter (Page 695) contains the result of this subroutine.
The C_Pos parameter contains current position of the Axis of Motion. Based upon the units
of measurement, the value is either a number of pulses (DINT) or the number of engineering
units (REAL).
The C_Speed parameter contains the current speed of the Axis of Motion. Based upon the
units of measurement, the value is either a number of pulses/second (DINT) or the
engineering units/second (REAL).
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a RUN command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
subroutine sends a RUN command to the Axis of Motion. To ensure that only one command
is sent, use an edge detection element to pulse the START parameter on.
S7-200 SMART
664 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
The Profile parameter contains the number or the symbolic name for the motion profile. The
"Profile" input must be between 0 - 31. If not, the subroutine will return an error.
Turn on the Abort parameter to command the Axis of Motion to stop the current profile and
decelerate until the motor comes to a stop.
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
The C_Profile parameter contains the profile currently being executed by the Axis of Motion.
The C_Step parameter contains the step of the profile currently being executed.
The C_Pos parameter contains the current position of the Axis of Motion. Based upon the
units of measurement, the value is either a number of pulses (DINT) or the number of
engineering units (REAL).
The C_Speed parameter contains the current speed of the Axis of Motion. Based upon the
units of measurement, the value is either a number of pulses/second (DINT) or the
engineering units/second (REAL).
The default value for RP_OFFSET is 0. You can use the Motion wizard, the Motion Control
Panel, or the AXISx_LDOFF (Load Offset) subroutine to change the RP_OFFSET value.
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a RSEEK command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 665
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
subroutine sends a RSEEK command to the Axis of Motion. To ensure that only one
command is sent, use an edge detection element to pulse the START parameter on.
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a LDOFF command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
subroutine sends a LDOFF command to the Axis of Motion. To ensure that only one
command is sent, use an edge detection element to pulse the START parameter on.
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
S7-200 SMART
666 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a LDPOS command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
subroutine sends a LDPOS command to the Axis of Motion. To ensure that only one
command is sent, use an edge detection element to pulse the START parameter on.
The New_Pos parameter provides the new value to replace the current position value that
the Axis of Motion reports and uses for absolute moves. Based upon the units of
measurement, the value is either a number of pulses (DINT) or the engineering units
(REAL).
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
The C_Pos parameter contains the current position of the Axis of Motion. Based upon the
units of measurement, the value is either a number of pulses (DINT) or the number of
engineering units (REAL).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 667
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to copy the new time values to the configuration/profile table
and sends a SRATE command to the Axis of Motion. For each scan when the START
parameter is on and the Axis of Motion is not currently busy, the subroutine sends an
SRATE command to the Axis of Motion. To ensure that only one command is sent, use an
edge detection element to pulse the START parameter on.
The ACCEL_Time, DECEL_Time, and JERK_Time parameters determine the new
acceleration time, deceleration time, and jerk time in milliseconds (ms).
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
S7-200 SMART
668 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
When the EN bit turns on to enable the subroutine, the DIS_ON parameter controls the DIS
output of the Axis of Motion.
Note
If you have not defined a "DIS" output in the Motion wizard, the AXISx_DIS subroutine will
return an error.
The Error parameter (Page 695) contains the result of this subroutine.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 669
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a CFG command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
subroutine sends a CFG command to the Axis of Motion. To ensure that only one command
is sent, use an edge detection element to pulse the START parameter on.
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the Done
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to send a CACHE command to the Axis of Motion. For each
scan when the START parameter is on and the Axis of Motion is not currently busy, the
S7-200 SMART
670 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
subroutine sends a CACHE command to the Axis of Motion. To ensure that only one
command is sent, use an edge detection element to pulse the START parameter on.
The Profile parameter contains the number or the symbolic name for the motion profile. The
"Profile" input must be between 0 - 31. If not, the subroutine will return an error.
The Done parameter turns on when the Axis of Motion completes this subroutine.
The Error parameter (Page 695) contains the result of this subroutine.
Note
Execution of this command returns the actual current position of the axis. Position status
values provided in other motion subroutines, such as AXISx_CTRL, AXISx_GOTO, and so
forth, are updated periodically. Therefore, the position values reported by those commands
and the position value reported by this command may differ somewhat as a result and is
normal.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 671
Open loop motion control
12.6 Subroutines created by the Motion wizard for the Axis of Motion
Turn on the EN bit to enable the subroutine. Ensure that the EN bit stays on until the DONE
bit signals that the execution of the subroutine has completed.
Turn on the START parameter to obtain the current absolute position from the specified
drive. To ensure that only one operation to read the current position is performed, use an
edge detection element to pulse the START parameter on.
The RDY parameter indicates the readiness state of the servo drive, which is typically
provided by a digital output signal from the drive. This subroutine will read the absolute
position from the drive only if this parameter is on.
The INP parameter indicates the standstill state of the motor, which is typically provided by a
digital output signal from the drive. This subroutine will read the absolute position from the
drive only if this parameter is on.
The Res parameter must be set to the resolution of the absolute encoder connected to your
servo motor. For example, the single turn resolution of a SIMOTICS S-1FL6 servo motor with
absolute encoder is 20 bits or 1048576.
S7-200 SMART
672 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
Set the Drive parameter to match the RS485 address of the servo drive to be accessed by
this subroutine. Valid addresses of individual drives are 0 to 31.
Set the Port parameter to designate the CPU port to be used to communicate with the servo
drive:
● 0: Onboard RS485 port (Port 0)
● 1: RS485/RS232 signal board (if present, Port 1)
The Done parameter turns on when the subroutine’s work is complete.
The Error parameter (Page 695) contains the result of this subroutine.
The D_Pos parameter contains the current absolute position returned by the servo drive.
Note
To use this subroutine, you must configure the measurement system setting for this Axis of
Motion to Engineering Units.
Note
Additional subroutines
The Motion wizard also creates the subroutines ABSPOS_SBR and ABSPOS_INT when you
enable read position in the wizard configuration to read an absolute position from a drive.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 673
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
Table 12- 32 Example: Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS V90 servo
drive
S7-200 SMART
674 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
12.7.2 Interconnections
Digital I/O
Refer to the section "Connection examples with PLCs" in the SINAMICS V90 /
SIMOTICS S-1FL6 Operating Instructions document to find wiring diagrams for connection of
the suggested digital control signals between an S7-200 SMART CPU and a V90 servo
drive.
Communications
The AXISx_ABSPOS subroutine obtains the position data from the drive using serial
communications on the RS485 link between the two devices. Therefore, connect a cable
between the RS485 port on the S7-200 SMART CPU (or optionally the S7-200 SMART
CM01 signal board, if your CPU model supports it) and the RS485 port on the V90 servo
drive.
Refer to the appropriate sections of the S7-200 SMART System Manual and the
SINAMICS V90 / SIMOTICS S-1FL6 Operating Instructions documents for descriptions of
the RS485 ports on the S7-200 SMART CPU and V90 servo drive.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 675
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
12.7.3 Commissioning
To establish a common engineering unit definition between the CPU and the servo drive, you
must consider the following motion system variables when commissioning your system:
S7-200 SMART
676 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
Electronic gearing
In the V90 servo drive, the "a" and "b" values determine the drive’s electronic gear ratio, a
feature that allows a frequency conversion on the pulse train issued from the CPU. Since the
maximum pulse frequency issued from an Axis of Motion in the S7-200 SMART CPU is 100
kHz, while the encoder resolution of SIMOTICS S-1FL6 servo motors installed with absolute
encoders is 2^20 pulses per revolution, use of the drive’s electronic gear feature is likely, in
many applications, to achieve higher motor speeds. For example, to achieve a 10x increase
in the setpoint pulse frequency within the servo drive compared to the frequency of the CPU
pulse train supplied to the drive, then you must set the electronic gear ratio to "10:1".
In the V90 servo drive, setting parameter "p29012[0]" establishes the numerator of the
electronic gearing ratio ("a"), while setting parameter "p29013" establishes the denominator
of the ratio ("b"). Also, when using electronic gearing, set the parameter "p29011" value to
"0". The valid range for the electronic gear ratio (a / b) in the V90 servo drive is between
"0.02" and "200".
Refer to the "Electronic Gear Ratio" section of the SINAMICS V90 / SIMOTICS S-1FL6
Operating Instructions document for more information.
Mechanical factors
The "m" and "n" values establish the mechanical relationship between a load revolution and
a motor revolution, applicable when a gearing mechanism is used. When the V90 servo drive
is in "PTI" control mode, its internal mechanical gearing ratio parameters are fixed at "1:1",
but the physical "m" and "n" values are important in establishing the correct engineering unit
conversion factors for the Axis of Motion, as shown below.
The "c’ value establishes the relationship between load movement in the specified
engineering unit, and load revolutions. "20 cm of load movement per load revolution" and
"360 degrees of load movement per load revolution" are examples of this conversion factor.
Encoder resolution
The "r" value is the resolution of the absolute encoder in your servo motor. As stated above,
the encoder resolution of SIMOTICS S-1FL6 servo motors installed with absolute encoders
is 2^20 pulses per revolution or "1048576". When the V90 servo drive is paired with a motor
containing an absolute encoder, the drive automatically detects the encoder type and obtains
its resolution. However, in your program, you must specify this resolution value in the
AXISx_ABSPOS subroutine’s "Res" input parameter and also in one of the engineering unit
conversion factor calculations shown below.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 677
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
S7-200 SMART
678 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive
For example, if the mechanical gear ratio is "1:2" and the load movement per load revolution
is 10 cm, then:
"One motor revolution produces how many cm of motion" = 10 * (1 / 2) = 5
● If you configure your motion axis measurement system to the "relative pulses" setting
instead of the "engineering units" setting, you can still use the AXISx_ABSPOS
subroutine to return position information from the V90 servo drive. Note, however, that
the position value returned in the "D_pos" parameter of the subroutine will then be of type
DINT and is the actual position value reported by the servo drive (there are no
engineering unit conversions performed on the value).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 679
Open loop motion control
12.8 Axis of Motion example programs
Table 12- 33 Example: Axis of Motion simple relative move (cut-to-length application)
S7-200 SMART
680 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.8 Axis of Motion example programs
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 681
Open loop motion control
12.8 Axis of Motion example programs
Table 12- 34 Example: Axis of Motion AXISx_CTRL, AXISx_RUN, AXISx_SEEK, and AXISx_MAN subroutines application
S7-200 SMART
682 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.8 Axis of Motion example programs
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 683
Open loop motion control
12.8 Axis of Motion example programs
S7-200 SMART
684 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.8 Axis of Motion example programs
• CPU_Output3 = Q0.3
• State_Machine_Step =
VB1500
• Clock_1s = SM0.5
(Clock pulse that is ON
for 0.5 s and OFF for 0.5
s for a duty cycle time of
1 s.)
• CPU_Output5 = Q0.5
• State_Machine_Step =
VB1500
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 685
Open loop motion control
12.9 Monitoring the Axis of Motion
1 The program addresses shown are example addresses. Your program addresses could vary.
● Open the Tools folder in the project tree, select the "Motion Control Panel" node and
press Enter; or double-click the "Motion Control Panel" node.
At this point, a comparison between the CPU and STEP 7-Micro/WIN SMART is executed to
ensure that the configurations are the same. (See the figure below.)
S7-200 SMART
686 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.9 Monitoring the Axis of Motion
The Axis of Motion Operation (Page 687), Configuration (Page 693), and Profile
Configuration (Page 693) settings make it easy for you to monitor and control the operation
of the Axis of Motion during the startup and test phases of your development process.
Use the Motion control panel to verify that the Axis of Motion is wired correctly, to adjust the
configuration data, and to test each movement profile.
If additional changes need to be made in the Axis of Motion, refer to the Motion wizard
(Page 646).
For error code listings, refer to the Axis of Motion error codes (Page 694) and the Motion
instruction error codes (Page 695).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 687
Open loop motion control
12.9 Monitoring the Axis of Motion
The control panel allows you to interact with the Axis of Motion by changing the speed and
direction, by stopping and starting the motion, and by jogging the tool (if the CPU is
stopped).
Note
You cannot execute a motion command while the CPU is running. The CPU must be in
STOP mode in order to change the speed and direction, stop and start the motion, and use
the jog tool.
Note
Exiting the Motion control panel or a loss of communications while a motion command is
active causes the axis to stop its motion after a 5 second timeout.
S7-200 SMART
688 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.9 Monitoring the Axis of Motion
Motion commands
You can also generate the following motion commands:
Command Description
Execute continuous speed move: This command allows you
to use the manual controls for positioning the tool. Enter
"Target Speed" and "Direction", and click "Start" to execute
continuous move. Motion will continue until "Stop" is clicked
(or error condition).
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 689
Open loop motion control
12.9 Monitoring the Axis of Motion
Command Description
Load reference point offset: After you use the manual con-
trols to jog the tool to the new position, you then load the
"Reference Point Offset". Use the manual controls to place
the tool at the new position. Click "Execute" to save this
position as the "RP_OFFSET". The current position will be
set to zero.
Activate the DIS output: This command turns the DIS output
of the Axis of Motion on. Click "Execute" to activate the DIS
output.
S7-200 SMART
690 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.9 Monitoring the Axis of Motion
Command Description
De-activate the DIS output: This command turns the DIS
output of the Axis of Motion off. Click "Execute" to
de-activate the DIS output.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 691
Open loop motion control
12.9 Monitoring the Axis of Motion
Command Description
Move by a relative amount: This command allows you to
move a specified distance from the current position at a
target speed. You can enter a positive or negative distance.
Assign a "Target Speed" and a "Target Position" to move to.
S7-200 SMART
692 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.9 Monitoring the Axis of Motion
After you modify the configuration settings, you simply click the write button to send the data
values to the CPU. These data values are not saved in your STEP 7-Micro/WIN SMART
project. You must manually make changes to your project that reflects the final values of
these fields.
Click each profile to view its mode of operation and data values.
Some data values of the profile can be modified in this dialog. After you modify the
configuration settings, you simply click the write button to send the data values to the CPU.
These data values are not saved in your STEP 7-Micro/WIN SMART project. You must
manually make changes to your project that reflects the final values of these fields.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 693
Open loop motion control
12.9 Monitoring the Axis of Motion
12.9.4 Error codes for the Axis of Motion (WORD at SMW620, SMW670, or SMW720)
S7-200 SMART
694 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.9 Monitoring the Axis of Motion
To verify that the Axis of Motion is wired correctly, to adjust the configuration data, and to
test each movement profile, use the Motion control panel.
If additional changes need to be made in the Axis of Motion, go to the Motion wizard.
12.9.5 Error codes for the Motion instruction (seven LS bits of SMB634, SMB684, or
SMB734)
In the SM table for each axis there is a byte reserved to display the result of the motion
instruction (Offset 34). This byte indicates when an instruction is complete and if there was
an error in the instruction.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 695
Open loop motion control
12.9 Monitoring the Axis of Motion
To verify that the Axis of Motion is wired correctly, to adjust the configuration data, and to
test each movement profile, use the Motion control panel.
If additional changes need to be made in the Axis of Motion, go to the Motion wizard.
S7-200 SMART
696 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.10 Advanced topics
Overview
The Motion wizard has been developed to make motion applications easy by automatically
generating the configuration and profile information based upon the answers you give about
your motion control system. Configuration/profile table information is provided for advanced
users who want to create their own motion control routines.
The configuration/profile table is located in the V memory area of the S7-200 SMART CPU.
As shown in the table below, the configuration settings are stored in the following types of
information:
● Configuration block: Contains information used to setup the Axis of Motion in preparation
for executing position commands
● Interactive block: Supports direct setup of position parameters by the user program
● Profile block: Describes a pre-defined move operation to be performed by the Axis of
Motion. You can configure up to 32 profile blocks.
Note
The profile block of the configuration/profile table can contain up to 32 motion profiles. To
create more than 32 move profiles, you can exchange configuration/profile tables by
changing the value stored in the configuration/profile table pointer.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 697
Open loop motion control
12.10 Advanced topics
Configuration/Profile table
Byte off- Name Function description Type
set
Configuration block
0 MOD_ID Axis of Motion identification field --
5 CB_LEN Length of the configuration block in bytes (1 byte) --
6 IB_LEN Length of the interactive block in bytes (1 byte) --
7 PF_LEN Length of a single profile in bytes (1 byte) --
8 STP_LEN Length of a single step in bytes (1 byte) --
9 STEPS Number of steps allowed per profile (1 byte) --
10 PROFILES Number of profiles from 0 to 32 (1 byte) --
11 -- Reserved: Set to 0 --
13 -- Reserved: Set to 0 --
14 STOP_RSP Specifies the drive's response to the STP input --
(1 byte):
• 0: No action. Ignore input condition.
• 1: Decelerate to a stop and indicate STP input
active.
• 2: Terminate pulses and indicate STP input.
• 3 to 255: Reserved (error if specified)
15 LMT-_RSP Specifies the drive's response to the negative limit --
input (1 byte):
• 0: No action. Ignore input condition.
• 1: Decelerate to a stop and indicate limit reached.
• 2: Terminate pulses and indicate limit reached.
• 3 to 255: Reserved (error if specified)
16 LMT+_RSP Specifies the drive's response to the positive limit --
input (1 byte):
• 0: No action. Ignore input condition.
• 1: Decelerate to a stop and indicate limit reached.
• 2: Terminate pulses and indicate limit reached.
• 3 to 255: Reserved (error if specified)
17 -- Reserved: Set to 0 --
18 MEAS_SYS Specifies the measurement system used to describe --
moves (1 byte):
• 0: Pulses (speed measured in pulses/sec and
position values measured in pulses; values are
double integer)
• 1: Engineering units (speed measured in units/sec
and position values measured in units; values are
single precision real)
• 2 to 255: Reserved (error if specified)
S7-200 SMART
698 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.10 Advanced topics
Configuration/Profile table
Byte off- Name Function description Type
set
Configuration block
19 -- Reserved: Set to 0 --
20 PLS/REV Specifies the number of pulses per revolution of the DInt
motor, (only applicable when MEAS_SYS is set to 1) -
(4 bytes)
24 UNITS/REV Specifies the engineering units per revolution of the Real
motor, (only applicable when MEAS_SYS is set to 1) -
(4 bytes)
28 UNITS Reserved for STEP 7-Micro/WIN SMART to store a --
custom units string (4 bytes)
32 RP_CFG Specifies the reference point search configuration --
(1 byte):
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 699
Open loop motion control
12.10 Advanced topics
Configuration/Profile table
Byte off- Name Function description Type
set
Configuration block
42 RP_SLOW Slow speed for the RP seek operation: Maximum DInt/Real
speed from which the motor can instantly go to a stop
or less (4 bytes)
46 SS_SPEED Start/Stop Speed. (4 bytes): DInt/Real
The starting speed is the maximum speed to which
the motor can instantly go from a stop and the maxi-
mum speed from which the motor can instantly go to a
stop. Operation below this speed is allowed, but the
acceleration and deceleration times do not apply.
50 MAX_SPEED Maximum operating speed of the motor (4 bytes) DInt/Real
54 JOG_SPEED Jog speed (4 bytes): MAX_SPEED or less (4 bytes) DInt/Real
58 JOG_INCREMENT Jog increment value: The distance (or number of DInt/Real
pulses) to move in response to a single jog pulse
(4 bytes).
62 ACCEL_TIME Time required to accelerate from minimum to maxi- DInt
mum speed in msec (4 bytes)
66 DECEL_TIME Time required to decelerate from maximum to mini- DInt
mum speed in msec (4 bytes)
70 BKLSH_COMP Backlash compensation: The distance used to com- DInt/Real
pensate for the system backlash on a direction
change (4 bytes).
74 JERK_TIME Time during which jerk compensation is applied to the DInt
beginning and ending portions of an accelera-
tion/deceleration curve (S-curve). Specifying a value
of 0 disables jerk compensation. The jerk time is given
in milliseconds (Range: 0 ms to 32000 ms. (4 bytes)
S7-200 SMART
700 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.10 Advanced topics
Configuration/Profile table
Byte offset Name Function description Type
Interactive block
78 MOVE_CMD Selects the mode of operation (1 byte): --
• 0: Absolute position
• 1: Relative position
• 2: Single-speed, continuous positive rotation
• 3: Single-speed, continuous negative rotation
• 4: Manual speed control, positive rotation
• 5: Manual speed control, negative rotation
• 6: Single-speed, continuous positive rotation with
triggered stop (Activation of RPS triggers the stop;
TARGET_POS contains distance to travel after
signal)
• 7: Single-speed, continuous negative rotation with
triggered stop (Activation of RPS triggers the stop;
TARGET_POS contains distance to travel after
signal)
• 8 to 255: Reserved (error if specified)
79 -- Reserved: Set to 0 --
80 TGT_POS Target position to go to in this move (4 bytes) DInt/Real
84 TGT_SPEED Target speed for this move (4 bytes) DInt/Real
88 RP_OFFSET Absolute position of the reference point (4 bytes) DInt/Real
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 701
Open loop motion control
12.10 Advanced topics
Configuration/Profile table
Byte offset Name Function description Type
Profile block 0
92(+0) STEPS Number of steps in this move sequence (1 byte) --
93(+1) MODE Selects the mode of operation for this profile block (1 --
byte):
• 0: Absolute position
• 1: Relative position
• 2: Single-speed, continuous positive rotation
• 3: Single-speed, continuous negative rotation
• 4: Reserved (error if specified)
• 5: Reserved (error if specified)
• 6: Single-speed, continuous positive rotation with
triggered stop (RPS input signals stop)
• 7: Single-speed, continuous negative rotation with
triggered stop (RPS input signals stop)
• 8: Two-speed, continuous positive rotation RPS
selects speed)
• 9: Two-speed, continuous negative rotation (RPS
selects speed)
• 10: Two-speed, continuous positive rotation with
triggered stop (RPS selects speed, TRIG input
signals stop)
• 11: Two-speed, continuous negative rotation with
triggered stop (RPS selects speed, TRIG input
signals stop)
• 12 to 255: Reserved (error if specified)
94(+2) Step 0: POS Position to go to in move step 0 (4 bytes) DInt/Real
98(+6) Step 0: SPEED Target speed for move step 0 (4 bytes) DInt/Real
102(+10) Step 1: POS Position to go to in move step 1 (4 bytes) DInt/Real
106(+14) Step 1: SPEED Target speed for move step 1 (4 bytes) DInt/Real
110(+18) Step 2: POS Position to go to in move step 2 (4 bytes) DInt/Real
114(+22) Step 2: SPEED Target speed for move step 2 (4 bytes) DInt/Real
118(+26) Step 3: POS Position to go to in move step 3 (4 bytes) DInt/Real
122(+30) Step 3: SPEED Target speed for move step 3 (4 bytes) DInt/Real
... Step ...: POS Position to go to in move step ... (4 bytes) DInt/Real
... Step ...: SPEED Target speed for move step ... (4 bytes) DInt/Real
214(+122) Step 15: POS Position to go to in move step 3 (4 bytes) DInt/Real
218(+126) Step 15: SPEED Target speed for move step 3 (4 bytes) DInt/Real
S7-200 SMART
702 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.10 Advanced topics
Note
You can have between 1 and 16 steps in the Configuration/Profile table, Profile block 0.
Configuration/Profile table
Byte offset Name Function description Type
Profile block 1
X1 STEPS Number of steps in this move sequence (1 byte) --
Note: There can be up to 16 steps.
(X + 1) MODE Selects the mode of operation for this profile block (1 --
byte)
(X + 2) Step 0: POS Position to go to in move step 0 (4 bytes) DInt/Real
(X + 4) Step 0: SPEED The target speed for move step 0 (4 bytes) DInt/Real
... ... ... ...
1 The offset of Profile block 1 and subsequent blocks is variable and dependent upon the number of
steps configured in the largest profile. The offset is determined by the following formula:
Offset of Profile block x = CB_LEN + IB_LEN + (x * PF_LEN)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 703
Open loop motion control
12.10 Advanced topics
Table 12- 44 Profile detail for Mode 2 (Single-speed, continuous positive rotation) and Mode 3 (Single-
speed, continuous negative rotation)
Table 12- 45 Profile detail for Mode 6 (Single-speed, continuous positive rotation with triggered stop)
and Mode 7 (Single-speed, continuous negative rotation with triggered stop)
S7-200 SMART
704 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.10 Advanced topics
Table 12- 46 Profile detail for Mode 8 (Two-speed, continuous positive rotation) and Mode 9 (Two-
speed, continuous negative rotation)
Table 12- 47 Profile detail for Mode 10 (Two-speed, continuous positive rotation with triggered stop)
and Mode 11 (Two-speed, continuous negative rotation with triggered stop)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 705
Open loop motion control
12.10 Advanced topics
The following table shows the structure of the SM data area allocated for an Axis of Motion.
The definition uses Axis 0 as an example.
Table 12- 49 Special memory area definition for the Axis of Motion 0
SM address Description
SMB600 to SMB615 Axis name (16 ASCII characters). SMB600 is the first character: "Axis 0"
SMB616 to SMB619 Reserved
SMW620 Axis 0: Error code (See "Axis of Motion error codes" (Page 694) list.)
SMB622 Axis 0: Input/output status: Reflects the status of the inputs and outputs
S7-200 SMART
706 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
SM address Description
SMB623 Axis 0 Instantaneous status: Reflects the status of the configuration and
rotation direction status
• D (Done bit):
– 0= Operation in progress
– 1= Operation complete (set by the Axis of Motion during initialization)
• ERROR: (See "Motion instruction error codes" (Page 695) list.)
SMB635 to SMB645 Reserved
SMD646 Axis 0: Pointer to the V memory location of the configuration/profile table. A
pointer value to an area other than V memory is not valid. The Axis of Mo-
tion monitors this location until it receives a non-zero pointer value.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 707
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
Note
The RPS input must be enabled to use the RP Seek functionality. The ZP input must also be
enabled if RP Seek modes 3 or 4 are to be used, unless you configure the number of ZP
pulses to be received after entering the RPS active region to a value of "0".
S7-200 SMART
708 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
RP seek mode 1
Default configuration: RP seek direction: negative and RP approach direction: positive
①: Positive motion
②: Negative motion
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 709
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
RP seek mode 2
Default configuration: RP seek direction: negative and RP approach direction: positive
①: Positive motion
②: Negative motion
S7-200 SMART
710 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
RP seek mode 3
Default configuration: RP seek direction: negative and RP approach direction: positive
①: Positive motion
②: Negative motion
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 711
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
RP seek mode 4
Default configuration: RP seek direction: negative and RP approach direction: positive
①: Positive motion
②: Negative motion
S7-200 SMART
712 System Manual, V2.4, 03/2019, A5E03822230-AG
Open loop motion control
12.11 Understanding the RP Seek modes of the Axis of Motion
Backlash is not eliminated: RP seek direction: negative and RP approach direction: negative
①: Positive motion
② Negative motion
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 713
Technical specifications A
A.1 General specifications
Standards compliance
The S7-200 SMART automation system complies with the following standards and test
specifications. The test criteria for the S7-200 SMART automation system are based on
these standards and test specifications.
CE approval
The S7-200 SMART Automation System satisfies requirements and safety related objectives
according to the EC directives listed below, and conforms to the harmonized European
standards (EN) for the programmable controllers listed in the Official Journals of the
European Community.
● EC Directive 2006/95/EC (Low Voltage Directive) "Electrical Equipment Designed for Use
within Certain Voltage Limits"
– EN 61131-2: Programmable controllers - Equipment requirements and tests
● EC Directive 2004/108/EC (EMC Directive) "Electromagnetic Compatibility"
– Emission standard
EN 61000-6-4: AI: Industrial Environment
– Immunity standard
EN 61000-6-2: Industrial Environment
The CE Declaration of Conformity is held on file available to competent authorities at:
Siemens AG
Sector Industry
DF FA AS DH AMB
Postfach 1963
D-92209 Amberg
Germany
S7-200 SMART
714 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.1 General specifications
Industrial environments
The S7-200 SMART automation system is designed for use in industrial environments.
Electromagnetic compatibility
Electromagnetic Compatibility (EMC) is the ability of an electrical device to operate as
intended in an electromagnetic environment and to operate without emitting levels of
electromagnetic interference (EMI) that may disturb other electrical devices in the vicinity.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 715
Technical specifications
A.1 General specifications
Environmental conditions
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
S7-200 SMART
716 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.1 General specifications
Insulation
The insulation is designed in accordance with the requirements of EN 61131-2.
Note
For modules with 24 V DC supply voltage, the electrical isolation is designed for max. 60 V
AC / 75 V DC and basic insulation is designed according to EN 61131-2.
Rated voltages
Note
When a mechanical contact turns on output power to the S7-200 SMART CPU, or any digital
expansion module, it sends a "1" signal to the digital outputs for approximately 150
microseconds. This could cause unexpected machine or process operation which could
result in death or serious injury to personnel and/or damage to equipment. You must plan for
this, especially if you are using devices which respond to short duration pulses.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 717
Technical specifications
A.1 General specifications
WARNING
Time duration for a mechanical contact to turn on output power
When a mechanical contact turns on output power to the S7-200 SMART CPU, or any
digital expansion module, it sends a "1" signal to the digital outputs for approximately 150
microseconds.
This can cause unexpected machine or process operation which can result in death or
serious injury to personnel and/or damage to equipment.
You must plan for this situation, especially, if you use devices which respond to short
duration pulses.
S7-200 SMART
718 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
General specifications and features of the CPU ST20, CPU SR20, and CPU CR20s
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Article number 6ES7288-1ST20-0AA0 6ES7288-1SR20-0AA0 6ES7288-1CR20-0AA1
Dimensions W x H x D 90 x 100 x 81 90 x 100 x 81 90 x 100 x 81
(mm)
Weight 320 grams 367.3 grams 363 grams
Power dissipation 20 W 14 W 6W
Current available (EM 1400 mA max. (5 V DC) 1400 mA max. (5 V DC) Not available
bus)
Current available 300 mA max. (sensor power) 300 mA max. (sensor power) 300 mA max. (sensor power)
(24 V DC)
Digital input current con- 4 mA/input used 4 mA/input used 4 mA/ input used
sumption
(24 V DC)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 719
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
User Program 12 Kbytes 12 Kbytes 12 Kbytes
memory1 User data (V) 8 Kbytes 8 Kbytes 8 Kbytes
Retentive 10 Kbytes max.1 10 Kbytes max.1 2 Kbytes max.1
On-board digital I/O 12 inputs/8 outputs 12 inputs/8 outputs 12 inputs/8 outputs
Process image 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits
of outputs (Q) of outputs (Q) of outputs (Q)
Analog image 56 words of inputs (AI) / 56 56 words of inputs (AI) / 56 Not available
words of outputs (AQ) words of outputs (AQ)
Bit memory (M) 256 bits 256 bits 256 bits
Temporary (local) memory 64 bytes in the main program 64 bytes in the main program 64 bytes in the main program
(L) and 64 bytes in each and 64 bytes in each and 64 bytes in each
subroutine and interrupt rou- subroutine and interrupt rou- subroutine and interrupt rou-
tine tine tine
60 bytes when programming 60 bytes when programming 60 bytes when programming
in LAD or FBD (STEP 7- in LAD or FBD (STEP 7- in LAD or FBD (STEP 7-
Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes)
Sequential control relays 256 bits 256 bits 256 bits
(S)
Expansion modules 6 6 Not available
expansion
Signal board expansion 1 max. 1 max. Not available
High- Total 6 6 4
speed Single phase 4 at 200 kHz 4 at 200 kHz 4 at 100 kHz
counters
2 at 30 kHz 2 at 30 kHz
A/B phase 2 at 100 Khz 2 at 100 Khz 2 at 50 kHz
2 at 20 kHz 2 at 20 kHz
Pulse outputs 2 2 at 100 kHz2 2 at 100 kHz2 Not available
Pulse catch inputs 12 12 Not available
Cyclic interrupts 2 at 1 ms resolution 2 at 1 ms resolution 2 at 1 ms resolution
Edge interrupts 4 rising and 4 falling (6 and 6 4 rising and 4 falling (6 and 6 4 rising and 4 falling
with optional signal board) with optional signal board)
Memory card microSDHC Card (optional) microSDHC Card (optional) Not available
Real time clock accuracy +/- 120 seconds/month +/- 120 seconds/month Not available
Real time clock retention 7 days typ./6 days min. at 25 7 days typ./6 days min. at 25 Not available
time °C (maintenance-free Super °C (maintenance-free Super
Capacitor) Capacitor)
1 You can configure areas of V memory, M memory, C memory (current values), and portions of T memory (current val-
ues on retentive times) to be retentive, up to the specified maximum amount.
2 The specified maximum pulse frequency is possible only for CPU models with transistor outputs. Pulse output operation
is not recommended for CPU models with relay outputs.
S7-200 SMART
720 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 721
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 11 Performance
Element Description
POUs Type/quantity Main program: 1
Subroutines: 128 (0 to 127)
Interrupt routines: 128 (0 to 127)
Nesting depth From main program: 8 subroutine levels
From interrupt routine: 4 subroutine levels
Accumulators Quantity 4
Timers Type/quantity Non-retentive (TON, TOF): 192
Retentive (TONR): 64
Counters Quantity 256
Table A- 13 Communication
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Number of ports PROFINET (LAN): 1 PROFINET (LAN): 1 PROFINET (LAN): 0
Serial ports: 1 (RS485) Serial ports: 1 (RS485) Serial ports: 1 (RS485)
Add-on serial ports: 1 (with Add-on serial ports: 1 (with Add-on serial ports: 0
optional RS232/485 signal optional RS232/485 signal
board) board)
HMI device PROFINET (LAN): 8 connec- PROFINET (LAN): 8 connec- PROFINET (LAN): Not avail-
tions tions able
Serial ports: 4 connections Serial ports: 4 connections Serial ports: 4 connections
per port per port per port
Programming device (PG) PROFINET (LAN): 1 connec- PROFINET (LAN): 1 connec- PROFINET (LAN): Not avail-
tion tion able
Serial ports: 1 connection Serial ports: 1 connection Serial ports: 1 connection
CPUs (PUT/GET) PROFINET (LAN): 8 client PROFINET (LAN): 8 client PROFINET (LAN): Not avail-
and 8 server connections and 8 server connections able
Open user communication PROFINET (LAN): 8 active PROFINET (LAN): 8 active PROFINET (LAN): Not avail-
and and able
8 passive connections 8 passive connections
Data rates PROFINET (LAN): 10/100 PROFINET (LAN): 10/100 PROFINET (LAN): Not avail-
Mb/s Mb/s able
RS485 system protocols: RS485 system protocols: RS485 system protocols:
9600, 19200, and 187500 b/s 9600, 19200, and 187500 b/s 9600, 19200, and 187500 b/s
RS485 freeport: 1200 to RS485 freeport: 1200 to RS485 freeport: 1200 to
115200 b/s 115200 b/s 115200 b/s
S7-200 SMART
722 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Isolation (external signal PROFINET (LAN): Trans- PROFINET (LAN): Trans- PROFINET (LAN): Not avail-
to PLC logic) former former able
isolated, 1500 V AC isolated, 1500 V AC RS485: None
RS485: none RS485: none
Cable type PROFINET (LAN): CAT5e PROFINET (LAN): CAT5e PROFINET (LAN): Not avail-
shielded shielded able
RS485: PROFIBUS network RS485: PROFIBUS network RS485: PROFIBUS network
cable cable cable
PROFINET Communication
PROFINET controller Yes Yes No
PROFINET device No No No
PROFINET controller
Services
PG/OP communication Yes Yes No
S7 routing Yes Yes No
Isochronous mode No No No
Open IE communication Yes Yes No
IRT No No No
MRP No No No
PROFIenergy No No No
Max. number of 8 8 --
PROFINET devices that
you can connect for RT
Max. number of module 64 64 --
Update times The minimum value of the The minimum value of the No
update time also depends on update time also depends on
the communication compo- the communication compo-
nent set for PROFINET, on nent set for PROFINET, on
the number of PROFINET the number of IO devices,
devices, and the quantity of and the quantity of configured
configured user data. user data.
With RT
Send clock of 1 ms 1 ms to 512 ms 1 ms to 512 ms --
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 85 to 264 V AC 85 to 264 V AC
Line frequency -- 47 to 63 Hz 47 to 63 Hz
Input CPU only at 160 mA at 24 V DC (without 210 mA at 120 V AC (with 90 mA at 120 V AC
current max. load driving 300 mA sensor power) 300 mA power sensor output) 60 mA at 240 V AC
430 mA at 24 V DC (with 90 mA at 120 V AC (without
driving 300 mA sensor power) 300 mA power sensor output)
120 mA at 240 V AC (with
300 mA power sensor output)
60 mA at 240 V AC (without
300 mA power sensor output)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 723
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
CPU with all 720 mA at 24 V DC 290 mA at 120 V AC170 mA --
expansion at 240 V AC
accessories
at max. load
Inrush current (max.) 11.7 A at 28.8 V DC 9.3 A at 264 V AC 16.3 A at 264 V AC
Isolation (input power to -- 1500 V AC 1500 V AC
logic)
Ground leakage, AC line -- 0.5 mA max. 0.5 mA max.
to functional earth
Hold up time (loss of pow- 20 ms at 24 V DC 30 ms at 120 V AC 200 ms at 30 ms at 120 V AC
er) 240 V AC 200 ms at 240 V AC
Internal fuse, not user 3 A, 250 V slow blow 3 A, 250 V, slow blow 3 A, 250 V, slow blow
replaceable
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 20.4 to 28.8 V DC 20.4 to 28.8 V DC
Output current rating 300 mA (short circuit 300 mA (short circuit 300 mA (short circuit
(max.) protected) protected) protected)
Maximum ripple noise < 1 V peak to peak < 1 V peak to peak < 1 V peak to peak
(<10 MHz)
Isolation (CPU logic to Not isolated Not isolated Not isolated
sensor power)
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Number of inputs 12 12 12
Type SinkSource (IEC Type 1 sink, Sink/Source (IEC Type 1 Sink/Source (IEC Type 1
except I0.0 to I0.3, I0.6 to sink) sink)
I0.7)
Rated voltage 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal
Continuous permissible 30 V DC, max. 30 V DC, max. 30 V DC, max.
voltage
Surge voltage 35 V DC for 0.5 sec 35 V DC for 0.5 sec. 35 V DC for 0.5 sec.
Logic 1 signal (min.) I0.0 to I0.3, I0.6 to I0.7: 4 V 15 V DC at 2.5 mA 15 V DC at 2.5 mA
DC at 8 mA
Other inputs: 15 V DC at 2.5
mA
Logic 0 signal (max.) I0.0 to I0.3, I0.6 to I0.7: 1 V 5 V DC at 1 mA 5 V DC at 1 mA
DC at 1 mA
Other inputs: 5 V DC at 1 mA
S7-200 SMART
724 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Isolation (field side to 500 V AC for 1 minute 500 V AC for 1 minute 500 V AC for 1 minute
logic)
Isolation groups 1 1 1
Filter times Individually selectable on Individually selectable on Individually selectable on
each channel (points I0.0 to each channel (points I0.0 to each channel (points I0.0 to
I1.3): I1.3): I1.3):
μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
HSC clock input rates Single phase: 4 HSCs at 200 Single phase: 4 HSCs at 200 Single phase: 4 HSCs at 100
(max.) kHz; 2 HSCs at 30 kHz kHz; 2 HSCs at 30 kHz kHz
A/B phase: 2 HSCs at 100 A/B phase: 2 HSCs at 100 A/B phase: 2 HSCs at 50 kHz
kHz; 2 HSCs at 20 kHz kHz; 2 HSCs at 20 kHz
Number of inputs on 12 12 12
simultaneously
Cable length (max.), I0.0 to I0.3: All inputs: All inputs:
in meters Shielded (only): Shielded: Shielded:
• 500 m normal (low-speed) • 500 m normal inputs • 500 m normal inputs,
inputs • 50 m HSC inputs • 50 m HSC inputs
• 50 m HSC (high-speed) Unshielded: Unshielded:
inputs
• 300 m normal inputs • 300 m normal inputs
I0.6 to I0.7:
• Shielded (only): 500 m
normal inputs
All other inputs:
• Shielded: 500 m normal
inputs
• Unshielded: 300 m normal
inputs
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Number of outputs 8 8 8
Type Solid state - MOSFET (sourc- Relay, dry contact Relay, dry contact
ing)
Voltage range 20.4 to 28.8 V DC 5 to 30 V DC or 5 to 250 V 5 to 30 V DC or 5 to 250 V
AC AC
Logic 1 signal at max. 20 V DC min. -- --
current
Logic 0 signal with 10 KΩ 0.1 V DC max. -- --
load
Rated current per point 0.5 A 2.0 A 2.0 A
(max.)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 725
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay
Rated current per com- 6A 10.0 A 10.0 A
mon (max.)
Lamp load 5W 30 W DC/200 W AC 30 W DC/200 W AC
ON state resistance 0.6 Ω max. 0.2 Ω max. when new 0.2 Ω max. when new
Leakage current per point 10 μA max. -- --
Surge current 8 A for 100 ms max. 7 A with contacts closed 7 A with contacts closed
Overload protection No No No
Isolation (field side to 500 V AC for 1 minute 1500 V AC for 1 minute (coil 1500 V AC for 1 minute (coil
logic) to contact) to contact)
None (coil to logic) None (coil to logic)
Isolation resistance -- 100 M Ω min. when new 100 M Ω min. when new
Isolation between open -- 750 V AC for 1 minute 750 V AC for 1 minute
contacts
Isolation groups 2 1 1
Inductive clamp voltage L+ minus 48 V DC, Not recommended Not recommended
1 W dissipation
Switching delay (Qa.0 to 1.0 μs max., off to on 10 ms max. 10 ms max.
Qa.3) 3.0 μs max., on to off
Switching delay (Qa.4 to 50 μs max., off to on 10 ms max. 10 ms max.
Qa.7) 200 μs max., on to off
Lifetime mechanical (no -- 10,000,000 open/close cycles 10,000,000 open/close cycles
load)
Lifetime contacts at rated -- 100,000 open/close cycles 100,000 open/close cycles
load
Output state in STOP Last value or substitute value Last value or substitute value Last value or substitute value
mode (default value 0) (default value 0) (default value 0)
Number of outputs on 8 8 8
simultaneously
Cable length (max.), Shielded: 500 m Shielded: 500 m Shielded: 500 m
in meters Unshielded: 300 m Unshielded: 300 m Unshielded: 300 m
S7-200 SMART
726 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 727
Technical specifications
A.2 S7-200 SMART CPUs
① 24 V DC sensor power
output
S7-200 SMART
728 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
① 24 V DC sensor power
output
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 729
Technical specifications
A.2 S7-200 SMART CPUs
General specifications and features of the CPU ST30, CPU SR30 and CPU CR30s
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Article number 6ES7288-1ST30-0AA0 6ES7288-1SR30-0AA0 6E88288-1CR30-0AA1
Dimensions W x H x D 110 x 100 x 81 110 x 100 x 81 110 x 100 x 81
(mm)
Weight 375 g 435 g 424 g
Power dissipation 12 W 14 W 7w
Current available (EM 1400 mA max. (5 V DC) 1400 mA max. (5 V DC) Not available
bus)
Current available (24 V 300 mA max. (sensor power) 300 mA max. (sensor power) 300 mA max. (sensor power)
DC)
Digital input current 4 mA/ input used 4 mA/ input used 4 mA/ input used
consumption (24 V DC)
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
User Program 18 Kbytes 18 Kbytes 12 Kbytes
memory1 User data (V) 12 Kbytes 12 Kbytes 8 Kbytes
Retentive 10 Kbytes max.1 10 Kbytes max.1 2 Kbytes max.1
On-board digital I/O 18 inputs/12 outputs 18 inputs/12 outputs 18 inputs/12 outputs
Process image 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits
of outputs (Q) of outputs (Q) of outputs (Q)
Analog image 56 words of inputs (AI) / 56 56 words of inputs (AI) / 56 Not available
words of outputs (AQ) words of outputs (AQ)
Bit memory (M) 256 bits 256 bits 256 bits
Temporary (local) memory 64 bytes in the main program 64 bytes in the main program 64 bytes in the main program
(L) and 64 bytes in each and 64 bytes in each and 64 bytes in
subroutine and interrupt rou- subroutine and interrupt rou- each subroutine and interrupt
tine tine routine
60 bytes when programming 60 bytes when programming 60 bytes when programming
in LAD or FBD (STEP 7- in LAD or FBD (STEP 7- in LAD or FBD (STEP 7-
Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes)
Sequential control relays 256 bits 256 bits 256 bits
(S)
Expansion modules 6 6 Not available
expansion
Signal board expansion 1 max. 1 max. Not available
S7-200 SMART
730 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
High- Total 6 6 4
speed Single phase 5 at 200 kHz 5 at 200 kHz 4 at 100 kHz
counters
1 at 30 kHz 1 at 30 kHz
A/B phase 3 at 100 kHz 3 at 100 kHz 2 at 50 kHz
1 at 20 kHz 1 at 20 kHz
Pulse outputs 2 3 at 100 kHz -- Not available
Pulse catch inputs 12 12 Not available
Cyclic interrupts 2 at 1 ms resolution 2 at 1 ms resolution 2 at 1 ms resolution
Edge interrupts 4 rising and 4 falling (6 and 6 4 rising and 4 falling (6 and 6 4 rising and 4 falling
with optional signal board) with optional signal board)
Memory card microSDHC Card (optional) microSDHC Card (optional) Not available
Real time clock accuracy +/- 120 seconds/month +/- 120 seconds/month Not available
Real time clock retention 7 days typ./6 days min. at 25 7 days typ./6 days min. at 25 Not available
time °C (maintenance-free Super °C (maintenance-free Super
Capacitor) Capacitor)
1 You can configure areas of V memory, M memory, C memory (current values), and portions of T memory (current val-
ues on retentive times) to be retentive, up to the specified maximum amount.
2 The specified maximum pulse frequency is possible only for CPU models with transistor outputs. Pulse output operation
is not recommended for CPU models with relay outputs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 731
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 27 Performance
Element Description
POUs Type/quantity Main program: 1
Subroutines: 128 (0 to 127)
Interrupt routines: 128 (0 to 127)
Nesting depth From main program: 8 subroutine levels
From interrupt routine: 4 subroutine levels
Accumulators Quantity 4
Timers Type/quantity Non-retentive (TON, TOF): 192
Retentive (TONR): 64
Counters Quantity 256
S7-200 SMART
732 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 29 Communication
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Number of ports PROFINET (LAN): 1 PROFINET (LAN): 1 PROFINET (LAN): 0
Serial ports: 1 (RS485) Serial ports: 1 (RS485) Serial ports: 1 (RS485)
Add-on serial ports: 1 (with Add-on serial ports: 1 (with Add-on serial ports: 0
optional RS232/485 signal optional RS232/485 signal
board) board)
HMI device PROFINET (LAN): 8 connec- PROFINET (LAN): 8 connec- PROFINET (LAN): Not avail-
tions tions able
Serial ports: 4 connections Serial ports: 4 connections Serial ports: 4 connections
per port per port per port
Programming device (PG) PROFINET (LAN): 1 connec- PROFINET (LAN): 1 connec- PROFINET (LAN): Not avail-
tion tion able
Serial ports: 1 connection Serial ports: 1 connection Serial ports: 1 connection
CPUs (PUT/GET) PROFINET (LAN): 8 client PROFINET (LAN): 8 client PROFINET (LAN): Not avail-
and 8 server connections and 8 server connections able
Open user communication PROFINET (LAN): 8 active PROFINET (LAN): 8 active PROFINET (LAN): Not avail-
and and able
8 passive connections 8 passive connections
Data rates PROFINET (LAN): 10/100 PROFINET (LAN): 10/100 PROFINET (LAN): Not avail-
Mb/s Mb/s able
RS485 system protocols: RS485 system protocols: RS485 system protocols:
9600, 19200, and 187500 b/s 9600, 19200, and 187500 b/s 9600, 19200, and 187500 b/s
RS485 freeport: 1200 to RS485 freeport: 1200 to RS485 freeport: 1200 to
115200 b/s 115200 b/s 115200 b/s
Isolation (external signal PROFINET (LAN): Trans- PROFINET (LAN): Trans- PROFINET (LAN): Not avail-
to PLC logic) former isolated, 1500 V AC former isolated, 1500 V AC able
RS485: none RS485: none RS485: none
Cable type PROFINET (LAN): CAT5e PROFINET (LAN): CAT5e PROFINET (LAN): Not avail-
shielded shielded able
RS485: PROFIBUS network RS485: PROFIBUS network RS485: PROFIBUS network
cable cable cable
PROFINET Communication
PROFINET controller Yes Yes No
PROFINET device No No No
PROFINET controller
Services
PG/OP communication Yes Yes No
S7 routing Yes Yes No
Isochronous mode No No No
Open IE communication Yes Yes No
IRT No No No
MRP No No No
PROFIenergy No No No
Max. number of 8 8 --
PROFINET devices that
you can connect for RT
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 733
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Max. number of module 64 64 --
Update times The minimum value of the The minimum value of the No
update time also depends on update time also depends on
the communication compo- the communication compo-
nent set for PROFINET, on nent set for PROFINET, on
the number of PROFINET the number of PROFINET
devices, and the quantity of devices, and the quantity of
configured user data. configured user data.
With RT
Send clock of 1 ms 1 ms to 512 ms 1 ms to 512 ms --
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 20.4 to 28.8 V DC 20.4 to 28.8 V DC
Output current rating 300 mA 300 mA 300 mA (short circuit protect-
(max.) (short circuit protected) (short circuit protected) ed)
S7-200 SMART
734 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Maximum ripple noise < 1 V peak to peak < 1 V peak to peak < 1 V peak to peak
(<10 MHz)
Isolation (CPU logic to Not isolated Not isolated Not isolated
sensor power)
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Number of inputs 18 18 18
Type Sink/Source (IEC Type 1 sink, Sink/Source (IEC Type 1 Sink/Source (IEC Type 1
except I0.0 to I0.3, I0.6 to sink) sink)
I0.7)
Rated voltage 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal
Continuous permissible 30 V DC, max 30 V DC, max. 30 V DC, max.
voltage
Surge voltage 35 V DC for 0.5 sec. 35 V DC for 0.5 sec. 35 V DC for 0.5 sec.
Logic 1 signal (min.) I0.0 to I0.3, I0.6 to I0.7: 4 V 15 V DC at 2.5 mA 15 V DC at 2.5 mA
DC at 8 mA
Other inputs: 15 V DC at 2.5
mA
Logic 0 signal (max.) I0.0 to I0.3, I0.6 to I0.7: 1 V 5 V DC at 1 mA 5 V DC at 1 mA
DC at 1 mA
Other inputs: 5 V DC at 1 mA
Isolation (field side to 500 V AC for 1 minute 500 V AC for 1 minute 500 V AC for 1 minute
logic)
Isolation groups 1 1 1
Filter times Individually selectable on Individually selectable on Individually selectable on
each channel (points I0.0 to each channel (points I0.0 to each channel (points I0.0 to
I1.5): I1.5): I1.5):
μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
Individually selectable on Individually selectable on Individually selectable on
each channel (points I1.6 and each channel (points I1.6 and each channel (points I1.6 and
greater): greater): greater):
ms: 0, 6.4, 12.8 ms: 0, 6.4, 12.8 ms: 0, 6.4, 12.8
HSC clock input rates Single phase: 5 HSCs at 200 Single phase: 5 HSCs at 200 Single phase: 4 HSCs at 100
(max.) kHz; 1 HSC at 30 kHz kHz; 1 HSCs at 30 kHz kHz
(Logic 1 Level = 15 to 26 A/B phase: 3 HSCs at 100 A/B phase: 3 HSCs at 100 A/B phase: 2 HSCs at 50 kHz
V DC) kHz; 1 HSC at 20 kHz kHz; 1 HSC at 20 kHz
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 735
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Number of inputs on 18 18 18
simultaneously
Cable length (max.), I0.0 to I0.3: All inputs: All inputs:
in meters Shielded (only): • Shielded: 500 m normal • Shielded: 500 m normal
• 500 m normal (low-speed) inputs, inputs, 50 m HSC inputs
inputs 50 m HSC inputs • Unshielded: 300 m normal
• 50 m HSC (high-speed) • Unshielded: 300 m normal inputs
inputs inputs
I0.6 to I0.7:
• Shielded (only): 500 m
normal inputs
All other inputs:
• Shielded: 500 m normal
inputs
• Unshielded: 300 m normal
inputs1
1 When I0.0 to I0.3 are used at high-speed counter inputs, all other inputs must use shielded cable.
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Number of outputs 12 12 12
Type Solid state - MOSFET Relay, dry contact Relay, dry contact
(sourcing)
Voltage range 20.4 to 28.8 V DC 5 to 30 V DC or 5 to 250 V 5 to 30 V DC or 5 to 250 V
AC AC
Logic 1 signal at max. 20 V DC min. -- --
current
Logic 0 signal with 10 KΩ 0.1 V DC max. -- --
load
Rated current per point 0.5 A 2.0 A 2.0 A
(max.)
Rated current per com- 6A 10.0 A 10.0 A
mon (max.)
Lamp load 5W 30 W DC/200 W AC 30 W DC/200 W AC
ON state resistance 0.6 Ω max. 0.2 Ω max. when new 0.2 Ω max. when new
Leakage current per point 10 μA max. -- --
Surge current 8 A for 100 ms max. 7 A with contacts closed 7 A with contacts closed
Overload protection No No No
Isolation (field side to 500 V AC for 1 minute 1500 V AC for 1 minute (coil 1500 V AC for 1 minute (coil
logic) to contact) to contact)
None (coil to logic) None (coil to logic)
Isolation resistance -- 100 M Ω min. when new 100 M Ω min. when new
S7-200 SMART
736 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay
Isolation between open -- 750 V AC for 1 minute 750 V AC for 1 minute
contacts
Isolation groups 1 1 1
Inductive clamp voltage L+ minus 48 V DC, 1 W dissi- Not recommended Not recommended
pation
Switching delay 1.0 μs max., off to on 10 ms max. 10 ms max.
(Qa.0 to Qa.3) 3.0 μs max., on to off
Switching delay 50 μs max., off to on, 10 ms max. 10 ms max.
(Qa.4 to Qb.7) 200 μs max., on to off
Lifetime mechanical (no -- 10,000,000 open/close cycles 10,000,000 open/close cycles
load)
Lifetime contacts at rated -- 100,000 open/close cycles 100,000 open/close cycles
load
Output state in STOP Last value or substitute value Last value or substitute value Last value or substitute value
mode (default value 0) (default value 0) (default value 0)
Number of outputs 12 12 12
on simultaneously
Cable length (max.), Shielded: 500 m Shielded: 500 m Shielded: 500 m
in meters Unshielded: 150 m Unshielded: 150 m Unshielded: 150 m
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 737
Technical specifications
A.2 S7-200 SMART CPUs
S7-200 SMART
738 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
① 24 V DC Sensor Power
Out
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 739
Technical specifications
A.2 S7-200 SMART CPUs
A.2.3 CPU ST40, CPU SR40, CPU CR40s, and CPU CR40
General specifications and features of the CPU ST40, CPU SR40, and CPU CR40s
Technical data CPU ST40 DC/DC/DC CPU SR40 CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay AC/DC/Relay
Article number 6ES7288-1ST40-0AA0 6ES7288-1SR40-0AA0 6ES7288-1CR40-0AA1 6ES7288-1CR40-
0AA0
Dimensions W x H x 125 x 100 x 81 125 x 100 x 81 125 x 100 x 81 125 x 100 x 81
D (mm)
Weight 410.3 grams 441.3 grams 475 grams 486.2 grams
Power dissipation 18 W 23 W 8W 8W
Current available (EM 1400 mA max. (5 V DC) 1400 mA max. (5 V DC) Not available Not available
bus)
Current available 300 mA max. (sensor 300 mA max. (sensor 300 mA max. (sensor 300 mA max.
(24 V DC) power) power) power) (sensor power)
Digital input current 4 mA/input used 4 mA/input used 4 mA/input used 4 mA/input used
consumption (24 V
DC)
S7-200 SMART
740 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
User Program 24 Kbytes 24 Kbytes 12 Kbytes
memory User data (V) 16 Kbytes 16 Kbytes 8 Kbytes
Retentive 10 Kbytes max.1 10 Kbytes max.1 2 Kbytes max.1
On-board digital I/O 24 inputs/16 outputs 24 inputs/16 outputs 24 inputs/16 outputs
Process image 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits
of outputs (Q) of outputs (Q) of outputs (Q)
Analog image 56 words of inputs (AI) / 56 56 words of inputs (AI) / 56 Not available
words of outputs (AQ) words of outputs (AQ)
Bit memory (M) 256 bits 256 bits 256 bits
Temporary (local) memory 64 bytes in the main program 64 bytes in the main program 64 bytes in the main program
(L) and 64 bytes in each subrou- and 64 bytes in each subrou- and 64 bytes in each subrou-
tine tine tine
and interrupt routine and interrupt routine and interrupt routine
60 bytes when programming 60 bytes when programming 60 bytes when programming
in in in
LAD or FBD (STEP 7- LAD or FBD (STEP 7- LAD or FBD (STEP 7-
Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes)
Sequential control relays 256 bits 256 bits 256 bits
(S)
Expansion modules ex- 6 max. 6 max. Not available
pansion
Signal board expansion 1 max. 1 max. Not available
High- Total 6 6 4
speed Single phase 4 at 200 kHz 4 at 200 kHz 4 at 100 kHz
counters
2 at 30 kHz 2 at 30 kHz
A/B phase 2 at 100 kHz 2 at 100 kHz 2 at 50 kHz
2 at 20 kHz 2 at 20 kHz
Pulse outputs 2 3 at 100 kHz 3 at 100 kHz Not available
Pulse catch inputs 14 14 Not available
Cyclic interrupts 2 at 1 ms resolution 2 at 1 ms resolution 2 at 1 ms resolution
Edge interrupts 4 rising and 4 falling (6 4 rising and 4 falling (6 4 rising and 4 falling
and 6 with optional signal and 6 with optional signal
board) board)
Memory card microSDHC Card (optional) microSDHC Card (optional) Not available
Real time clock accuracy 120 seconds/month 120 seconds/month Not available
Real time clock retention 7 days typ./6 days min. 7 days typ./6 days min. Not available
time at 25 °C at 25 °C
1 You can configure areas of V memory, M memory, C memory (current values), and portions of T memory (current val-
ues) on retentive, up to the specified maximum amount.
2 The specified maximum pulse frequency is possible only for CPU models with transistor outputs. Pulse output operation
is not recommended for CPU models with relay outputs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 741
Technical specifications
A.2 S7-200 SMART CPUs
S7-200 SMART
742 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 43 Performance
Element Description
POUs Type/quantity Main program: 1
Subroutines: 128 (0 to 127)
Interrupt routines: 128 (0 to 127)
Nesting depth From main program: 8 subroutine levels
From interrupt routine: 4 subroutine levels
Accumulators Quantity 4
Timers Type/quantity Non-retentive (TON, TOF): 192
Retentive (TONR): 64
Counters Quantity 256
Table A- 45 Communication
Technical data CPU ST40 DC/DC/DC CPU SR40 CPU CR40s CPU CR40 AC/DC/Relay
AC/DC/Relay AC/DC/Relay
Number of ports PROFINET (LAN): 1 PROFINET (LAN): 1 PROFINET (LAN): 0 PROFINET (LAN): 1
Serial ports: 1 (RS485) Serial ports: 1 (RS485) Serial ports: 1 Serial ports: 1 (RS485)
Add-on serial ports: 1 Add-on serial ports: 1 (RS485) Add-on serial ports: 0
(with optional (with optional Add-on serial ports: 0
RS232/485 signal RS232/485 signal
board) board)
HMI device PROFINET (LAN): 8 PROFINET (LAN): 8 PROFINET (LAN): Not PROFINET (LAN): 8
connections connections available connections
Serial ports: 4 connec- Serial ports: 4 connec- Serial ports: 4 connec- Serial ports: 4 connec-
tions per port tions per port tions per port tions per port
Programming PROFINET (LAN): 1 PROFINET (LAN): 1 PROFINET (LAN): Not PROFINET (LAN): 1
device (PG) connection connection available connection
Serial ports: 1 connec- Serial ports: 1 connec- Serial ports: 1 connec- Serial ports: 1 connection
tion tion tion
CPUs (PUT/GET) PROFINET (LAN): 8 PROFINET (LAN): 8 PROFINET (LAN): Not PROFINET (LAN): 8
client and 8 server client and 8 server con- available client and 8 server con-
connections nections nections
Open user com- PROFINET (LAN): 8 PROFINET (LAN): 8 PROFINET (LAN): Not PROFINET (LAN): 8
munication active and 8 passive active and 8 passive available active and 8 passive
connections connections connections
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 743
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST40 DC/DC/DC CPU SR40 CPU CR40s CPU CR40 AC/DC/Relay
AC/DC/Relay AC/DC/Relay
Data rates PROFINET (LAN): PROFINET (LAN): PROFINET (LAN): Not PROFINET (LAN):
10/100 Mb/s 10/100 Mb/s available 10/100 Mb/s
RS485 system proto- RS485 system proto- RS485 system proto- RS485 system protocols:
cols: 9600, 19200, and cols: 9600, 19200, and cols: 9600, 19200, and 9600, 19200, and
187500 b/s 187500 b/s 187500 b/s 187500 b/s
RS485 freeport: 1200 to RS485 freeport: 1200 to RS485 freeport: 1200 RS485 freeport: 1200 to
115200 b/s 115200 b/s to 115200 b/s 115200 b/s
Isolation (external PROFINET (LAN): PROFINET (LAN): PROFINET (LAN): Not PROFINET (LAN):
signal to PLC Transformer isolated, Transformer isolated, available Transformer isolated,
logic) 1500 V AC 1500 V AC RS485: none 1500 V AC
RS485: none RS485: none RS485: none
Cable type PROFINET (LAN): PROFINET (LAN): PROFINET (LAN): Not PROFINET (LAN):
CAT5e shielded CAT5e shielded available CAT5e shielded
RS485: PROFIBUS RS485: PROFIBUS RS485: PROFIBUS RS485: PROFIBUS net-
network cable network cable network cable work cable
PROFINET Communication
PROFINET con- Yes Yes No No
troller
PROFINET de- No No No No
vice
PROFINET controller
Services
PG/OP communi- Yes Yes No No
cation
S7 routing Yes Yes No No
Isochronous No No No No
mode
Open IE commu- Yes Yes No No
nication
IRT No No No No
MRP No No No No
PROFIenergy No No No No
Max. number of 8 8 -- --
PROFINET de-
vices that you can
connect for RT
Max. number of 64 64 -- --
module
Update times The minimum value of The minimum value of No No
the update time also the update time also
depends on the com- depends on the com-
munication component munication component
set for PROFINET, on set for PROFINET, on
the number of the number of
PROFINET devices, PROFINET devices,
and the quantity of and the quantity of con-
configured user data. figured user data.
S7-200 SMART
744 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST40 DC/DC/DC CPU SR40 CPU CR40s CPU CR40 AC/DC/Relay
AC/DC/Relay AC/DC/Relay
With RT
Send clock of 1 1 ms to 512 ms 1 ms to 512 ms -- --
ms
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 85 to 264 V AC 85 to 264 V AC
Line frequency -- 47 to 63 Hz 47 to 63 Hz
Input CPU only 190 mA at 24 V DC (without 130 mA at 120 V AC (without 150 mA at 120 V AC
current driving 300 mA sensor power) driving 300 mA sensor power) 80 mA at 240 V AC
(max. 470 mA at 24 V DC (with 250 mA at 120 V (with driving
load) driving 300 mA sensor power) 300 mA sensor power)
80 mA at 240 V AC (without
driving 300 mA sensor power)
150 mA at 240 V AC (with
driving 300 mA sensor power)
CPU with all 680 mA at 24 V DC 300 mA at 120 V AC --
expansion 190 mA at 240 V AC
accessories
Inrush current (max.) 11.7 A at 28.8 V DC 16.3 A at 264 V AC 16.3 A at 264 V AC
Isolation (input power to -- 1500 V AC 1500 V AC
logic)
Ground leakage, AC line -- 0.5 mA 0.5 mA
to functional earth
Hold up time (loss of pow- 20 ms at 24 V DC 30 ms at 120 V AC 30 ms at 120 V AC
er) 200 ms at 240 V AC 200 ms at 240 V AC
Internal fuse, not user 3 A, 250 V, slow blow 3 A, 250 V, slow blow 3 A, 250 V, slow blow
replaceable
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 20.4 to 28.8 V DC 20.4 to 28.8 V DC
Output current rating 300 mA 300 mA 300 mA (short circuit protect-
(max.) ed)
Maximum ripple noise < 1 V peak to peak < 1 V peak to peak < 1 V peak to peak
(<10 MHz)
Isolation (CPU logic to Not isolated Not isolated Not isolated
sensor power)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 745
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
Number of inputs 24 24 24
Type Sink/Source (IEC Type 1 sink, Sink/Source (IEC Type 1 Sink/Source (IEC Type 1 sink)
except I0.0 to I0.3) sink)
Rated voltage 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal
Continuous permissible 30 V DC, max. 30 V DC, max. 30 V DC, max.
voltage
Surge voltage 35 V DC for 0.5 sec. 35 V DC for 0.5 sec. 35 V DC for 0.5 sec.
Logic 1 signal (min.) I0.0 to I0.3: 4 V DC at 8 mA 15 V DC at 2.5 mA 15 V DC at 2.5 mA
Other inputs: 15 V DC at 2.5
mA
Logic 0 signal (max.) I0.0 to I0.3: 1 V DC at 1 mA 5 V DC at 1 mA 5 V DC at 1 mA
Other inputs: 5 V DC at 1 mA
Isolation (field side to 500 V AC for 1 minute 500 V AC for 1 minute 500 V AC for 1 minute
logic)
Isolation group 1 1 1
Filter times Individually selectable on Individually selectable on Individually selectable on
each channel (points I0.0 to each channel (points I0.0 to each channel (points I0.0 to
I1.5): I1.5): I1.5):
μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
Individually selectable on Individually selectable on Individually selectable on
each channel (points I1.6 and each channel (points I1.6 and each channel (points I1.6 and
greater): greater): greater):
ms: 0, 6.4, 12.8 ms: 0, 6.4, 12.8 ms: 0, 6.4, 12.8
HSC clock input rates Single phase: 4 HSCs at 200 Single phase: 4 HSCs at 200 Single phase: 4 HSCs at 100
(max.) kHz; kHz; kHz
(Logic 1 Level = 15 to 26 2 HSCs at 30 kHz 2 HSCs at 30 kHz A/B phase: 2 HSCs at 50 kHz
V DC) A/B phase: 2 HSCs at 100 A/B phase: 2 HSCs at 100
kHz; kHz;
2 HSCs at 20 kHz 2 HSCs at 20 kHz
S7-200 SMART
746 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
Number of inputs on sim- 24 24 24
ultaneously
Cable length (max.), in I0.0 to I0.3: All inputs: All inputs:
meters Shielded (only): Shielded: Shielded:
• 500 m normal (low-speed) • 500 m normal inputs • 500 m normal inputs
inputs, • 50 m HSC inputs • 50 m HSC inputs
• 50 m HSC (high-speed) Unshielded: Unshielded:
inputs
• 300 m normal inputs • 300 m normal inputs
All other inputs:
Shielded:
• 500 m normal inputs
Unshielded:
• 300 m normal inputs
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
Number of outputs 16 16 16
Type Solid state - MOSFET (sourc- Relay, dry contact Relay, dry contact
ing)
Voltage range 20.4 to 28.8 V DC 5 to 30 V DC or 5 to 250 V 5 to 30 V DC or 5 to 250 V AC
AC
Logic 1 signal at max. 20 V DC min. -- --
current
Logic 0 signal with 10 KΩ 0.1 V DC max. -- --
load
Rated current per point 0.5 A 2A 2A
(max.)
Rated current per com- 6A 10 A 10 A
mon (max.)
Lamp load 5W 30 W DC / 200 W AC 30 W DC / 200 W AC
ON state resistance 0.6 Ω max. 0.2 Ω max. when new 0.2 Ω max. when new
Leakage current per point 10 μA max. -- --
Surge current 8 A for 100 ms max. 7 A with contacts closed 7 A with contacts closed
Overload protection No No No
Isolation (field side to 500 V AC for 1 minute 1500 V AC for 1 minute (coil 1500 V AC for 1 minute (coil
logic) to contact) to contact)
None (coil to logic) None (coil to logic)
Isolation resistance -- 100 MΩ min. when new 100 MΩ min. when new
Isolation between open -- 750 V AC for 1 minute 750 V AC for 1 minute
contact
Isolation groups 2 4 4
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 747
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s CPU CR40
AC/DC/Relay AC/DC/Relay
Inductive clamp voltage L+ minus 48 V DC, 1 W dissi- -- --
pation
Switching delay (Qa.0 to 1.0 μs max., off to on 10 ms max. 10 ms max.
Qa.3) 3.0 μs max., on to off
Switching delay (Qa.4 to 50 μs max., off to on 10 ms max. 10 ms max.
Qb.7) 200 μs max., on to off
Lifetime mechanical (no -- 10,000,000 open/close cycles 10,000,000 open/close cycles
load)
Lifetime contacts at rated -- 100,000 open/close cycles 100,000 open/close cycles
load
Output state in STOP Last value or substitute value Last value or substitute value Last value or substitute value
mode (default value 0) (default value 0) (default value 0)
Number of outputs on 16 16 16
simultaneously
Cable length (max.), in Shielded: 500 m Shielded: 500 m Shielded: 500 m
meters Unshielded: 150 m Unshielded: 150 m Unshielded: 150 m
① 24 V DC Sensor Power
Out
S7-200 SMART
748 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
① 24 V DC Sensor Power
Out
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 749
Technical specifications
A.2 S7-200 SMART CPUs
S7-200 SMART
750 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 54 Wiring diagram for the CPU CR40s AC/DC/Relay (6ES7288-1CR40s-0AA1) and CPU
CR40 AC/DC/Relay (6ES7288-1CR40s-0AA0)
① 24 V DC Sensor Power
Out
Table A- 55 Connector pin locations for CPU CR40s AC/DC/Relay (6ES7288-1CR40-0AA1) and
CPU CR40 AC/DC/Relay (6ES7288-1CR40s-0AA0)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 751
Technical specifications
A.2 S7-200 SMART CPUs
A.2.4 CPU ST60, CPU SR60, CPU CR60s, and CPU CR60
Technical data CPU ST60 DC/DC/DC CPU SR60 CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay AC/DC/Relay
Article number 6ES7288-1ST60-0AA0 6ES7288-1SR60-0AA0 6ES7288-1CR60-0AA1 6ES7288-1CR60-
0AA0
Dimensions W x H x 175 x 100 x 81 175 x 100 x 81 175 x 100 x 81 175 x 100 x 81
D (mm)
Weight 528.2 grams 611.5 grams 605 grams 621.9 grams
Power dissipation 20 W 25 W 10 W 10 W
Current available (EM 1400 mA max. (5 V DC) 1400 mA max. (5 V DC) Not available Not available
bus)
Current available (24 300 mA max. (sensor 300 mA max. (sensor 300 mA max. (sensor 300 mA max.
V DC) power) power) power) (sensor power)
Digital input current 4 mA/input used 4 mA/input used 4 mA/input used 4 mA/input used
consumption (24 V
DC)
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
User Program 30 Kbytes 30 Kbytes 12 Kbytes
memory User 20 Kbytes 20 Kbytes 8 Kbytes
data (V)
Retentive 10 Kbytes max.1 10 Kbytes max.1 2 Kbytes max.1
On-board digital I/O 36 inputs/24 outputs 36 inputs/24 outputs 36 inputs/24 outputs
Process image 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits 256 bits of inputs (I) / 256 bits of
of outputs (Q) of outputs (Q) outputs (Q)
Analog image 56 words of inputs (AI) / 56 56 words of inputs (AI) / 56 Not available
words of outputs (AQ) words of outputs (AQ)
Bit memory (M) 256 bits 256 bits 256 bits
S7-200 SMART
752 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Temporary (local) 64 bytes in the main program 64 bytes in the main program 64 bytes in the main program and
memory (L) and 64 bytes in each subrou- and 64 bytes in each subrou- 64 bytes in each subroutine and
tine and interrupt routine tine and interrupt routine interrupt routine
60 bytes when programming 60 bytes when programming in 60 bytes when programming in
in LAD or FBD (STEP 7- LAD or FBD (STEP 7- LAD or FBD (STEP 7-Micro/WIN
Micro/WIN reserves 4 bytes) Micro/WIN reserves 4 bytes) reserves 4 bytes)
Sequential control 256 bits 256 bits 256 bits
relays (S)
Expansion modules 6 max. 6 max. Not available
expansion
Signal board expan- 1 max. 1 max. Not available
sion
High- Total 6 6 4
speed Single 4 at 200 kHz 4 at 200 kHz 4 at 100 kHz
counters phase 2 at 30 kHz 2 at 30 kHz
A/B 2 at 100 kHz 2 at 100 kHz 2 at 50 kHz
phase 2 at 20 kHz 2 at 20 kHz
Pulse outputs 2 3 at 100 kHz 3 at 100 kHz Not available
Pulse catch inputs 14 14 Not available
Cyclic interrupts 2 at 1 ms resolution 2 at 1 ms resolution 2 at 1 ms resolution
Edge interrupts 4 rising and 4 falling (6 and 6 4 rising and 4 falling (6 and 6 4 rising and 4 falling
with optional signal board) with optional signal board)
Memory card microSDHC card (optional) microSDHC card (optional) Not available
Real time clock accu- 120 seconds/month 120 seconds/month Not available
racy
Real time clock reten- 7 days typ./6 days min. at 25 7 days typ./6 days min. at 25 Not available
tion time °C °C
1 You can configure areas of V memory, M memory, C memory (current values) and portions of T memory (current values
on retentive timers) to be retentive, up to the specified maximum amount.
2 The specified maximum pulse frequency is possible only for CPU models with transistor outputs. Pulse output operation
is not recommended for CPU models with relay outputs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 753
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 59 Performance
S7-200 SMART
754 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Element Description
POUs Type/quantity Main program: 1
Subroutines: 128 (0 to 127)
Interrupt routines: 128 (0 to 127)
Nesting depth From main program: 8 subroutine levels
From interrupt routine: 4 subroutine levels
Accumulators Quantity 4
Timers Type/quantity Non-retentive (TON, TOF): 192
Retentive (TONR): 64
Counters Quantity 256
Table A- 61 Communication
Technical data CPU ST60 DC/DC/DC CPU SR60 CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay AC/DC/Relay
Number of ports PROFINET (LAN): 1 PROFINET (LAN): 1 PROFINET (LAN): 0 PROFINET (LAN): 1
Serial ports: 1 (RS485) Serial ports: 1 (RS485) Serial ports: 1 Serial ports: 1 (RS485)
Add-on serial ports: 1 Add-on serial ports: 1 (RS485) Add-on serial ports: 0
(with optional RS232/485 (with optional Add-on serial ports: 0
signal board) RS232/485 signal
board)
HMI device PROFINET (LAN): 8 PROFINET (LAN): 8 PROFINET (LAN): Not PROFINET (LAN): 8
connections connections available connections
Serial ports: 4 connec- Serial ports: 4 connec- Serial ports: 4 connec- Serial ports: 4 connec-
tions per port tions per port tions per port tions per port
Programming PROFINET (LAN): 1 PROFINET (LAN): 1 PROFINET (LAN): Not PROFINET (LAN): 1
device (PG) connection connection available connection
Serial ports: 1 connec- Serial ports: 1 connec- Serial ports: 1 connec- Serial ports: 1 connec-
tion tion tion tion
CPUs (PUT/GET) PROFINET (LAN): 8 PROFINET (LAN): 8 PROFINET (LAN): Not PROFINET (LAN): 8
client and 8 server con- client and 8 server con- available client and 8 server
nections nections connections
Open user com- PROFINET (LAN): 8 PROFINET (LAN): 8 PROFINET (LAN): Not PROFINET (LAN): 8
munication active and 8 passive active and 8 passive available active and 8 passive
connections connections connections
Data rates PROFINET (LAN): PROFINET (LAN): PROFINET (LAN): Not PROFINET (LAN):
10/100 Mb/s 10/100 Mb/s available 10/100 Mb/s
RS485 system protocols: RS485 system proto- RS485 system proto- RS485 system proto-
9600, 19200, and cols: 9600, 19200, and cols: 9600, 19200, and cols: 9600, 19200, and
187500 b/s 187500 b/s 187500 b/s 187500 b/s
RS485 freeport: 1200 to RS485 freeport: 1200 to RS485 freeport: 1200 RS485 freeport: 1200
115200 b/s 115200 b/s to 115200 b/s to 115200 b/s
Isolation (external PROFINET (LAN): PROFINET (LAN): PROFINET (LAN): Not PROFINET (LAN):
signal to PLC Transformer isolated, Transformer isolated, available Transformer isolated,
logic) 1500 V AC 1500 V AC RS485: none 1500 V AC
RS485: none RS485: none RS485: none
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 755
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST60 DC/DC/DC CPU SR60 CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay AC/DC/Relay
Cable type PROFINET (LAN): PROFINET (LAN): PROFINET (LAN): Not PROFINET (LAN):
CAT5e shielded CAT5e shielded available CAT5e shielded
RS485: PROFIBUS RS485: PROFIBUS RS485: PROFIBUS RS485: PROFIBUS
network cable network cable network cable network cable
PROFINET Communication
PROFINET con- Yes Yes No No
troller
PROFINET device No No No No
PROFINET controller
Services
PG/OP communi- Yes Yes No No
cation
S7 routing Yes Yes No No
Isochronous mode No No No No
Open IE commu- Yes Yes No No
nication
IRT No No No No
MRP No No No No
PROFIenergy No No No No
Max. number of 8 8 -- --
PROFINET devic-
es that you can
connect for RT
Max. number of 64 64 -- --
module
Update times The minimum value of The minimum value of No No
the update time also the update time also
depends on the commu- depends on the com-
nication component set munication component
for PROFINET, on the set for PROFINET, on
number of PROFINET the number of
devices, and the quantity PROFINET devices,
of configured user data. and the quantity of
configured user data.
With RT
Send clock of 1 1 ms to 512 ms 1 ms to 512 ms -- --
ms
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 85 to 264 V AC 85 to 264 V AC
Line frequency -- 47 to 63 Hz 47 to 63 Hz
S7-200 SMART
756 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Input CPU only 220 mA at 24 V DC (without 160 mA at 120 V AC (without 150 mA at 120 V AC
current driving 300 mA sensor power) driving 300 mA sensor power) 100 mA at 240 V AC
(max. 500 mA at 24 V DC (with 280 mA at 120 V AC (with
load) driving 300 mA sensor power) driving 300 mA sensor power)
90 mA at 240 V AC (without
driving 300 mA sensor power)
160 mA at 240 V AC (with
driving 300 mA sensor power)
CPU with all 710 mA at 24 V DC 370 mA at 120 V AC Not available
expansion 220 mA at 240 V AC
accessories
Inrush current (max.) 11.5 A at 28.8 V DC 16.3 A at 264 V DC 16.3 A at 264 V AC
Isolation (input power to None 1500 V AC 1500 V AC
logic)
Ground leakage, AC line None None None
to functional earth
Hold up time (loss of pow- 20 ms at 24 V DC 30 ms at 120 V AC 30 ms at 120 V AC
er) 200 ms at 240 V AC 200 ms at 240 V AC
Internal fuse, not user 3 A, 250 V, slow blow 3 A, 250 V, slow blow 3 A, 250 V, slow blow
replaceable
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Voltage range 20.4 to 28.8 V DC 20.4 to 28.8 V DC 20.4 to 28.8 V DC
Output current rating 300 mA 300 mA 300 mA (short circuit protect-
(max.) ed)
Maximum ripple noise < 1 V peak to peak < 1 V peak to peak < 1 V peak to peak
(<10 MHz)
Isolation (CPU logic to Not isolated Not isolated Not isolated
sensor power)
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Number of inputs 36 36 36
Type Sink/Source (IEC Type 1 sink, Sink/Source (IEC Type 1 Sink/Source (IEC Type 1 sink)
except I0.0 to I0.3) sink)
Rated voltage 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal 24 V DC at 4 mA, nominal
Continuous permissible 30 V DC, max. 30 V DC, max. 30 V DC, max.
voltage
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 757
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Surge voltage 35 V DC for 0.5 sec. 35 V DC for 0.5 sec. 35 V DC for 0.5 sec.
Logic 1 signal (min.) I0.0 to I0.3: 4 V DC at 8 mA 15 V DC at 2.5 mA 15 V DC at 2.5 mA
Other inputs: 15 V DC at 2.5
mA
Logic 0 signal (max.) I0.0 to I0.3: 1 V DC at 1 mA 5 V DC at 1 mA 5 V DC at 1 mA
Other inputs: 5 V DC at 1 mA
Isolation (field side to 500 V AC for 1 minute 500 V AC for 1 minute 500 V AC for 1 minute
logic)
Isolation groups 1 1 1
Filter times Individually selectable on Individually selectable on Individually selectable on
each channel (points I0.0 to each channel (points I0.0 to each channel (points I0.0 to
I1.5): I1.5): I1.5):
μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, μs: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, ms: 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,
12.8 12.8 12.8
Individually selectable on Individually selectable on Individually selectable on
each channel (points I1.6 and each channel (points I1.6 and each channel (points I1.6 and
greater): greater): greater):
ms: 0, 6.4, 12.8 ms: 0, 6.4, 12.8 ms: 0, 6.4, 12.8
HSC clock input rates Single phase: 4 HSCs at 200 Single phase: 4 HSCs at 200 Single phase: 4 HSCs at 100
(max.) kHz; kHz; kHz
(Logic 1 Level = 15 to 26 2 HSCs at 30 kHz 2 HSCs at 30 kHz A/B phase: 2 HSCs at 50 kHz
V DC) A/B phase: 2 HSCs at 100 A/B phase: 2 HSCs at 100
kHz; kHz;
2 HSCs at 20 kHz 2 HSCs at 20 kHz
Number of inputs on sim- 36 36 36
ultaneously
Cable length (max.), in I0.0 to I0.3: All inputs: All inputs:
meters Shielded (only): Shielded: Shielded:
• 500 m normal (low-speed) • 500 m normal inputs • 500 m normal inputs
inputs • 50 m HSC inputs • 50 m HSC inputs
• 50 m HSC (high-speed) Unshielded: Unshielded:
inputs
• 300 m normal inputs • 300 m normal inputs
All other inputs:
Shielded:
• 500 m normal inputs
Unshielded:
• 300 m normal inputs
S7-200 SMART
758 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s CPU CR60
AC/DC/Relay AC/DC/Relay
Number of outputs 24 24 24
Type Solid state - MOSFET (sourc- Relay, dry contact Relay, dry contact
ing)
Voltage range 20.4 to 28.8 V DC 5 to 30 V DC or 5 to 250 V 5 to 30 V DC or 5 to 250 V AC
AC
Logic 1 signal at max. 20 V DC min. -- --
current
Logic 0 signal with 10 KΩ 0.1 V DC max. -- --
load
Rated current per point 0.5 A 2A 2A
(max.)
Rated current per com- 6A 10 A 10 A
mon (max.)
Lamp load 5W 30 W DC / 200 W AC 30 W DC / 200 W AC
ON state resistance 0.6 Ω max. 0.2 Ω max. when new 0.2 Ω max. when new
Leakage current per point 10 μA max. -- --
Surge current 8 A for 100 ms max. 7 A with contacts closed 7 A with contacts closed
Overload protection No No No
Isolation (field side to 500 V AC for 1 minute 1500 V AC for 1 minute (coil 1500 V AC for 1 minute (coil
logic) to contact) None (coil to logic) to contact) None (coil to logic)
Isolation resistance -- 100 M Ω min. when new 100 M Ω min. when new
Isolation between open -- 750 V AC for 1 minute 750 V AC for 1 minute
contacts
Isolation groups 3 6 6
Inductive clamp voltage L+ minus 48 V DC, 1 W dissi- -- -
pation
Switching delay (Qa.0 to 1.0 μs max., off to on 10 ms max. 10 ms max.
Qa.3) 3.0 μs max., on to off
Switching delay (Qa.4 to 50 μs max., off to on 10 ms max. 10 ms max.
Qc.7) 200 μs max., on to off
Lifetime mechanical (no -- 10,000,000 open/close cycles 10,000,000 open/close cycles
load)
Lifetime contacts at rated -- 100,000 open/close cycles 100,000 open/close cycles
load
Output behavior in STOP Last value or substitute value Last value or substitute value Last value or substitute value
(default value 0) (default value 0) (default value 0)
Number of outputs on 24 24 24
simultaneously
Cable length (max.), in Shielded: 500 m Shielded: 500 m Shielded: 500 m
meters Unshielded: 150 m Unshielded: 150 m Unshielded: 150 m
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 759
Technical specifications
A.2 S7-200 SMART CPUs
① 24 V DC
Sensor Power
Output
S7-200 SMART
760 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
① 24 V DC
Sensor Power
Output
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 761
Technical specifications
A.2 S7-200 SMART CPUs
Table A- 70 Wiring diagram for the CPU CR60s AC/DC/Relay (6ES7288-1CR60-0AA1) and CPU
CR60 AC/DC/Relay (6ES7288-1CR60-0AA0)
① 24 V DC
Sensor Pow-
er
Output
Table A- 71 Connector pin locations for CPU CR60s AC/DC/Relay (6ES7288-1CR60-0AA1) and
CPU CR60 AC/DC/Relay (6ES7288-1CR60-0AA0)
S7-200 SMART
762 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.2 S7-200 SMART CPUs
A.2.5 Wiring diagrams for sink and source input, and relay output
Table A- 72 Wiring diagrams for sink input, source input, and relay output
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 763
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
S7-200 SMART
764 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 75 Wiring diagram for the EM DE08 Digital 8 x Inputs (6ES7288-2DE08-0AA0) and EM
DE16 Digital 16 x Input (6ES7288-2DE16-0AA0)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 765
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
S7-200 SMART
766 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 767
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 80 Wiring diagrams for the EM DT08 Digital 8 x Outputs (6ES7288-2DT08-0AA0) and EM
DR08 Digital 8 x Outputs x Relay (6ES7288-2DR08-0AA0)
Table A- 82 Connector pin locations for EM DR08 Digital 8 x Outputs x Relay (6ES7288-2DR08-
0AA0)
S7-200 SMART
768 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 83 Wiring diagrams for the EM QR16 Digital 16 x Outputs Relay (6ES7288-2QR16-0AA0)
and EM QT16 Digital 16 x Outputs Transition (6ES7288-2QT16-0AA0)
Table A- 84 Connector pin locations for EM QR16 Digital 16 x Outputs Relay (6ES7288-2QR16-
0AA0)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 769
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 85 Connector pin locations for EM QT16 Digital 16 x Outputs Transition (6ES7288-2QT16-
0AA0)
S7-200 SMART
770 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 771
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
S7-200 SMART
772 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 89 Wiring diagrams for the EM DT16 Digital 8 x Inputs / Digital 8 x Outputs
(6ES7288-2DT16-0AA0) and EM DR16 Digital 8 x Inputs / 8 x Relay Outputs (6ES7288-
2DR16-0AA0)
EM DT16 Digital 8 x Inputs / Digital 8 x Outputs EM DR16 Digital 8 x Inputs / 8 x Relay Outputs
(6ES7288-2DT16-0AA0) (6ES7288-2DR16-0AA0)
Table A- 90 Connector pin locations for EM DT16 Digital 8 x Inputs / Digital 8 x Outputs (6ES7288-
2DT16-0AA0)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 773
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 91 Connector pin locations for EM DR16 Digital 8 x Inputs / 8 x Relay Outputs (6ES7288-
2DR16-0AA0)
Table A- 92 Wiring diagrams for the EM DT32 Digital 16 x Inputs / Digital 16 x Outputs (6ES7288-
2DT32-0AA0 and EM DR32 Digital 16 x Inputs / 16 x Relay (6ES7288-2DR32-0AA0)
S7-200 SMART
774 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.3 Digital inputs and outputs expansion modules (EMs)
Table A- 93 Connector pin locations for EM DT32 Digital 16 x Inputs / Digital 16 x Outputs (6ES7288-
2DT32-0AA0)
Table A- 94 Connector pin locations for EM DR32 Digital 16 x Inputs / 16 x Relay (6ES7288-2DR32-
0AA0)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 775
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
S7-200 SMART
776 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Table A- 97 Diagnostics
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 777
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Table A- 98 Wiring diagram EM AE04 Analog 4 x Inputs (6ES7288-3AE04-0AA0) and EM AE08 Ana-
log 8 x Inputs (6ES7288-3AE08-0AA0
Note: Connectors must be gold. See Appendix F, Spare parts and other hardware, for article number.
Table A- 100 Connector pin locations for EM AE08 Analog 8 x Inputs (6ES7288-3AE08-0AA0)
S7-200 SMART
778 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Technical data EM Analog 2 x outputs (EM AQ02) EM Analog 4 x outputs (EM AQ04)
Article number 6ES7288-3AQ02-0AA0 6ES7288-3AQ04-0AA0
Dimensions W x H x D (mm) 45 x 100 x 81 45 x 100 x 81
Weight 147.1 grams 170.5 grams
Power dissipation 1.5 W (no load) 2.1 W (no load)
Current consumption (SM Bus) 60 mA 60 mA
Current consumption (24 V DC) 50 mA (no load) 75 mA (no load)
90 mA (20 mA load per channel) 155 mA (20 mA load per channel)
Technical data EM Analog 2 x outputs (EM AQ02) EM Analog 4 x outputs (EM AQ04)
Number of outputs 2 4
Type Voltage or current Voltage or current
Range ±10 V or 0 to 20 mA ±10 V or 0 to 20 mA
Resolution Voltage mode: 11 bits + sign bit Voltage mode: 11 bits + sign bit
Current mode: 11 bits Current mode: 11 bits
Full scale range (data word) Voltage: -27,648 to 27,648 Voltage: -27,648 to 27,648
Current: 0 to 27,648 Current: 0 to 27,648
(Refer to the output ranges for voltage and
current (Page 787).)
Accuracy (25 °C / 0 to 55 °C) ±0.5% / ±1.0% of full scale ±0.5% / ±1.0% of full scale
Settling time (95% of new value) Voltage: 300 μs (R), 750 μ (R), 750 μs (1 Voltage: 300 μs (R), 750 μ (R), 750 μs (1
μF) μF)
Current: 600 μs (1 mH), 2 ms (10 mH) Current: 600 μs (1 mH), 2 ms (10 mH)
Load impedance Voltage: ≥ 1000 Ω Voltage: ≥ 1000 Ω
Current: ≤ 500 Ω Current: ≤ 600 Ω
Output behavior in STOP Last value or substitute value (default Last value or substitute value (default value
value 0) 0)
Isolation (field side to logic) None None
Cable length (max.), in meters 100 m twisted and shielded 100 m twisted and shielded
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 779
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Technical data EM Analog 2 x outputs (EM AQ02) EM Analog 4 x outputs (EM AQ04)
Overflow/underflow Yes Yes
Short to ground (voltage mode Yes Yes
only)
Wire break (current mode only) Yes Yes
24 V DC low voltage Yes Yes
Table A- 104 Wiring diagram for the EM AQ02 Analog 2 x Outputs (6ES7288-3AQ02-0AA0) and EM
AQ04 Analog 4 x Outputs (6ES7288-3AQ04-0AA0)
Note: Connectors must be gold. See Appendix F, Spare parts and other hardware, for article number.
Table A- 105 Connector pin locations for EM AQ02 Analog 2 x Outputs (6ES7288-3AQ02-0AA0)
S7-200 SMART
780 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Table A- 106 Connector pin locations for EM AQ04 Analog 4 x Outputs (6ES7288-3AQ04-0AA0)
Technical data EM 2 x Analog Inputs / 1 x Analog Out- EM 4 x Analog Inputs / 2 x Analog Outputs
puts (AM03) (AM06)
Article number 6ES7288-3AM03-0AA0 6ES7288-3AM06-0AA0
Dimensions W x H x D (mm) 45 x 100 x 81 45 x 100 x 81
Weight 172 grams 173.4 grams
Power dissipation 1.1 W (no load) 2.0 W (no load)
Current consumption (SM Bus) 60 mA 80 mA
Current consumption (24 V DC) 30 mA (no load) 60 mA (no load)
50 mA (20 mA load per channel) 100 mA (20 mA load per channel)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 781
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Technical data EM 2 x Analog Inputs / 1 x Analog Out- EM 4 x Analog Inputs / 2 x Analog Outputs
puts (AM03) (AM06)
Number of outputs 1 2
Type Voltage or current Voltage or current
Range ±10 V or 0 to 20 mA ±10 V or 0 to 20 mA
Resolution Voltage mode: 11 bits + sign Voltage mode: 11 bits + sign
Current mode: 11 bits Current mode: 11 bits
Full scale range (data word) Voltage: -27,648 to 27,648 Voltage: -27,648 to 27,648
Current: 0 to 27,648 Current: 0 to 27,648
Accuracy (25 °C / 0 to 55 °C) ±0.5% / ±1.0% of full scale ±0.5% / ±1.0% of full scale
Settling time (95% of new value) Voltage: 300 μs (R), 750 μs (1 μF) Voltage: 300 μs (R), 750 μs (1 μF)
Current: 600 μs (1 mH), 2 ms (10 mH) Current: 600 μs (1 mH), 2 ms (10 mH)
Load impedance Voltage: ≥ 1000 Ω Voltage: ≥ 1000 Ω
Current: ≤ 500 Ω Current: ≤ 500 Ω
Output behavior in STOP Last value or substitute value (default Last value or substitute value (default value
value 0) 0)
S7-200 SMART
782 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Technical data EM 2 x Analog Inputs / 1 x Analog Out- EM 4 x Analog Inputs / 2 x Analog Outputs
puts (AM03) (AM06)
Isolation (field side to logic) None None
Cable length (max.), in meters 100 m twisted and shielded 100 m twisted and shielded
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 783
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Table A- 111 Wiring diagrams for the EM AM03 2 x Analog Inputs / 1 x Analog Outputs (6ES7288-
3AM03-0AA and the EM AM06 4 x Analog Inputs / 2 x Analog Outputs (6ES7288-
3AM06-0AA0)
EM AM03 2 x Analog Inputs / 1 x Analog Outputs EM AM06 4 x Analog Inputs / 2 x Analog Outputs
(6ES7288-3AM03-0AA0) (6ES7288-3AM06-0AA0)
Note: Connectors must be gold. See Appendix F, Spare parts and other hardware, for article number.
Table A- 112 Connector pin locations for AM03 2 x Analog Inputs / 1 x Analog Outputs (6ES7288-
3AM03-0AA0)
S7-200 SMART
784 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
Table A- 113 Connector pin locations for AM06 4 x Analog Inputs / 2 x Analog Outputs (6ES7288-3AM06-0AA0)
Smoothing selection (sample averaging) Noise reduction/rejection frequency (Integration time selection)
400 Hz (2.5 ms) 60 Hz (16.6 ms) 50 Hz (20 ms) 10 Hz (100 ms)
None (1 cycle): No averaging 4 ms 18 ms 22 ms 100 ms
Weak (4 cycles): 4 samples 9 ms 52 ms 63 ms 320 ms
Medium (16 cycles): 16 samples 32 ms 203 ms 241 ms 1200 ms
Strong (32 cycles): 32 samples 61 ms 400 ms 483 ms 2410 ms
Sample time
• 4 AI x 13 bits • 0.625 ms • 4.17 ms • 5 ms • 25 ms
• 8 AI x 13 bits • 1.25 ms • 4.17 ms • 5 ms • 25 ms
A.4.5 Sample time and update times for the analog inputs
Rejection frequency (Integra- Sample time Module update time for all channels
tion time) 4-channel SM 8-channel SM
400 Hz (2.5 ms) • 4-channel SM: 0.625 ms 0.625 ms 1.250 ms
• 8-channel SM: 1.250 ms
60 Hz (16.6 ms) 4.170 ms 4.17 ms 4.17 ms
50 Hz (20 ms) 5.000 ms 5 ms 5 ms
10 Hz (100 ms) 25.000 ms 25 ms 25 ms
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 785
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
A.4.6 Measurement ranges of the analog inputs for voltage and current (SB and EM)
Table A- 116 Analog input representation for voltage (SB and EM)
Table A- 117 Analog input representation for current (SB and EM)
S7-200 SMART
786 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.4 Analog inputs and outputs expansion modules (EMs)
A.4.7 Measurement ranges of the analog outputs for voltage and current (SB and EM)
Table A- 118 Analog output representation for voltage (SB and EM)
Table A- 119 Analog output representation for current (SB and EM)
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 787
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
S7-200 SMART
788 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
The EM AT04 Thermocouple (TC) analog expansion module measures the value of voltage
connected to the module inputs. The temperature measurement type can be either
"Thermocouple" or "Voltage".
● "Thermocouple": The value will be reported in degrees multiplied by ten (for example, 25.3
degrees will be reported as decimal 253).
● "Voltage": The nominal range full scale value will be decimal 27648.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 789
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
Table A- 123 Wiring diagram for the EM AT04 Thermocouple 4 x 16 bit (6ES7288-3AT04-0AA0)
EM AT04 4 x 16 bit
(6ES7288-3AT04-0AA0)
Note: Connectors must be gold. See Appendix F, Spare Parts and other hardware for article number.
Note
Unused analog inputs should be shorted.
The thermocouple unused channels can be deactivated. No error will occur if an unused
channel is deactivated.
S7-200 SMART
790 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
Thermocouples are formed whenever two dissimilar metals are electrically bonded to each
other. A voltage is generated that is proportional to the junction temperature. This voltage is
small; one microvolt could represent many degrees. Measuring the voltage from a
thermocouple, compensating for extra junctions, and then linearizing the result forms the
basis of temperature measurement using thermocouples.
When you connect a thermocouple to the EM AT04 Thermocouple module, the two
dissimilar metal wires are attached to the module at the module signal connector. The place
where the two dissimilar wires are attached to each other forms the sensor thermocouple.
Two more thermocouples are formed where the two dissimilar wires are attached to the
signal connector. The connector temperature causes a voltage that adds to the voltage from
the sensor thermocouple. If this voltage is not corrected, then the temperature reported will
deviate from the sensor temperature.
Cold junction compensation is used to compensate for the connector thermocouple.
Thermocouple tables are based on a reference junction temperature, usually zero degrees
Celsius. The cold junction compensation compensates the connector to zero degrees
Celsius. The cold junction compensation restores the voltage added by the connector
thermocouples. The temperature of the module is measured internally, and then converted to
a value to be added to the sensor conversion. The corrected sensor conversion is then
linearized using the thermocouple tables.
For optimum operation of the cold junction compensation, the thermocouple module must be
located in a thermally stable environment. Slow variation (less than 0.1 °C/minute) in
ambient module temperature is correctly compensated within the module specifications. Air
movement across the module will also cause cold junction compensation errors.
If better cold junction error compensation is needed, an external iso-thermal terminal block
may be used. The thermocouple module provides for use of a 0 °C referenced or 50 °C
referenced terminal block.
The ranges and accuracy for the different thermocouple types supported by the EM AT04
Thermocouple expansion module are shown in the table below.
Type Under-range Nominal range Nominal range Over-range Normal range 3, 4 Normal range 1, 2
minimum1 low limit high limit maximum2 accuracy @ 25 °C accuracy -20
°C to 55 °C
J -210.0 °C -150.0 °C 1200.0 °C 1450.0 °C ±0.3 °C ±0.6 °C
K -270.0 °C -200.0 °C 1372.0 °C 1622.0 °C ±0.4 °C ±1.0 °C
T -270.0 °C -200.0 °C 400.0 °C 540.0 °C ±0.5 °C ±1.0 °C
E -270.0 °C -200.0 °C 1000.0 °C 1200.0 °C ±0.3 °C ±0.6 °C
R&S -50.0 °C 100.0 °C 1768.0 °C 2019.0 °C ±1.0 °C ±2.5 °C
B 0.0 °C 200.0 °C 800.0 °C -- ±2.0 °C ±2.5 °C
-- 800.0 °C 1820.0 °C 1820 °C ±1.0 °C ±2.3 °C
N -270.0 °C -200.0 °C 1300.0 °C 1550.0 °C ±1.0 °C ±1.6 °C
C 0.0 °C 100.0 °C 2315.0 °C 2500.0 °C ±0.7 °C ±2.7 °C
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 791
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
Type Under-range Nominal range Nominal range Over-range Normal range 3, 4 Normal range 1, 2
minimum1 low limit high limit maximum2 accuracy @ 25 °C accuracy -20
°C to 55 °C
TXK/XK(L) -200.0 °C -150.0 °C 800.0 °C 1050 °C ±0.6 °C ±1.2 °C
Voltage -32512 -27648 27648 32511 ±0.05% ±0.1%
-80mV 80mV
1 Thermocouple values below the under-range minimum value are reported as -32768.
2 Thermocouple values above the over-range maximum value are reported as 32767.
3 Internal cold junction error is ±1.5 °C for all ranges. This adds to the error in this table. The module requires at least 30
minutes of warm-up time to meet this specification.
4 In the presence of radiated radio frequency of 970 MHz to 990 MHz, the accuracy of the EM AT04 AI 4 x 16 bit TC may
be degraded.
Note
Thermocouple channel
Each channel on the Thermocouple expansion module can be configured with a different
thermocouple type (selectable in the software during configuration of the module).
Table A- 126 Noise reduction and update times for the EM AT04 Thermocouple
Rejection frequency selection Integration time 4 Channel module update time (seconds)
400 Hz (2.5 ms) 10 ms 1 0.143
60 Hz (16.6 ms) 16.67 ms 0.223
50 Hz (20 ms) 20 ms 0.263
10 Hz (100 ms) 100 ms 1.225
1 To maintain module resolution and accuracy when 400 Hz rejection is selected, the integration time is 10 ms. This
selection also rejects 100 Hz and 200 Hz noise.
It is recommended for measuring thermocouples that a 100 ms integration time be used. The
use of smaller integration times will increase the repeatability error of the temperature
readings.
Note
After power is applied, the module performs internal calibration for the analog-to-digital
converter. During this time the module reports a value of 32767 on each channel until valid
data is available on that channel. Your user program may need to allow for this initialization
time. Because the configuration of the module can vary the length of the initialization time,
you should verify the behavior of the module in your configuration. If required, you can
include logic in your user program to accommodate the initialization time of the module.
S7-200 SMART
792 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
EM RTD specifications
Technical data EM RTD 2 x 16 bit (EM AR02) EM RTD 4 x 16 bit (EM AR04)
Article number 6ES7288-3AR02-0AA0 6ES7288-3AR04-0AA0
Dimensions W x H x D (mm) 45 x 100 x 81 45 x 100 x 81
Weight 148.7 grams 150 grams
Power dissipation 1.5 W 1.5 W
Current consumption (SM Bus) 80 mA 80 mA
Current consumption (24 V DC) 1 40 mA 40 mA
Technical data EM RTD 2 x 16 bit (EM AR02) EM RTD 4 x 16 bit (EM AR04)
Number of inputs 2 4
Type Module referenced RTD and Ω Module referenced RTD and Ω
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 793
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
Technical data EM RTD 2 x 16 bit (EM AR02) EM RTD 4 x 16 bit (EM AR04)
Range See RTD Sensor selection table See RTD Sensor selection table
Nominal range (data word)
Overshoot/undershoot range
(data word)
Overflow/underflow (data word)
Resolution Temperature 0.1 °C / 0.1 °F 0.1 °C / 0.1 °F
Resistance 15 bits + sign bit 15 bits + sign bit
Maximum withstand voltage ±35 V ±35 V
Noise rejection 85 dB at 10 Hz / 50 Hz /60 Hz / 400 Hz 85 dB at 10 Hz / 50 Hz /60 Hz / 400 Hz
Common mode rejection >120 dB >120 dB
Impedance ≥10 M Ω ≥10 M Ω
Isolation Field side to 500 V AC 500 V AC
logic
Field to 24 V DC 500 V AC 500 V AC
24 V DC to logic 500 V AC 500 V AC
Channel to channel isolation 0 0
Accuracy See RTD Sensor selection table See RTD Sensor selection table
Repeatability ±0.05% FS ±0.05% FS
Maximum sensor dissipation 0.5 m W 0.5 m W
Measuring principle Sigma-delta Sigma-delta
Module update time See Noise reduction selection table See Noise reduction selection table
Cable length (max.), in meters 100 m to sensor max. 100 m to sensor max.
Wire re- except 10 Ω 20 Ω 20 Ω
sistance RTD
(max.) 10 Ω RTD 2.7 Ω 2.7 Ω
Technical data EM RTD 2 x 16 bit (EM AR02) EM RTD 4 x 16 bit (EM AR04)
Overflow/underflow 1,2 Yes Yes
Wire break 3 Yes Yes
24 V DC low voltage 1 Yes Yes
1 The overflow, underflow and low voltage diagnostic alarm information will be reported in the analog data values even if
the alarms are disabled in the module configuration.
2 For resistance ranges underflow detection is never enabled.
3 When wire break alarm is disabled and an open wire condition exists in the sensor wiring, the module may report ran-
dom values.
S7-200 SMART
794 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
The EM RTD analog expansion module measures the value of resistance connected to the
module inputs. The measurement type can be selected as either "Resistor" or "Thermal
resistor".
● "Resistor": The nominal range full scale value will be decimal 27648.
● "Thermal resistor": The value will be reported in degrees multiplied by ten (for example,
25.3 degrees will be reported as decimal 253).
The EM RTD module supports measurements with 2-wire, 3-wire and 4-wire connections to
the sensor resistor.
Table A- 131 Ranges and accuracy for the different sensors supported by the RTD expansion module
Temperature coef- RTD type Under range Nominal Nominal Over range Normal Normal
ficient minimum1 range low limit range high maximum2 range accu- range accu-
limit racy racy -20 ° C
@ 25 °C to 60 °C
Pt 0.003850 Pt 10 -243.0 °C -200.0 °C 850.0 °C 1000.0 °C ±1.0 °C ±2.0 °C
ITS90 Pt 50 -243.0 °C -200.0 °C 850.0 °C 1000.0 °C ±0.5 °C ±1.0 °C
DIN EN 60751 Pt 100
Pt 200
Pt 500
Pt 1000
Pt 0.003902 Pt 100 -243.0 °C -200.0 °C 850.0 °C 1000.0 °C ± 0.5 °C ±1.0 °C
Pt 0.003916 Pt 200 -243.0 °C -200.0 °C 850. 0°C 1000. 0°C ± 0.5 °C ±1.0 °C
Pt 0.003920
Pt 500
Pt 1000
Pt 0.003910 Pt 10 -273.2 °C -240.0 °C 1100. 0°C 1295 °C ±1.0 °C ±2.0 °C
Pt 50 -273.2 °C -240.0 °C 1100.0 °C 1295 °C ±0.8 °C ±1.6 °C
Pt 100
Pt 500
Ni 0.006720 Ni 100 -105.0 °C -60.0 °C 250.0 °C 295.0 °C ±0.5 °C ±1.0 °C
Ni 0.006180 Ni 120
Ni 200
Ni 500
Ni 1000
LG-Ni 0.005000 LG-Ni 1000 -105.0 °C -60.0 °C 250.0 °C 295.0 °C ±0.5 °C ±1.0 °C
Ni 0.006170 Ni 100 -105.0 °C -60.0 °C 180.0 °C 212.4 °C ±0.5 °C ±1.0 °C
Cu 0.004270 Cu 10 -240.0 °C -200.0 °C 260.0 °C 312.0 °C ±1.0 °C ±2.0 °C
Cu 0.004260 Cu 10 -60.0 °C -50.0 °C 200.0 °C 240.0 °C ±1.0 °C ±2.0 °C
Cu 50 -60.0 °C -50.0 °C 200.0 °C 240.0 °C ±0.6 °C ±1.2 °C
Cu 100
Cu 0.004280 Cu 10 -240.0 °C -200.0 °C 200.0 °C 240.0 °C ±1.0 °C ±2.0 °C
Cu 50 -240.0 °C -200.0 °C 200.0 °C 240.0 °C ±0.7 °C ±1.4 °C
Cu 100
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 795
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
Range Under range Nominal range Nominal range Over range Normal range Normal range
minimum low limit high limit maximum1 accuracy @ 25 accuracy -20
°C °C to 60°C
150 Ω n/a 0 (0 Ω) 27648 (150 Ω) 176.383 Ω ±0.05% ±0.1%
300 Ω n/a 0 (0 Ω) 27648 (300 Ω) 352.767 Ω ±0.05% ±0.1%
600 Ω n/a 0 (0 Ω) 27648 (600 Ω) 705.534 Ω ±0.05% ±0.1%
1 Resistance values above the over-range minimum value are reported as +32767.
Note
The module reports 32767 on any activated channel with no sensor connected. If open wire
detection is also enabled, the module flashes the appropriate red LEDs.
When 500 Ω and 1000 Ω RTD ranges are used with other lower value resistors, the error
may increase to two times the specified error.
Best accuracy will be achieved for the 10 Ω RTD ranges if 4 wire connections are used.
The resistance of the connection wires in 2 wire mode will cause an error in the sensor
reading and therefore accuracy is not guaranteed.
Table A- 133 Noise reduction and update times for the RTD module
S7-200 SMART
796 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.5 Thermocouple and RTD expansion modules (EMs)
Note
After power is applied, the module performs internal calibration for the analog-to-digital
converter. During this time the module reports a value of 32767 on each channel until valid
data is available on that channel. Your user program may need to allow for this initialization
time. Because the configuration of the module can vary the length of the initialization time,
you should verify the behavior or the module in your configuration. If required, you can
include logic in your user program to accommodate the initialization time of the module.
Table A- 134 Wiring diagrams for the EM AR02 RTD 2 x 16 bit (6ES7288-3AR02-0AA0) and EM AR04
RTD 4 x 16 bit (6ES7288-3AR04-0AA0)
Note: Connectors must be gold. See Appendix F, Spare parts and other hardware, for article number.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 797
Technical specifications
A.6 Digital signal boards
Table A- 135 Connector pin locations for EM AR02 RTD 2 x 16 bit (6ES7288-3AR02-0AA0)
Table A- 136 Connector pin locations for EM AR04 RTD 4 x 16 bit (6ES7288-3AR04-0AA0)
S7-200 SMART
798 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.6 Digital signal boards
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 799
Technical specifications
A.6 Digital signal boards
Table A- 140 Wiring diagram for the SB DT04 2 Digital Input/2 Digital Output (6ES7288-5DT04-0AA0)
Table A- 141 Connector pin locations for SB DT04 2 Digital Input/2 Digital Output (6ES7288-5DT04-
0AA0)
Pin X19
1 DQ f.0
2 DQ f.1
3 DI f.0
4 DI f.1
5 L+ / 24 V DC
6 M / 24 V DC
S7-200 SMART
800 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.7 Analog signal boards
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 801
Technical specifications
A.7 Analog signal boards
Table A- 145 Wiring diagram for the SB AE01 Analog 1 x Input (6ES7288-5AE01-0AA0)
S7-200 SMART
802 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.7 Analog signal boards
Table A- 146 Connector pin locations for SB AE01 Analog Input 1 x Input (6ES7288-5AE01-0AA0)
Pin X19
1 No connection
2 No connection
3 AI R
4 AI 0+
5 AI 0+
6 AI 0-
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 803
Technical specifications
A.7 Analog signal boards
Table A- 150 Wiring diagram for the SB AQ01 Analog 1 x Output (6ES7288-5AQ01-0AA0)
Table A- 151 Connector pin locations for SB AQ01 Analog 1 x Output (6ES7288-5AQ01-0AA0)
Pin X19
1 No connection
2 No connection
3 No connection
4 Functional Earth
5 AQ 0
6 AQ 0M
S7-200 SMART
804 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.8 RS485/RS232 signal boards
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 805
Technical specifications
A.8 RS485/RS232 signal boards
Pin X20
1 Functional Earth
2 Tx/B
3 RTS
4 M
5 Rx/A
6 5 V Out (Bias Voltage)
S7-200 SMART
806 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.9 Battery board signal boards (SBs)
Note
The SB BA01 is mechanically designed to fit the CPUs with the firmware V2.0 and later
versions.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 807
Technical specifications
A.10 EM DP01 PROFIBUS DP module
Table A- 158 Wiring diagram for the SB BA01 Battery board (6ES7288-5BA01-0AA0)
S7-200 SMART
808 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.10 EM DP01 PROFIBUS DP module
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 809
Technical specifications
A.10 EM DP01 PROFIBUS DP module
A.10.1 S7-200 SMART CPUs that support the EM DP01 PROFIBUS DP module
The S7-200 SMART EM DP01 PROFIBUS DP module is an intelligent expansion module
designed to work with the S7-200 SMART CPUs, firmware version 2.1 or later, shown in the
following table.
Table A- 162 EM DP01 PROFIBUS DP module compatibility with S7-200 SMART CPUs, firmware
version 2.1 or later
CPU Description
ST20 CPU ST20 (DC/DC/DC)
SR20 CPU SR20 (AC/DC/Relay)
ST30 CPU ST30 (DC/DC/DC)
SR30 CPU SR30 (AC/DC/Relay)
ST40 CPU ST40 (DC/DC/DC)
SR40 CPU SR40 (AC/DC/Relay)
ST60 CPU ST60 (DC/DC/DC)
SR60 CPU SR60 (AC/DC/Relay)
S7-200 SMART
810 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.10 EM DP01 PROFIBUS DP module
Table A- 164 Wiring diagram for the EM DP01 PROFIBUS DP module (6ES7288-7DP01-0AA0
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 811
Technical specifications
A.11 S7-200 SMART cables
Table A- 165 Connector pin locations for EM DP01 PROFIBUS DP module (6ES7288-7DP01-0AA0)
Pin X80
1 L+ / 24 V DC
2 M / 24 V DC
3 Functional Earth
Technical Data
Article number 6ES7288-6EC01-0AA0
Cable length 1m
Weight 80 g
Refer to the installation section for information about installing and removing the S7-200
SMART expansion cable.
S7-200 SMART
812 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.11 S7-200 SMART cables
A.11.2.1 Overview
RS-232/PPI Multi-Master Cable and USB/PPI Multi-Master Cable Specifications
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 813
Technical specifications
A.11 S7-200 SMART cables
Features
You can use the RS232/PPI Multi-Master cable with the S7-200 SMART CPUs in Freeport
mode. See the Freeport mode for more information.
The USB cable requires the STEP 7-Micro/WIN SMART V2.3 (or later) programming
software for operation.
Table A- 168 RS-232/PPI Multi-Master Cable - Pin-outs for RS-485 to RS-232 Local Mode Connector
S7-200 SMART
814 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.11 S7-200 SMART cables
Table A- 169 RS-232/PPI Multi-Master Cable - Pin-outs for RS-485 to RS-232 Remote Mode Con-
nector
Note
The CRxxs CPUs require the protocol select switch 7 to be set to 1 to allow Freeport mode.
Setting switch 7 to 0 disables Freeport mode in the CRxxs CPUs.
The SR and ST CPUs ignore the select switch 7 setting.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 815
Technical specifications
A.11 S7-200 SMART cables
Note
If you use this cable with S7-200 SMART CPU versions prior to V2.3, certain operations are
not possible (for example, downloading the user program).
Note
Attaching a USB-PPI cable to the CPU's RS485 port forces the CPU to exit Freeport mode
and enable PPI mode. This allows STEP 7-Micro/WIN SMART V2.3 to regain control of the
the CPU.
S7-200 SMART
816 System Manual, V2.4, 03/2019, A5E03822230-AG
Technical specifications
A.11 S7-200 SMART cables
Table A- 170 USB/PPI Multi-Master cable - Pin-outs for the RS-485 to USB Series "A" Connector
The following figure shows theUSB/PPI Multi-Master Cable dimensions and LEDs.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 817
Calculating a power budget B
B.1 Power budget
Your CPU has an internal power supply that provides power for the CPU, the expansion
modules, signal boards, and other 24 V DC user power requirements. Use the following
information as a guide for determining how much power (or current) the CPU can provide for
your configuration. The new compact CPUs (CRs) do not support expansion modules or
signal boards.
Refer to the technical specifications for your particular CPU to determine the 24 V DC sensor
supply power budget, the 5 V DC logic budget supplied by your CPU and the 5 V DC power
requirements of the expansion modules and signal boards. Refer to the Calculating a power
budget to determine how much power (or current) the CPU can provide for your
configuration.
The standard CPU provides the 5 V DC logic power needed for any expansion in your
system. Pay careful attention to your system configuration to ensure that the CPU can
supply the 5 V DC power required by your selected expansion modules. If your configuration
requires more power than the CPU can supply, you must remove a module.
Note
If the CPU power budget is exceeded, you may not be able to connect the maximum number
of modules allowed for your CPU.
The standard CPU also provides a 24 V DC sensor supply that can supply 24 V DC for input
points, for relay coil power on the expansion modules, or for other requirements. If your
power requirements exceed the budget of the sensor supply, then you must add an external
24 V DC power supply to your system. You must manually connect the 24 V DC supply to
the input points or relay coils.
S7-200 SMART
818 System Manual, V2.4, 03/2019, A5E03822230-AG
Calculating a power budget
B.1 Power budget
If you require an external 24 V DC power supply, ensure that the power supply is not
connected in parallel with the sensor supply of the CPU. For improved electrical noise
protection, it is recommended that the commons (M) of the different power supplies be
connected.
WARNING
Connecting power supplies safely
Connecting an external 24 V DC power supply in parallel with the 24 V DC sensor supply of
the CPU can result in a conflict between the two supplies as each seeks to establish its
own preferred output voltage level.
The result of this conflict can be shortened lifetime or immediate failure of one or both
power supplies, with consequent unpredictable operation of the PLC system. Unpredictable
operation could result in death or serious injury to personnel, and/or damage to equipment.
The DC sensor supply of the CPU and any external power supply should provide power to
different points. A single connection of the commons is allowed.
Some of the 24 V DC power input ports in the S7-200 SMART system are interconnected,
with a common logic circuit connecting multiple M terminals. For example, the following
circuits are interconnected when designated as "not isolated" in the data sheets: the 24 V
DC power supply of the CPU, the power input for the relay coil of an EM, or the power supply
for a non-isolated analog input. All non-isolated M terminals must connect to the same
external reference potential.
WARNING
Avoiding unwanted current flow
Connecting non-isolated M terminals to different reference potentials will cause unintended
current flows that may cause damage or unpredictable operation in the PLC and any
connected equipment.
Failure to comply with these guidelines could cause damage or unpredictable operation
which could result in death or severe personal injury and/or property damage.
Always ensure that all non-isolated M terminals in an S7-200 SMART system are
connected to the same reference potential.
Refer to the technical specifications for your particular CPU (Page 719) to determine the
24 V DC sensor supply power budget, the 5 V DC logic budget supplied by your CPU and
the 5 V DC power requirements of the expansion modules and signal boards.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 819
Calculating a power budget
B.2 Calculating a sample power requirement
Note
The CPU has already allocated the power required to drive the CPUs internal relay coils.
You do not need to include the internal relay coil power requirements in a power budget
calculation.
The CPU in this example provides sufficient 5 V DC current, but does not provide enough
24 V DC current from the sensor supply for all of the inputs and expansion relay coils. The
I/O requires 392 mA and the CPU provides 300 mA. This installation requires an additional
source of at least 92 mA of 24 V DC power to operate all the included 24 V DC inputs and
outputs.
S7-200 SMART
820 System Manual, V2.4, 03/2019, A5E03822230-AG
Calculating a power budget
B.3 Calculating your power requirement
Power budget 5 V DC 24 V DC
minus
System requirements 5 V DC 24 V DC
Total requirements
equals
Current balance 5 V DC 24 V DC
Current balance total
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 821
Error codes C
C.1 Timestamp mismatch
This warning message indicates that the timestamps for the project do not match the
timestamps for the program in the PLC. This may indicate that the programs are different, in
which case it would be dangerous to continue the current operation. However, the programs
might be functionally identical and still have different timestamps.
S7-200 SMART
822 System Manual, V2.4, 03/2019, A5E03822230-AG
Error codes
C.2 PLC non-fatal error codes
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 823
Error codes
C.2 PLC non-fatal error codes
S7-200 SMART
824 System Manual, V2.4, 03/2019, A5E03822230-AG
Error codes
C.3 PLC non-fatal error SM flags
See also
Special memory (SM) and system symbol names (Page 828)
Overview
Non-fatal errors are those that may degrade some aspect of PLC performance, but do not
render the PLC incapable of executing the user program and updating I/O. To help you in
debugging your program, information associated with error conditions is stored in Special
Memory (SM) locations (Page 828), which can be accessed by the user program. For
example, if you do not want to continue in RUN mode with certain non-fatal error conditions,
you can have the user program force a transition to STOP mode when the undesirable
condition occurs.
The following table lists and describes the Special Memory non-fatal error information.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 825
Error codes
C.4 PLC fatal error codes
Overview
Fatal errors cause the PLC to stop the execution of your program. Depending on the severity
of the error, a fatal error can render the PLC incapable of performing any or all functions.
The objective for handling fatal errors is to bring the PLC to a safe state from which the PLC
can respond to interrogations about the existing error conditions.
The PLC performs the following tasks when a fatal error is detected.
● Changes to STOP mode
● Turns on both the System Fault LED and the STOP LED
● Turns off the outputs
The PLC remains in this condition until the fatal error is corrected. The table shown below
provides a list with descriptions for the fatal error codes that can be read from the PLC.
STEP 7-Micro/WIN SMART displays the error codes generated by the PLC, along with a
brief description, in the PLC Information dialog. To access PLC information, click the PLC
button from the Information area of the PLC menu ribbon strip.
Once you have corrected the conditions that caused the fatal error, power-cycle the PLC or
perform a warm restart from STEP 7-Micro/WIN SMART. To perform a warm start, click the
Warm Start button in the Modify area of the PLC menu ribbon strip.
Restarting the PLC clears the fatal error condition and causes power-up diagnostic testing. If
another fatal error condition occurs, the PLC sets the System Fault LED again; otherwise,
the PLC begins normal operation.
There are several possible error conditions that can render the PLC incapable of
communication, in which case you cannot view the PLC error code. This type of error
indicates a hardware failure requiring the PLC module to be repaired; it cannot be fixed by
changes to the program or by clearing the PLC memory.
S7-200 SMART
826 System Manual, V2.4, 03/2019, A5E03822230-AG
Error codes
C.4 PLC fatal error codes
Hexadecimal Description
error code
0000 No fatal errors present
0001 System firmware checksum error
0002 Compiled user program checksum error
0004 Permanent memory failed
0005 Permanent memory error on user program
0006 Permanent memory error on system block
0007 Permanent memory error on force data
0009 Permanent memory error on user data, DB1
000A Memory card failed
000B Memory card error on user program
000C Memory card error on system block
000D Memory card error on force data
000F Memory card error on user data, DB1
0010 Internal firmware error
0015 User program has compile error on power-up
0016 User data has compile error on power-up
0017 System block has compile error on power-up
0018 CPU HW identification data not available or corrupted
0019 HW watchdog timeout error
0x0020 PN SDB checksum error in internal flash
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 827
Special memory (SM) and system symbol names D
D.1 SM (Special Memory) overview
The S7-200 SMART CPU provides special memory that contains system data. SMW is the
prefix that indicates a special memory word. SMB is the prefix that indicates a special
memory byte. You address individual bits as SM<byte number>.<bit number>. The System
Symbol table in STEP 7-Micro/WIN SMART displays the special memory.
SMB0 to SMB29, SMB480 to SMB515, SMB1000 to SMB1699, and SMB1800 to SMB1999 (S7-200
SMART read-only special memory)
The S7-200 SMART CPU writes new changes to the system data stored
in special memory.
S7-200 SMART
828 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.1 SM (Special Memory) overview
Note
If your program used the range SMB1800 to SMB1999 and created in
STEP 7-Micro/WIN SMART V2.3 or previous versions, the program will be cleared in V2.4,
then you must reedit your program to use the other read/write SM addresses.
SMB30 to SMB194 and SMB566 to SMB749 (S7-200 SMART read/write special memory)
● SMB30 (Port 0) and SMB130 (Port 1) (Page 836) Port configuration for the integrated
RS485 port (Port 0) and the CM01 Signal Board (SB) RS232/RS485 port (Port 1)
● SMB34-SMB35 (Page 837) Time intervals for timed interrupts
● SMB36-45 (HSC0), SMB46-55 (HSC1), SMB56-65 (HSC2), SMB136-145 (HSC3),
SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5) (Page 838) High-speed counter
configuration and operation
● SMB66-SMB85 (Page 843) PLS0 and PLS1 high-speed outputs
● SMB86-SMB94 and SMB186-SMB194 (Page 846) Receive message control
● SMW98 (Page 848) I/O expansion bus communication errors
● SMW100-SMW114 (Page 849) System alarms
● SMB130 (Page 836) Port configuration for the CM01 Signal Board (SB) RS232/RS485
port (Port 1) (See SMB30)
● SMB146-SMB155 (HSC4) and SMB156-SMB165 (HSC5) (Page 850) High-speed counter
configuration and operation (See SMB36)
● SMB166-SMB169 (Page 843) PTO0 profile definition table
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 829
Special memory (SM) and system symbol names
D.2 SMB0: System status
WARNING
Risks with STEP 7-Micro/WIN Version 4.0 or greater (.mwp files) with absolute special
memory (SM) addressing
You can open a program (.mwp file) from an earlier version of STEP 7-Micro/WIN in STEP
7-Micro/WIN SMART. If that program uses symbolic special memory (SM) addressing, then
insert the System Symbol table (Page 106) in your project. The symbols map correctly to
the current SM addresses. If, however, the program uses absolute SM addressing, those
absolute SM addresses might no longer exist.
Programs based on inconsistent definitions of SM addresses can result in unexpected
machine or process operation. Unexpected machine or process operation can cause death
or serious injury to personnel, and/or damage to equipment.
If you open an .mwp file in STEP 7-Micro/WIN SMART, delete the "S7-200 Symbols" table
and insert the "System Symbols" table. The symbols in the former .mwp program map to
the current SM address scheme. Convert any absolute SM addresses to use the
corresponding symbol name.
S7-200 SMART
830 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.3 SMB1: Instruction execution status
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 831
Special memory (SM) and system symbol names
D.4 SMB2: Freeport receive character
Note
Port 0 and Port 1 share SMB2 and SMB3
When the CPU receives a character on Port 0, note the following:
• The CPU executes the interrupt routine attached to that event (interrupt event 8).
• SMB2 contains the character received on Port 0.
• SMB3 contains the parity status of the received character.
Likewise, when the CPU receives a character on Port 1, note the following:
• The CPU executes the interrupt routine attached to that event (interrupt event 25).
• SMB2 contains the character received on Port 1.
• SMB3 contains the parity status of the received character.
S7-200 SMART
832 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.5 SMB3: Freeport character error
** Use status bits SM4.0, SM4.1, and SM4.2 only inside an interrupt routine. The CPU resets these status bits when the
CPU empties the interrupt queue and returns control to the main program.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 833
Special memory (SM) and system symbol names
D.7 SMB5: I/O error status
D.8 SMB6-SMB7: CPU ID, error status, and digital I/O points
Special memory bytes 6 and 7 provide CPU information.
S7-200 SM address Read-only SMB6 and SMB7 (CPU ID, error status, and digital I/O point)
SMART
symbol
name
CPU_ID SMB6 MSB LSB
7 0
1 x x x c d 0 0
SM6.4 to 0 0 0 = CPU CR20s
SM6.6 0 0 1 = CPU CR40s
0 1 0 = CPU CR60s
0 1 1 = CPU SR20 / ST20
1 0 0 = CPU SR40 / ST40
1 0 1 = CPU SR60 / ST60
1 1 0 = CPU CR30s
1 1 1 = CPU SR30 / ST30
SM6.2 to c Configuration / parameterization
SM6.3 error
0 = no error, 1 = error
d Diagnostic alarm (See SMW100 for
alarm codes)
0 = no error, 1 = error
CPU_IO SMB7 MSB LSB
7 0
i i i i q q q q
SM7.0 to i i i i 0 to 15 bytes of digital input points
SM7.7 q q q q 0 to 15 bytes of digital output points
S7-200 SMART
834 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.9 SMB8-SMB19: I/O module ID and errors
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 835
Special memory (SM) and system symbol names
D.10 SMW22-SMW26: Scan times
S7-200 SMART
836 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.13 SMB34-SMB35: Time intervals for timed interrupts
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 837
Special memory (SM) and system symbol names
D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3),
SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5): high-speed counters
S7-200 SMART
838 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3), SMB146-SMB1
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 839
Special memory (SM) and system symbol names
D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3),
SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5): high-speed counters
S7-200 SMART
840 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3), SMB146-SMB1
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 841
Special memory (SM) and system symbol names
D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3),
SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5): high-speed counters
S7-200 SMART
842 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.15 SMB66-SMB85 (PTO0/PWM0, PTO1/PWM1), SMB166-SMB169 (PTO0), SMB176-SMB179 (PTO1), and SMB566-S
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 843
Special memory (SM) and system symbol names
D.15 SMB66-SMB85 (PTO0/PWM0, PTO1/PWM1), SMB166-SMB169 (PTO0), SMB176-SMB179 (PTO1), and
SMB566-SMB579 (PTO2/PWM2): high-speed outputs
S7-200 SMART
844 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.15 SMB66-SMB85 (PTO0/PWM0, PTO1/PWM1), SMB166-SMB169 (PTO0), SMB176-SMB179 (PTO1), and SMB566-S
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 845
Special memory (SM) and system symbol names
D.16 SMB86-SMB94 and SMB186-SMB194: Receive message control
S7-200 SMART
846 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.16 SMB86-SMB94 and SMB186-SMB194: Receive message control
You use the bits of the message control byte define the criteria for identifying the message.
The message control byte also includes the start of message and end of message criteria.
To determine the start of a message, either of two sets of logically ANDed start-of-message
criteria must be true and must occur in sequence. "In sequence" means one of the following:
● Start character follows idle line
● Start character follows break
A logical OR of the end-of-message criteria determines the end of a message. The
equations for start and end criteria are as follows:
Start of message = (il AND sc) OR (bk AND sc)
End of message = ec OR tmr OR maximum character count reached
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 847
Special memory (SM) and system symbol names
D.17 SMW98: Expansion I/O bus communication errors
S7-200 SMART
848 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.18 SMW100-SMW114 System alarms
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 849
Special memory (SM) and system symbol names
D.19 SMB130: Freeport control for port 1 (See SMB30)
S7-200 SMART
850 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.23 SMB600-SMB749: Axis (0, 1, and 2) open loop motion control
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 851
Special memory (SM) and system symbol names
D.24 SMB650-SMB699: Axis 1 open loop motion control (See SMB600-SMB740)
SM address Description
SMW1000 CPU vendor ID: (always 0x002A)
SMB1002 to SMB1021 CPU order ID (MLFB): ASCII characters, left-justified in field, padded with spaces
SMB1022 to SMB1037 CPU serial number: ASCII characters, left-justified in field, padded with spaces
SMW1038 CPU hardware version: Represents the hardware E-stand; range = 0x0001 to 0xFFFD
0x0000, 0xFFFE, and 0xFFFF are reserved values.
S7-200 SMART
852 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.27 SMB1050-SMB1099: SB (signal board) hardware/firmware ID
SM address Description
SMD1040 CPU firmware version:
• Byte 0: ASCII ‘V’
• Byte 1: Functional version
• Byte 2: Minor change version
• Byte 3: Bug fix version
SMW1044 CPU firmware version counter (range 0x0000 to 0x00FF)
SMW1046 Reserved: Always 0x0000
SMW1048 CPU device type: Always 0x0001
SM address Description
SMW1050 Signal board vendor ID: 0x002A if a Siemens SB is present; 0x0000 if no SB is present
SMB1052 to SMB1071 Signal board order ID (MLFB): ASCII characters, left-justified in field, padded with spaces
SMB1072 to SMB1087 Signal board serial number: ASCII characters, left-justified in field, padded with spaces
SMW1088 Signal board hardware version: Represents the hardware E-stand; range=0x0001 to 0xFFFD
0x0000, 0xFFFE, and 0xFFFF are reserved values.
SMD1090 Signal board firmware version:
• Byte 0: ASCII ‘V’
• Byte 1: Functional version
• Byte 2: Minor change version
• Byte 3: Bug fix version
SMW1094 Signal board firmware version counter (range 0x0000 to 0x00FF)
SMW1096 Reserved, always 0x0000
SMW1098 Signal board device type: I/O=0x0003, communications=0x0004, all other values reserved
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 853
Special memory (SM) and system symbol names
D.28 SMB1100-SMB1399: EM (expansion module) hardware/firmware ID
S7-200 SMART
854 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.28 SMB1100-SMB1399: EM (expansion module) hardware/firmware ID
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 855
Special memory (SM) and system symbol names
D.29 SMB1400-SMB1699: EM (expansion module) module-specific data
SM addresses Description
SMB1400 to SMB1449 EM bus Slot 0: Module specific information
SMB1450 to SMB1499 EM bus Slot 1: Module specific information
SMB1500 to SMB1549 EM bus Slot 2: Module specific information
SMB1550 to SMB1599 EM bus Slot 3: Module specific information
SMB1600 to SMB1649 EM bus Slot 4: Module specific information
SMB1650 to SMB1699 EM bus Slot 5: Module specific information
SM address Description
SMB1800 to SMB1807 Every byte shows the status of each PROFINET device.
• 00H: Not available.
• 80H: OK.
• 81H: Diagnosis. (The device is disconnected.)
• 82H: Error. (The device is connected, but some of the modules have alarms.)
SMB1808 to SMB1871 It shows the alarm status of each module. SMB1808~SMB1815 has 64 bits, which shows the
alarm status of the device #1 (Device Number =1). 0 is "OK", 1 is "Error".
For example, SM1808.0 indicate the first module status of the first device. SM1816.0 indicate
the first module status of the second device.
S7-200 SMART
856 System Manual, V2.4, 03/2019, A5E03822230-AG
Special memory (SM) and system symbol names
D.30 SMB1800-SMB1999: PROFINET device status
SM address Description
SMB1872 to SMB1935 It shows the IO data status as PNIO technical specification indicates in each module.
SMB1872~SMB1879 has 64 bits, which shows the alarm status of IO data in the device #1
(Device Number =1). 0 is "OK", 1 is "Error".
For example, SM1872.0 indicate the first module IO data status of the first device. SM1880.2
indicate the 3rd module IO data status of the second device.
SMB1936 to SMB1999 Reserved
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 857
References E
E.1 Often-used special memory bits
The complete list of pre-defined special memory program symbols is available to your
project, in the System Symbol table.
S7-200 SMART
858 System Manual, V2.4, 03/2019, A5E03822230-AG
References
E.2 Interrupt events in priority order
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 859
References
E.3 High-speed counter summary
Clock A Direction Reset Single phase / Dual phase maximum AB quadrature phase maximum
/ Clock B clock / input rate clock / input rate
HSC0 I0.0 I0.1 I0.4 S model CPUs:1 S model CPUs:
• 200 kHz • 100 kHz = Maximum 1x count rate
• 400 kHz = Maximum 4x count rate
C model CPUs:2 C model CPUs:
• 100 kHz • 50 kHz = Maximum 1x count rate
• 200 kHz = Maximum 4x count rate
HSC1 I0.1 S model CPUs:
• 200 kHz
C model CPUs:
• 100 kHz
HSC2 I0.2 I0.3 I0.5 S model CPUs: S model CPUs:
• 200 kHz • 100 kHz = Maximum 1x count rate
• 400 kHz = Maximum 4x count rate
C model CPUs: C model CPUs:
• 100 kHz • 50 kHz = Maximum 1x count rate
• 200 kHz = Maximum 4x count rate
HSC3 I0.3 S model CPUs:
• 200 kHz
C model CPUs:
• 100 kHz
HSC4 I0.6 I0.7 I1.2 SR30 and ST30 model CPUs: SR30 and ST30 model CPUs:
• 200 kHz • 100 kHz = Maximum 1x count rate
• 400 kHz = Maximum 4x count rate
SR20, ST20, SR40, ST40, SR60, SR20, ST20, SR40, ST40, SR60, and
and ST60 model CPUs: ST60 model CPUs:
• 30 kHz • 20 kHz = Maximum 1x count rate
• 80 kHz = Maximum 4x count rate
C model CPUs: C model CPUs:
• n/a • n/a
S7-200 SMART
860 System Manual, V2.4, 03/2019, A5E03822230-AG
References
E.4 STL instructions
Clock A Direction Reset Single phase / Dual phase maximum AB quadrature phase maximum
/ Clock B clock / input rate clock / input rate
HSC5 I1.0 I1.1 I1.3 S model CPUs: S model CPUs
• 30 kHz • 20 kHz = Maximum 1x count rate
• 80 kHz = Maximum 4x count rate
1 S model CPUs: SR20, ST20, SR30, ST30, SR40, ST40, SR60, and ST60
2 C model CPUs: CR20s, CR30s, CR40s, and CR60s
Instructions
The STL instruction names and descriptions are shown in the tables below. See the chapter
on program instructions (Page 160) for the LAD and FBD instructions.
Boolean instructions
STL Description
LD bit Load
LDI bit Load Immediate
LDN bit Load Not
LDNI bit Load Not Immediate
A bit AND
AI bit AND Immediate
AN bit AND Not
ANI bit AND Not Immediate
O bit OR
OI bit OR Immediate
ON bit OR Not
ONI bit OR Not Immediate
LDBx IN1, IN2 Load result of Byte Compare
IN1 (x:<, <=,=, >=, >, <>I) IN2
ABx IN1, IN2 AND result of Byte Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
OBx IN1, IN2 OR result of Byte Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
LDWx IN1, IN2 Load result of Word Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
AWx IN1, IN2 AND result of Word Compare
IN1 (x:<, <=,=, >=, >, <>)I N2
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 861
References
E.4 STL instructions
Boolean instructions
STL Description
OWxIN1, IN2 OR result of Word Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
LDDx IN1, IN2 Load result of DWord Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
ADx IN1, IN2 AND result of DWord Compare
IN1 (x:<, <=,=, >=, >, <>)IN2
ODx IN1, IN2 OR result of DWord Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
LDRx IN1, IN2 Load result of Real Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
ARx IN1, IN2 AND result of Real Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
ORx IN1, IN2 OR result of Real Compare
IN1 (x:<, <=,=, >=, >, <>) IN2
NOT Stack Negation
EU Detection of Rising Edge
ED Detection of Falling Edge
= bit Assign Value
=I bit Assign Value Immediate
S bit, N Set bit Range
R bit, N Reset bit Range
SI bit, N Set bit Range Immediate
RI bit, N Reset bit Range Immediate
Not available in STL SR (Set dominate bistable)
RS (Reset dominate bistable)
LDSx IN1, IN2 Load result of String Compare
IN1 (x: =, <>) IN2
ASx IN1, IN2 AND result of String Compare
IN1 (x: =, <>) IN2
OSx IN1, IN2 OR result of String Compare
IN1 (x: =, <>) IN2
ALD AND Load
OLD OR Load
LPS Logic Push (stack control)
LRD Logic Read (stack control)
LPP Logic Pop (stack control)
LDS n Load Stack (stack control), n= 0 to 8
AENO AND ENO
S7-200 SMART
862 System Manual, V2.4, 03/2019, A5E03822230-AG
References
E.4 STL instructions
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 863
References
E.4 STL instructions
High-speed instructions
STL Description
HDEF HSC, MODE Define High-Speed Counter mode
HSC n Activate High-Speed Counter
PLS n Pulse Output:
S7-200 SMART
864 System Manual, V2.4, 03/2019, A5E03822230-AG
References
E.4 STL instructions
Logical instructions
STL Description
ANDB IN1, OUT Logical AND of Byte, Word, and DWord
ANDW IN1, OUT
ANDD IN1, OUT
ORB IN1, OUT Logical OR of Byte, Word, and DWord
ORW IN1, OUT
ORD IN1, OUT
XORB IN1, OUT Logical XOR of Byte, Word, and DWord
XORW IN1, OUT
XORD IN1, OUT
INVB OUT Invert Byte, Word and DWord
INVW OUT (1's complement)
INVD OUT
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 865
References
E.4 STL instructions
String instructions
STL Description
SLEN IN, OUT String Length
SCAT N, OUT Concatenate String
SCPY IN, OUT Copy String
SSCPY IN, INDX, N, OUT Copy Substring from String
CFND IN1, IN2, OUT Find First Character within String
SFND IN1, IN2, OUT Find String within String
S7-200 SMART
866 System Manual, V2.4, 03/2019, A5E03822230-AG
References
E.5 Memory ranges and features
Interrupt instructions
STL Description
CRETI Conditional Return from Interrupt
ENI Enable Interrupts
DISI Disable Interrupts
ATCH INT, EVNT Attach Interrupt routine to event
DTCH EVNT Detach event
CEVENT EVNT Clear all interrupt events of type EVNT
Communications instructions
STL LAD/FBD
GET Reads remote station data
PUT Writes data to a remote station
XMT TBL, PORT Freeport transmission
RCV TBL, PORT Freeport receive message
GIP ADDR, MASK, GATE Get CPU address, subnet mask, and gateway
SIP ADDR, MASK, GATE Set CPU address, subnet mask, and gateway
GPA ADDR, PORT Get Port Address
SPA ADDR, PORT Set Port Address
Note
The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no
Ethernet port and do not support any functions related to the use of Ethernet
communications.
Description CPU CR20s, CPU SR20, CPU SR30, CPU SR40, CPU SR60,
CPU CR30s, CPU ST20 CPU ST30 CPU ST40 CPU ST60
CPU CR40s,
CPU CR40,
CPU CR60s,
CPU CR60
User program size 12 KB 12 KB 18 KB 24 KB 30 KB
User data size 8 KB 8 KB 12 KB 16 KB 20 KB
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 867
References
E.5 Memory ranges and features
Description CPU CR20s, CPU SR20, CPU SR30, CPU SR40, CPU SR60,
CPU CR30s, CPU ST20 CPU ST30 CPU ST40 CPU ST60
CPU CR40s,
CPU CR40,
CPU CR60s,
CPU CR60
Process image input register I0.0 to I31.7 I0.0 to I31.7 I0.0 to I31.7 I0.0 to I31.7 I0.0 to I31.7
Process image output register Q0.0 to Q31.7 Q0.0 to Q31.7 Q0.0 to Q31.7 Q0.0 to Q31.7 Q0.0 to Q31.7
Analog inputs (read only) -- AIW0 to AIW0 to AIW0 to AIW110 AIW0 to AIW110
AIW110 AIW110
Analog outputs (write only) -- AQW0 to AQW0 to AQW0 to AQW0 to
AQW110 AQW110 AQW110 AQW110
Variable memory (V) VB0 to VB8191 VB0 to VB0 to VB0 to VB16383 VB0 to VB20479
VB8191 VB12287
Local memory (L)1 LB0 to LB63 LB0 to LB63 LB0 to LB63 LB0 to LB63 LB0 to LB63
Bit memory (M) M0.0 to M31.7 M0.0 to M31.7 M0 to M31.7 M0.0 to M31.7 M0.0 to M31.7
Special Memory Total SM0.0 to SM0.0 to SM0.0 to SM0.0 to SM0.0 to
(SM) SM2047.7 SM2047.7 SM2047.7 SM2047.7 SM2047.7
Read SM0.0 to SM0.0 to SM0.0 to SM0.0 to SM0.0 to
only SM29.7 SM29.7 SM29.7 SM29.7 SM29.7
SMB480.0 to SMB480.0 to SMB480.0 to SMB480.0 to SMB480.0 to
SM515.7 SM515.7 SM515.7 SM515.7 SM515.7
SM1000.0 to SM1000.0 to SM1000.0 to SM1000.0 to SM1000.0 to
SM1699.7 SM1699.7 SM1699.7 SM1699.7 SM1699.7
Timers 256 (T0 to 256 (T0 to 256 (T0 to 256 (T0 to T255) 256 (T0 to
T255) T255) T255) T255)
Retentive on-delay 1 ms T0, T64 T0, T64 T0, T64 T0, T64 T0, T64
10 ms T1 to T4, and T1 to T4, and T1 to T4, and T1 to T4, and T1 to T4, and
T65 to T68 T65 to T68 T65 to T68 T65 to T68 T65 to T68
100 ms T5 to T31, and T5 to T31, and T5 to T31, and T5 to T31, and T5 to T31, and
T69 to T95 T69 to T95 T69 to T95 T69 to T95 T69 to T95
On/Off delay 1 ms T32, T96 T32, T96 T32, T96 T32, T96 T32, T96
10 ms T33 to T36, T33 to T36, T33 to T36, T33 to T36, and T33 to T36, and
and and and T97 to T97 to T100 T97 to T100
T97 to T100 T97 to T100 T100
100 ms T37 to T63, T37 to T63, T37 to T63, T37 to T63, and T37 to T63, and
and and and T101 to T101 to T255 T101 to T255
T101 to T255 T101 to T255 T255
Counters 256 (C0 to 256 (C0 to 256 (C0 to 256 (C0 to 256 (C0 to
C255) C255) C255) C255) C255)
High-speed counters HC0 to HC3 HC0 to HC5 HC0 to HC5 HC0 to HC5 HC0 to HC5
Sequential control relays (S) S0.0 to S31.7 S0.0 to S31.7 S0.0 to S31.7 S0.0 to S31.7 S0.0 to S31.7
Accumulator registers AC0 to AC3 AC0 to AC3 AC0 to AC3 AC0 to AC3 AC0 to AC3
Jumps/Labels 0 to 255 0 to 255 0 to 255 0 to 255 0 to 255
Call/Subroutine 0 to 127 0 to 127 0 to 127 0 to 127 0 to 127
Interrupt routines 0 to 127 0 to 127 0 to 127 0 to 127 0 to 127
Positive/negative transitions 1024 1024 1024 1024 1024
S7-200 SMART
868 System Manual, V2.4, 03/2019, A5E03822230-AG
References
E.5 Memory ranges and features
Description CPU CR20s, CPU SR20, CPU SR30, CPU SR40, CPU SR60,
CPU CR30s, CPU ST20 CPU ST30 CPU ST40 CPU ST60
CPU CR40s,
CPU CR40,
CPU CR60s,
CPU CR60
PID control loops 0 to 7 0 to 7 0 to 7 0 to 7 0 to 7
Ports Integrated Ethernet pro- Ethernet pro- Ethernet pro- Ethernet pro-
RS485 port gramming gramming gramming port, gramming port,
(Port 0) 2 port, Integrat- port, Integrat- Integrated Integrated
ed RS485 port ed RS485 port RS485 port RS485 port
(Port 0), (Port 0), (Port 0), (Port 0),
CM01 Signal CM01 Signal CM01 Signal CM01 Signal
Board (SB) Board (SB) Board (SB) Board (SB)
RS232/RS485 RS232/RS485 RS232/RS485 RS232/RS485
port (Port 1) port (Port 1) port (Port 1) port (Port 1)
1 LB60 to LB63 are reserved by STEP 7-Micro/WIN SMART when programming in LAD or FBD.
2 The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s have no Ethernet port. These CPUs do not
support any functions related to the use of Ethernet communications.
The S7-200 SMART CPU firmware release V2.4 supports the PROFINET communication on
the following eight CPU models. For the detailed parameters and PROFINET process image
information, refer to the following table.
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 869
References
E.5 Memory ranges and features
S7-200 SMART
870 System Manual, V2.4, 03/2019, A5E03822230-AG
Ordering information F
F.1 CPU modules
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 871
Ordering information
F.3 Programming software
F.4 Communication
S7-200 SMART
872 System Manual, V2.4, 03/2019, A5E03822230-AG
Ordering information
F.5 Spare parts and other hardware
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 873
Ordering information
F.5 Spare parts and other hardware
S7-200 SMART
874 System Manual, V2.4, 03/2019, A5E03822230-AG
Ordering information
F.6 Human Machine Interface devices
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 875
Index
* >
*D (STL-Multiply double integer), 279 >=B, 216
*I (STL-Multiply integer), 279 >=R, 216
*R (STL-Multiply real), 279 >=W, 216
>B, 216
>R, 216
. >W, 216
.mwp files, 97
.smart files, 97
A
A (STL-AND), 160
/ AB< (STL-AND compare byte less than), 216
AB<= (STL-AND compare byte less than or equal), 216
/D (STL-Divide double integer), 279
AB<> (STL-AND compare byte not equal), 216
/I (STL-Divide integer), 279
AB= (STL-AND compare byte equal), 216
/R (STL-Divide real), 279
AB> (STL-AND compare byte greater than), 216
AB>= (STL-AND compare byte greater than or
equal), 216
+
Absolute positioning mode, 570
+D (STL-Add double integer), 279 AC
+I (STL-Add integer), 279 isolation guidelines, 55
+R (STL-Add real), 279 wiring guidelines, 56
AC inductive loads, 58
Access rights
< CPU security, 135
password privilege levels, 135
<=B, 216
Active/Passive communication partners, 379
<=R, 216
AD< (STL-AND compare double word less than), 216
<=W, 216
AD<= (STL-AND compare double word less than or
<>B, 216
equal), 216
<>R, 216
AD<> (STL-AND compare double word not equal), 216
<>S, 220
AD= (STL-AND compare double word equal), 216
<>W, 216
AD> (STL-AND compare double word greater
<B, 216
than), 216
<R, 216
AD>= (STL-AND compare double word greater than or
<W, 216
equal), 216
ADD_DI, 279
ADD_I, 279
=
ADD_R, 279
= (STL-output), 169 Addressing
==B, 216 accumulators, 69
==R, 216 analog inputs, 71
==S, 220 analog outputs, 72
==W, 216 counter memory, 68
=I (STL-output immediate), 169 creating pointers and using indirect address, 74
S7-200 SMART
876 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
example of pointer offset to access data, 78 ASCII array conversion instructions, 225
example of pointer to access data in a table, 77 Assigning
flag memory, 67 global symbols, 107
high-speed counters, 68 local variables, 112
local and expansion I/O, 74 variables (local), 110
local memory, 70 ATCH, 302
memory areas, 66 ATH, 225
process image output register, 66 ATT, 345
sequence control relay (SCR) memory, 72 Auto-tuning PID, 624
special memory (SM) bits, 70 AW< (STL-AND compare word less than), 216
symbol table, 107 AW<= (STL-AND compare word less than or
timer memory, 67 equal), 216
variable memory, 67 AW<> (STL-AND compare word not equal), 216
AENO (STL stack-AND ENO bit) AW= (STL-AND compare word equal), 216
instruction, 165 AW> (STL-AND compare word greater than), 216
logic stack overview, 164 AW>= (STL-AND compare word greater than or
AI (STL-AND immediate), 162 equal), 216
Air flow, 43 Axis 0 motion control (SMB600-SMB649), 851
Alarms Axis of Motion
analog input configuration, 142 ACCEL_TIME, 640
from system (SMW100-SMW114), 849 AXISx_ABSPOS, 672
ALD (STL stack-AND Load), 165 AXISx_CACHE, 670
AN (STL-AND NOT), 160 AXISx_CFG, 669
Analog I/O AXISx_CTRL, 660
input representation (current), 786 AXISx_DIS, 669
input representation (voltage), 786 AXISx_GOTO, 663
output representation (current), 787 AXISx_LDOFF, 666
output representation (voltage), 787 AXISx_LDPOS, 667
status indicators, 91 AXISx_MAN, 661
step response times (SM), 785 AXISx_RDPOS, 671
Analog inputs AXISx_RSEEK, 665
analog type configuration, 140 AXISx_RUN, 664
rejection, 140 AXISx_SRATE, 668
smoothing, 140 configuring, 646
system block configuration, 140 configuring reference point and seek
Analog outputs parameters, 655
analog type configuration, 143 configuring the Backlash compensation, 654
states at RUN/ STOP transition, 143 configuring the input pin locations, 647
ANDB (STL-AND byte), 315 defining the motion profile, 657
ANDD (STL-AND dword), 315 displaying and controlling the operation of axes, 687
ANDW (STL-AND word), 315 displaying and modifying the configuration of
ANI (STL-AND NOT immediate), 162 axes, 693
AR< (STL-AND compare real less than), 216 displaying the profile configuration for the axes, 693
AR<= (STL-AND compare real less than or equal), 216 eliminating backlash, 713
AR<> (STL-AND compare real not equal), 216 entering acceleration time, 653
AR= (STL-AND compare real equal), 216 entering jerk time, 654
AR> (STL-AND compare real greater than), 216 entering jog parameters, 653
AR>= (STL-AND compare real greater than or entering maximum start and stop speed, 652
equal), 216 error codes, 694
Article numbers, 871, 871, 872, 875 mapping the I/O, 648
AS<> (STL-AND string compare not equal), 220 Motion control panel, 687
AS= (STL-AND string compare equal), 220 phasing, 650
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 877
Index
S7-200 SMART
878 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 879
Index
S7-200 SMART
880 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 881
Index
S7-200 SMART
882 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 883
Index
S7-200 SMART
884 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
LDW<= (STL-Load compare word less than or MBUS_CTRL (initialize Modbus master
equal), 216 communication), 463
LDW<> (STL-Load compare word not equal), 216 MBUS_INIT (initialize slave communication), 471
LDW= (STL-Load compare word equal), 216 MBUS_MSG / MB_MSG2 (send message from
LDW> (STL-Load compare word greater than), 216 Modbus master), 465
LDW>= (STL-Load compare word greater than or MBUS_SERVER, 484
equal), 216 MBUS_SLAVE (slave response to master
LED indicators message), 472
CPU status, 90 Memory, 825
Library addresses for non-fatal error indicators, 825
creating, 609 clearing PLC, 155
types, 454 retentive range configuration, 134
LIFO, 346 Memory card
LN (natural logarithm), 285 program transfer card, 86, 87
Local and expansion I/O addressing, 74 reset to factory defaults, 157
Local variables, 110 types of, 82
Local/Partner connection, 379 using, 83
Logic stack Modbus general
STL inputs, 164 addressing, 457
STL stack operations, 165 advanced user information, 476, 491
Logic, control, 61 initialization and execution time for Modbus
Logical operation instructions protocol, 461
AND, OR, XOR (byte, word, and dword), 315 library features, 459
invert, 314 requirements for using Modbus instructions, 460
Loop control (PID) Modbus library overview, 454
adjusting bias, 300 Modbus RTU master
converting inputs, 298 example program, 474
converting outputs, 299 execution error codes, 468
error conditions, 301 MBUS_CTRL (initialize master communication), 463
forward/reverse, 299 MBUS_MSG / MB_MSG2 (send message from
loop definition table, 625 master), 465
modes, 300 using the instructions, 462
Loop table, 301 Modbus RTU slave
Lost password, 156 execution error codes, 473
LPP (STL stack-Logic Pop), 165 MBUS_INIT (initialize slave communication), 471
LPS (STL stack-Logic Push), 165 MBUS_SLAVE (slave response to master
LRD (STL stack-Logic Read), 165 message), 472
LSCR (STL-Load SCR), 324 using the instructions, 469
Modbus TCP
general exception codes, 494
M MODBUS TCP
MBUS_CLIENT, 480
MAC address, 391
MBUS_SERVER, 484
Main entry, 765
Modules
Main program, 94
CPU CR20s, 719
Math instructions
CPU CR30s, 730
add, subtract, multiply and divide, 279
CPU CR40, 740
divide integer with remainder, 283
CPU CR40s, 740
increment and decrement, 287
CPU CR60, 752
multiply integers to double integer and divide
CPU CR60s, 752
integer with remainder, 283
CPU SR20, 719
numeric functions, 285
CPU SR30, 730
MBUS_CLIENT, 480
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 885
Index
S7-200 SMART
886 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 887
Index
P PPI communication
changing to Freeport mode, 190
Password
multi-master and multi-slave PPI networks, 437
lost or forgotten, 156
port configuration in system block, 128
privilege levels, 135
single-master networks, 436
Password protection, 135
Previous STEP 7-Micro/WIN projects, 97
PID auto-tune
PROFIBUS
auto-deviation, 629
DP device, 411
auto-hysteresis, 629
S7-200 SMART EM DP01 PROFIBUS DP
exception conditions, 631
module, 411
prerequisites, 628
Profile table values
PV out-of-range, 632
PTO generators, 276
sequence, 629
PROFINET
PID loop control
device naming and addressing, 401
loop definition table, 625
Program block, 94
PID Tune control panel, 632
Program control instructions
PID loop instruction
END, STOP, and WDR, 332
alarm checking, 301
FOR-NEXT loop, 321
loop control types, 297
GET_ERROR, 333
understanding, 295
JMP-LBL, 322
PID Tune control panel, 632
SCR (Sequence control relay), 324
Pin assignments for network connector, 445
Program editor
Pipelining
bookmarks, 611
PTO pulses, 271
debugging and monitoring, 613
PLC
STL status options, 616
clearing memory, 155
types, 101
compile and run-time errors, 823
using, 36
expansion cable, 53
Program instructions
fatal errors, 826
bit
information (hardware/firmware, error status,
logic, 160, 162, 164, 165, 167, 168, 169, 170, 171,
run/stop event log), 115
172, 173, 174
installation, 46
clock, 175, 177
installation on a panel, 47
compare, 216, 220
memory card, 86
convert, 222, 225, 231, 235, 238
non-fatal error memory locations, 825
counters, 240, 243, 249, 260
system block, 126
interrupts, 302
PLC menu
logical operations, 314, 315
Download, 78
math, 279, 283, 285, 287
Upload, 81
move, 317, 318, 319, 320
PLS
program control, 321, 322, 324, 332, 333
instruction, 268
shift and rotate, 334, 337
Special Memory to monitor and control PTO and
string, 341, 342
PWM outputs, 843
subroutine, 363, 364
Pointer
table, 345, 346, 348
creating pointers and using indirect address, 74
table find, 349
example of pointer offset to access data, 78
timer, 353, 362
example of pointer to access data in a table, 77
Program status
Power interruption (PLC), 134
building a status chart, 616
Power requirements
displaying in program editor, 613
calculating, 821
executing a limited number of scans, 620
CPU, 44, 818
Program transfer card, 83
sample, 820
Power supply, 44, 818
S7-200 SMART
888 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 889
Index
S7-200 SMART
890 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
SMB34-SMB35 time interval values for timed electromagnetic compatibility (EMC), 715
interrupts, 837 EM AE04, 776
SMB36-45 (HSC0) high-speed counter 0, 838 EM AM06, 781
SMB4 interrupt queue overflow, run-time program EM AQ02, 779
error, interrupts enabled, Freeport transmitter idle, EM AR02 (RTD), 793
value forced, 833 EM AT04, 788
SMB46-55 (HSC1) high-speed counter 1, 838 EM DP01 PROFIBUS DP, 808
SMB480-SMB515 Data log status, 850 EM DR08, 766
SMB5 I/O error status bit, 834 EM DR16, 770
SMB56-65 (HSC2) high-speed counter 2, 838 EM DR32, 770
SMB566-SMB579: PTO2 and PWM2 high-speed EM DT08, 766
outputs, EM DT16, 770
SMB600-SMB649 Axis 0 motion control, 851 EM DT32, 770
SMB66-SMB85, SMB166-SMB169, and SMB176- EM QR16, 766
SMB179: PTO0, PWM0, PTO1, and PWM1 high-speed EM QT16, 766
outputs, environmental conditions, 716
SMB66-SMB85, SMB166-SMB169, SMB176-SMB179, general technical specifications, 714
and SMB566-SMB579: PTO0, PWM0, PTO1, PWM1, industrial environments, 715
PTO2, and PWM2 high-speed outputs, insulation, 717
SMB6-SMB7 CPU ID register, 834 overvoltage, 717
SMB86-SMB94 and SMB186-SMB194 receive protection, 717
message control, 846 rated voltages, 717
SMB8-SMB19 I/O module ID and error registers, 835 relay electrical service life, 719
SMW100-SMW114 System alarms, 849 SB AE01, 801
SMW22-SMW26 scan times, 836 SB AQ01, 803, 804
SMW98 Expansion I/O bus - communication SB CM01, 805
errors, 848 SB DT04, 799, 800
Software debugging, 611 step response times (SM), 785
Special memory assignments and functions, 828 SQRT (square root), 285
Special memory bytes SR (LAD/FBD Set dominant bistable), 171
EM DP01 PROFIBUS DP, 423 SRB (STL-Shift right byte), 334
Specifications, (SB BA01) SRD (STL-Shift right dword), 334
analog input representation (current), 786 SRW (STL-Shift right word), 334
analog input representation (voltage), 786 SSCPY (STL-Copy substring), 341
analog output representation (current), 787 SSTR_CPY, 341
analog output representation (voltage), 787 Starting
CE approval, 714 startup options, 139
contamination level, 717 Starting Ethernet communications
CPU CR20s, 719 STEP 7-Micro/WIN SMART, 30
CPU CR30s, 730 Starting RS485 communications
CPU CR40, 740 STEP 7-Micro/WIN SMART, 33
CPU CR40s, 740 Static IP information, 384
CPU CR60, 752 Status
CPU CR60s, 752 building a status chart, 616
CPU SR20, 719 displaying in program editor, 613
CPU SR30, 730 executing a limited number of scans, 620
CPU SR40, 740 Status error (timestamp mismatch), 822
CPU SR60, 752 Status LEDs
CPU ST20, 719 CPU, 90
CPU ST30, 730 EM DP01 PROFIBUS DP, 410, 424
CPU ST40, 740 Expansion modules (EMs), 90
CPU ST60, 752 STD (STL-Sub-string to double integer), 235
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 891
Index
S7-200 SMART
892 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 893
Index
Word consistency
PROFIBUS, 415
Writing values
outputs, 63
writing and forcing outputs in STOP mode, 619
WXOR_B, 315
WXOR_DW, 315
WXOR_W, 315
X
XORB (STL-XOR byte), 315
XORD (STL-XOR dword), 315
XORW (STL-XOR word), 315
S7-200 SMART
894 System Manual, V2.4, 03/2019, A5E03822230-AG
Index
S7-200 SMART
System Manual, V2.4, 03/2019, A5E03822230-AG 895