Prodave s7 v5.5 toolbox for windows 95/98/nt/me/2000 applications for a data link of pgs/pcs to simatic s7 via mpi interface and pc/mpi cable (82 pages)
Page 1
___________________ Preface ___________________ Product overview ___________________ Getting started ___________________ SIMATIC Installation ___________________ PLC concepts ___________________ S7-200 SMART Programming concepts ___________________ PLC device configuration ___________________ Program instructions System Manual ___________________ Communication ___________________ Libraries Debugging and ___________________ troubleshooting ___________________ PID loops and tuning ___________________ Open loop motion control ___________________...
Page 2
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.
Siemens products that you are using, they can provide the fastest and most efficient answers to any problems you might encounter.
Page 4
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.
Table of contents Preface ..............................3 Product overview ..........................17 S7-200 SMART CPU ......................18 New features ........................... 21 CPU feature differences......................23 S7-200 SMART expansion modules ..................26 HMI devices for S7-200 SMART ..................... 27 Communications options ......................28 Programming software ......................
Page 6
Table of contents PLC concepts ............................69 Execution of the control logic ....................69 4.1.1 Reading the inputs and writing to the outputs ................ 71 4.1.2 Immediately reading or writing the I/O ................... 71 4.1.3 Executing the user program ....................72 Accessing data ........................
Page 7
Table of contents PLC device configuration ........................133 Configuring the operation of the PLC system ............... 133 6.1.1 System block ......................... 133 6.1.2 Configuring communication ....................135 6.1.3 Configuring the digital inputs ....................138 6.1.4 Configuring the digital outputs ....................140 6.1.5 Configuring the retentive ranges ...................
Page 8
Table of contents Convert ..........................236 7.5.1 Standard conversion instructions ..................236 7.5.2 ASCII character array conversion ..................240 7.5.3 Number value to ASCII string conversion ................245 7.5.4 ASCII sub-string to number value conversion ..............249 7.5.5 Encode and decode ......................252 Counters ..........................
Page 9
Table of contents 7.13.4 END, STOP, and WDR (watchdog timer reset) ..............354 7.13.5 GET_ERROR (Get non-fatal error code) ................356 7.14 Shift and rotate ........................357 7.14.1 Shift and rotate ........................357 7.14.2 Shift register bit ........................360 7.15 String .............................
Page 10
Creating user-defined protocols with Freeport mode............465 8.6.6.2 Using the RS232/PPI Multi-Master cable and Freeport mode with RS232 devices .... 468 RS232 ..........................470 Libraries ............................... 471 Library types (Siemens and user-defined) ................471 Overview of Modbus communication ................... 473 9.2.1 Modbus addressing ......................473 9.2.2 Modbus read and write functions ..................
Page 11
Table of contents 9.3.3.3 MBUS_SLAVE instruction ..................... 492 9.3.3.4 Modbus RTU slave execution error codes................493 9.3.4 Modbus RTU master example program................494 9.3.5 Modbus RTU advanced user information ................496 Open user communication library ..................498 9.4.1 Parameters common to the OUC library instructions ............499 9.4.2 Open user communication library instructions ..............
Page 12
Table of contents 10.6 How to execute a limited number of scans ................576 10.7 Hardware troubleshooting guide ..................578 PID loops and tuning ..........................581 11.1 PID loop definition table ....................... 582 11.2 Prerequisites ........................586 11.3 Auto-hysteresis and auto-deviation..................586 11.4 Auto-tune sequence ......................
Page 13
Table of contents 12.7.3.4 Common engineering units basis ..................639 12.7.4 Important facts to know ......................642 12.8 Axis of Motion example programs ..................643 12.8.1 Axis of Motion simple relative move (cut-to-length application) example ......643 12.8.2 Axis of Motion AXISx_CTRL, AXISx_RUN, AXISx_SEEK, and AXISx_MAN example ..645 12.9 Monitoring the Axis of Motion ....................
Page 14
Table of contents A.4.6 Measurement ranges of the analog inputs for voltage and current (SB and EM) ....749 A.4.7 Measurement ranges of the analog outputs for voltage and current (SB and EM) ..... 750 Thermocouple and RTD expansion modules (EMs) ............752 A.5.1 Thermocouple expansion modules (EMs) ................
Page 15
Table of contents Special memory (SM) and system symbol names................799 SM (Special Memory) overview .................... 799 SMB0: System status......................802 SMB1: Instruction execution status ..................803 SMB2: Freeport receive character ..................804 SMB3: Freeport character error .................... 804 SMB4: Interrupt queue overflow, run-time program error, interrupts enabled, freeport transmitter idle, and value forced ..................
Page 16
Table of contents References ............................831 Often-used special memory bits ..................831 Interrupt events in priority order ................... 832 High-speed counter summary ....................833 STL instructions ........................834 Memory ranges and features ....................841 Ordering information ..........................843 CPU modules ........................843 Expansion modules (EMs) and signal boards (SBs) ............
Product overview 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.
Product overview 1.1 S7-200 SMART CPU S7-200 SMART CPU The CPU combines a microprocessor, an integrated power supply, input circuits, and output circuits in a compact housing to create a powerful Micro PLC. After you have downloaded your program, the CPU contains the logic required to monitor and control the input and output devices in your application.
Page 20
Product overview 1.1 S7-200 SMART CPU Table 1- 3 Standard expandable CPUs Features CPU SR20, CPU SR30, CPU SR40, CPU SR60, CPU ST20 CPU ST30 CPU ST40 CPU ST60 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...
Product overview 1.2 New features New features STEP 7-Micro/WIN SMART V2.3 and the S7-200 SMART V2.3 CPUs introduce the following new features: New CPU models S7-200 SMART has four new compact serial CPU models: ● CPU CR20s AC/DC/Relay (6ES7288-1CR20-0AA1) ● CPU CR30s AC/DC/Relay (6ES7288-1CR30-0AA1) ●...
Page 22
Product overview 1.2 New features Firmware update with STEP 7-Micro/WIN SMART You can now download firmware updates on all CPU models through any of the following serial ports: ● RS485 port ● Signal board port ● DP01 PROFIBUS port See also Creating a user-defined library of instructions (Page 563) EM DE08 and EM DE16 digital input specifications (Page 725) EM DT08, EM DR08, EM QR16, and EM QT16 digital output specifications (Page 727)
Product overview 1.3 CPU feature differences CPU feature differences The S7-200 SMART V2.3 CPU family includes twelve 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).
Page 24
Product overview 1.3 CPU feature differences USB-PPI cable The CRs models provide the RS485 port as the only programming port for the CPU. Using STEP 7-Micro/WIN SMART and a USB-PPI cable, you can perform the following tasks: ● Upload and download your program ●...
Page 25
Product overview 1.3 CPU feature differences HMIs limited to those accessible from PROFIBUS/RS485 networks The new CRs models only support the following PROFIBUS/RS485-capable HMIs: ● COMFORT HMIs: – SIMATIC HMI TP700 COMFORT – SIMATIC HMI TP900 COMFORT – SIMATIC HMI TP1200 COMFORT –...
Product overview 1.4 S7-200 SMART expansion modules S7-200 SMART expansion modules To better solve your application requirements, the S7-200 SMART family includes a wide variety of expansion modules, signal boards, and a communications module. You can use these expansion modules with the standard CPU models (SR20, ST20, SR30, ST30, SR40, ST40, SR60 or ST60) to add additional functionality to the CPU.
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/).
Product overview 1.6 Communications options Communications options 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 –...
Installing STEP 7-Micro/WIN SMART Insert the STEP 7-Micro/WIN SMART CD into the CD-ROM drive of your computer or contact your Siemens distributor or sales office to download STEP7-Micro/WIN SMART from the customer support web site (Page 3). Installation starts automatically and prompts you through the installation process.
Getting started 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.
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 Configuring the CPU for communication 2.1.1.1 Overview A CPU can communicate with a STEP 7-Micro/WIN SMART programming device on two...
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.
Getting started 2.1 Connecting to the CPU 2.1.1.3 Setting up Ethernet communication with the CPU From STEP 7-Micro/WIN SMART, use one of the following methods to display the Ethernet "Communications" dialog for configuring communication to the CPU. ● From the project tree, double-click the "Communications" node. ●...
Page 35
Getting started 2.1 Connecting to the CPU For "Found CPUs" (CPUs located on your local network), use the "Communications" dialog to connect with your CPU: Select TCP/IP for your Communication Inter- • face. Click the "Find CPUs" button to display all •...
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.
Getting started 2.1 Connecting to the CPU 2.1.1.5 Setting up RS485 communication with the CPU RS485 network information configuration or changes done in the system block are part of the project and do not become active until you download your project to the CPU. To access this dialog, perform one of the following: ●...
Page 38
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".
Getting started 2.2 Creating the sample program Creating the sample program Entering this example of a control program will help you understand how easy it is to use STEP 7-Micro/WIN SMART. This program uses six instructions in three networks to create a very simple, self-starting timer that resets itself.
Getting started 2.2 Creating the sample program Notice the project tree and the pro- gram editor. You use the project tree to insert instructions into the networks of the program editor by dragging and dropping the instructions from the "Instructions" portion of the Project tree to the networks.
Getting started 2.2 Creating the sample program To enter the timer instruction for T33: 1. Double-click the "Timers" icon to display the timer instructions. 2. Select the "TON" (on-delay timer) instruction. 3. Hold down the left mouse button and drag the timer onto the first network. 4.
Getting started 2.2 Creating the sample program To enter the instruction for turning on output M10.0: 1. Double-click the Bit Logic icon to display the bit logic instructions and select the output coil. 2. Hold down the left mouse button and drag the coil onto the second network. 3.
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.
Getting started 2.2 Creating the sample program 2.2.5 Saving the sample project Saving the sample project After entering the three networks of instructions, you have finished entering the program. When you save the program, you create a project that includes the CPU type and other parameters.
Getting started 2.3 Downloading the sample program Downloading the sample program First, ensure that your network hardware and PLC connector cable for either Ethernet (Page 33) (standard CPUs only) or RS485 (Page 36) communications is working, and that PLC communication is operating properly. To download all project compo- nents, click the "Download"...
Getting started 2.4 Changing the operating mode of the CPU Changing the operating mode of the CPU The CPU has two modes of operation: STOP mode and RUN mode. The status LEDs on the front of the CPU indicates the current mode of operation. In STOP mode, the CPU is not executing the program, and you can download program blocks.
Installation 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.
Page 48
Installation 3.1 Guidelines for installing S7-200 SMART devices Provide adequate clearance for cooling and wiring S7-200 SMART devices are designed for natural convection cooling. For proper cooling, you must provide a clearance of at least 25 mm above and below the devices. Also, allow at least 25 mm of depth between the front of the modules and the inside of the enclosure.
Installation 3.2 Power budget 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.
Page 50
Installation 3.2 Power budget 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.
Installation 3.3 Installation and removal procedures Installation and removal procedures 3.3.1 Mounting dimensions for the S7-200 SMART devices The CPU and expansion modules include mounting holes to facilitate installation on panels. S7-200 SMART module Width A (mm) Width B (mm) CPU SR20, CPU ST20, and CPU CR20s CPU SR30, CPU ST30, and CPU CR30s CPU SR40, CPU ST40, and CPU CR40s...
Installation 3.3 Installation and removal procedures 3.3.2 Installing and removing the CPU The CPU can be easily installed on a standard DIN rail or on a panel. DIN rail clips are provided to secure the device on the DIN rail. The clips also snap into an extended position to provide a screw mounting position for panel-mounting the unit.
Page 53
Installation 3.3 Installation and removal procedures 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: ●...
Page 54
Installation 3.3 Installation and removal procedures Table 3- 1 Installing a CPU on a DIN rail 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.
Installation 3.3 Installation and removal procedures 3.3.3 Installing and removing a signal board or battery board The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support the use of expansion modules, signal boards or battery boards. Table 3- 3 Installing a signal board on a CPU Task...
Page 56
Installation 3.3 Installation and removal procedures Note The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support the use of expansion modules or signal boards. Installing or replacing the battery in the SB BA01 battery board The SB BA01 battery board requires battery type CR1025.
Installation 3.3 Installation and removal procedures 3.3.4 Removing and reinstalling the terminal block connector The S7-200 SMART modules have removable connectors to make connecting the wiring easy. Table 3- 5 Removing the connector Task Procedure Prepare the system for terminal block removal by removing the power from the CPU and opening the cover above the connector.
Installation 3.3 Installation and removal procedures 3.3.5 Installing and removing an expansion module 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.
Page 59
Installation 3.3 Installation and removal procedures Table 3- 8 Removing an expansion module 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.
Installation 3.3 Installation and removal procedures 3.3.6 Installing and removing the expansion cable The S7-200 SMART expansion cable provides additional flexibility in configuring the layout of your S7-200 SMART system. Only one expansion cable is allowed per CPU system. You install the expansion cable either between the CPU and the first EM, or between any two EMs.
Page 61
Installation 3.3 Installation and removal procedures 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.
Installation 3.4 Wiring guidelines Wiring guidelines Proper grounding and wiring of all electrical equipment is important to help ensure the optimum operation of your system and to provide additional electrical noise protection for your application and the PLC. Refer to the technical specifications (Page 679) for the wiring diagrams.
Page 63
Installation 3.4 Wiring guidelines 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.
Page 64
Installation 3.4 Wiring guidelines 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.
Page 65
Installation 3.4 Wiring guidelines 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 Wiring rules for... CPU and EM connector SB connector Connectible conductor cross- 2 mm to 0.3 mm...
Page 66
Installation 3.4 Wiring guidelines A good suppressor solution is to use contactors and other inductive loads for which the manufacturer provides suppressor circuits integrated in the load device, or as an optional accessory. However, some manufacturer provided suppressor circuits may be inadequate for your application.
Page 67
Installation 3.4 Wiring guidelines Typical suppressor circuit for relay outputs that switch AC inductive loads Ensure that the working voltage of the metal oxide varistor (MOV) is at least 20% greater than the nomi- nal line voltage. Choose pulse-rated, non-inductive resistors, and capacitors recommended for pulse applications (typi- cally metal film).
Page 68
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.
PLC concepts 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. Execution of the control logic The CPU continuously cycles through the control logic in your program, reading and writing data.
Page 70
PLC concepts 4.1 Execution of the control logic Tasks in a scan cycle The CPU executes a series of tasks repetitively. This cyclical execution of tasks is called the scan cycle. The execution of the user program is dependent upon whether the CPU is in STOP mode or in RUN mode.
PLC concepts 4.1 Execution of the control logic 4.1.1 Reading the inputs and writing to the outputs Reading the inputs Digital inputs: Each scan cycle begins by reading the current value of the digital inputs and then writing these values to the process image input register. Analog inputs: The CPU does not read the analog input values as part of the normal scan cycle.
PLC concepts 4.1 Execution of the control logic 4.1.3 Executing the user program During the execution phase of the scan cycle, the CPU executes your main program, starting with the first instruction and proceeding to the last instruction. The immediate I/O instructions give you immediate access to inputs and outputs during the execution of either the main program or an interrupt routine.
Page 73
PLC concepts 4.1 Execution of the control logic 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.
PLC concepts 4.2 Accessing data Accessing data The CPU stores information in different memory locations that have unique addresses. You can explicitly identify the memory address that you want to access. This allows your program to have direct access to the information. To access a bit in a memory area, you specify the address, which includes the memory area identifier, the byte address, and the bit number (which is also called "byte.bit"...
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 Representation Byte (B) Word (W) Double Word (D) Unsigned Inte-...
Page 76
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.
Page 77
PLC concepts 4.2 Accessing data 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.
Page 78
PLC concepts 4.2 Accessing data 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.
Page 79
PLC concepts 4.2 Accessing data Figure 4-4 Accessing the accumulators 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.
Page 80
PLC concepts 4.2 Accessing data L (local memory area) The CPU provides 64 L memory bytes for each POU (program organizational unit) in a local memory stack. A POU's associated L memory addresses are accessible only by the currently executing POU (main, subroutine, or interrupt routine). When you use interrupt routines and subroutines, the L memory stack is used to preserve L memory values of a POU that temporarily suspends execution, so another POU can execute.
Page 81
PLC concepts 4.2 Accessing data 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 L memory addresses are reused for the next execution sequence, after the current nested...
PLC concepts 4.2 Accessing data S (sequence control relay) S bits are associated with SCRs, which you can use to organize machine or steps into equivalent program segments. SCRs allow logical segmentation of the control program. You can access the S memory as bits, bytes, words, or double words. Table 4- 16 Absolute addressing of S memory [byte address].[bit address]...
PLC concepts 4.2 Accessing data 4.2.4 Assigning a constant value for instructions You can use a constant value in many of the programming instructions. Constants can be bytes, words, or double words. The CPU stores all constants as binary numbers, which can then be represented in decimal, hexadecimal, ASCII, or real number (floating point) formats.
PLC concepts 4.2 Accessing data 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). Table 4- 18 CPU mapping convention Signal Expansion Expansion...
Page 85
PLC concepts 4.2 Accessing data 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.
Page 86
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;...
PLC concepts 4.2 Accessing data 4.2.7 Pointer examples Using a pointer to access data in a table This example uses LD14 as a pointer to a recipe stored in a table of recipes that begins at VB100. In this example, VW1008 stores the index to a specific recipe in the table. If each recipe in the table is 50 bytes long, you multiply the index by 50 to obtain the offset for the starting address of a specific recipe.
Page 88
PLC concepts 4.2 Accessing data Using an offset to access data This example uses LD10 as a pointer to the address VB0. You then increment the pointer by an offset stored in VD1004. LD10 then points to another address in V memory (VB0 + offset).
PLC concepts 4.3 Saving and restoring data Saving and restoring data 4.3.1 Downloading project components 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.
Page 90
PLC concepts 4.3 Saving and restoring data 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.
Page 91
PLC concepts 4.3 Saving and restoring data What happens when you download STEP 7-Micro/WIN SMART and the CPU perform the following tasks in sequence on your project components when you download: Step Action Related topics, additional description Project components in the program File open editors serve as input for the download Range checking...
PLC concepts 4.3 Saving and restoring data 4.3.2 Uploading project components To upload project components from the PLC to a STEP 7-Micro/WIN SMART program editor, follow these steps: 1. Ensure that your network hardware and PLC connector cable (Ethernet (Page 33) or RS485 (Page 36)) are working, and that PLC communication is operating properly (Page 578).
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.
PLC concepts 4.3 Saving and restoring data 4.3.4 Using a memory card Using a memory card The standard S7-200 SMART CPUs support the use of a microSDHC card for: ● User program transfer (Page 97) ● Reset CPU to factory default condition (Page 167) ●...
Page 95
PLC concepts 4.3 Saving and restoring data Reset to factory defaults card You can use a memory card to erase all retained data, putting the CPU back into a factory default condition. To be used for reset to factory default (Page 167) purposes, the memory card is organized as follows: Table 4- 22 Memory card used to reset to factory defaults...
PLC concepts 4.3 Saving and restoring data 4.3.5 Inserting a memory card in a standard CPU Table 4- 24 Inserting and removing a memory card in a standard CPU Task Procedure Follow the steps below to insert the microSDHC memory card into the CPU. 1.
PLC concepts 4.3 Saving and restoring data 4.3.6 Transferring your program with a memory card The standard S7-200 SMART CPU models support standard, commercial microSDHC cards with a capacity ranging from 4 GB to 16 GB using the FAT32 file system format. You can use a microSDHC card as a program transfer card for portable storage for your program and project data.
Page 98
PLC concepts 4.3 Saving and restoring data 6. Click the Program button. 7. Enter the password (Page 143) if one is required for programming the memory card. Note STEP 7-Micro/WIN SMART first erases any SIMATIC content on the card prior to transferring the program to the card.
PLC concepts 4.4 Changing the operating mode of the CPU While the copy operation is in progress, the STOP and RUN LEDs on the S7-200 SMART CPU alternately flash. When the S7-200 SMART CPU completes the copy operation, the LEDs stop flashing. Note Program transfer card compatibility Restoring a program transfer card that you created on a different CPU model might fail due...
PLC concepts 4.4 Changing the operating mode of the CPU Changing the operating mode of the CPU The CPU has two modes of operation: STOP mode and RUN mode. The status LEDs on the front of the CPU indicates the current mode of operation. In STOP mode, the CPU is not executing the program, and you can download program blocks.
PLC concepts 4.5 Status LEDs Status LEDs The CPU and EM use LEDs to provide information about operational status. CPU status LEDs The CPU provides the following LED status indicators: State LED Behavior Description STOP STOP: on Applicable when the CPU is in STOP Mode RUN, ERROR: off STOP with Force...
Page 102
PLC concepts 4.5 Status LEDs 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. ●...
Programming concepts 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. Partition your process or machine Divide your process or machine into sections that have a level of independence from each other.
Page 104
Programming concepts 5.1 Guidelines for designing a PLC system Specify the operator stations Based on the requirements of the functional specifications, create drawings of the operator stations. Include the following items: ● Overview showing the location of each operator station in relation to the process or machine ●...
Programming concepts 5.2 Elements of the user program Elements of the user program A program organizational unit (POU) is composed of executable code and comments. The executable code consists of a main program and any subroutines or interrupt routines. The code is compiled and downloaded to the CPU.
Page 106
Programming concepts 5.2 Elements of the user program 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.
Page 107
Programming concepts 5.2 Elements of the user program ● 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.
Programming concepts 5.3 Creating your user program Creating your user program The STEP 7-Micro/WIN SMART user interface provides a convenient working space for creating your user project program. (STEP 7-Micro/WIN SMART projects are files with a .smart file name extension.) To open the user interface, double-click the STEP 7-Micro/WIN SMART icon, or select "STEP 7-MicroWIN SMART"...
Page 109
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.
Programming concepts 5.3 Creating your user program 5.3.2 Using STEP 7-Micro/WIN SMART user interface The STEP 7-Micro/WIN SMART user interface appears below. Note that each editing window can be docked or floated and arranged on the screen as you choose. You can display each window separately, as shown below, or you can combine windows such that each one is accessible from a separate tab: ①...
Programming concepts 5.3 Creating your user program 5.3.3 Using STEP 7-Micro/WIN SMART to create your programs Quick access toolbar The quick access toolbar appears just above the menu tabs. The quick access file button provides quick and easy access to most of the functions of the File menu, and to recent documents.
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.
Programming concepts 5.3 Creating your user program 5.3.5 Features of the LAD editor The LAD editor displays the program as a graphical representation similar to electrical wiring diagrams. The LAD program emulates the flow of electric current from a power source through a series of logical input condi- tions that in turn enable logical output conditions.
Programming concepts 5.3 Creating your user program 5.3.6 Features of the FBD editor The FBD editor displays the program as a graphical rep- resentation that resembles common logic gate diagrams. There are no contacts and coils as found in the LAD edi- tor, but there are equivalent instructions that appear as box instructions.
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.
Page 116
Programming concepts 5.4 Data block (DB) editor Example: Data block page Note: Enter a space before the data values on the lines where you enter no explicit address. Example: Direct address and number values S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 117
Programming concepts 5.4 Data block (DB) editor Example: Symbolic address and symbolic number assignment Example: Alternate binary entry methods and resultant binary assignment You can enter values of 1 or 0 for binary assignments, or "true", "false", "on" or "off" (in either lower, upper, or mixed case).
Programming concepts 5.5 Symbol table Symbol table A symbol is a symbolic name you assign to a memory address or a constant. You can create symbol names for the following memory types: I, Q, M, SM, AI, AQ, V, S, C, T, HC. Symbols defined in the symbol table are global in scope.
Page 119
Programming concepts 5.5 Symbol table Assigning symbols in the symbol table To assign a symbol to an address or constant value, follow the procedure below: 1. Open the symbol table. 2. Type the symbol name (for example, Input1) in the Symbol column. The maximum number of characters in a symbol name is 23 single-byte characters.
Page 120
Programming concepts 5.5 Symbol table Observe the following syntax rules when defining symbols: ● Symbolic names can contain alphanumeric characters, underscores, and extended characters from ASCII 128 to ASCII 255. The first character cannot be a numeral. ● Use double quotation marks to enclose an ASCII constant string that you assign to a symbol name.
Programming concepts 5.6 Variable table Sorting a symbol table You can sort a symbol table by the Symbol or by the Address column in either ascending or descending alphabetical order. In the Address column, numeric constants sort above string constants, which sort above addresses. To sort a column, click either the Symbol or Address column header to sort by that value.
Page 122
Programming concepts 5.6 Variable table You assign a declaration type (TEMP, IN, IN_OUT, or OUT) and a data type, but not a memory address, when you make assignments in a Local Variable Table; the Program Editor automatically assigns memory locations in L memory for all local variables. A variable table symbolic address assignment associates a symbol name with an L memory address, where the data value of concern is stored.
Page 123
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.
Page 124
Programming concepts 5.6 Variable table Making assignments in the variable table 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.
Page 125
Programming concepts 5.6 Variable table 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.
Page 126
Programming concepts 5.6 Variable table Variable table example The following example shows a typical variable table for SBR_0, and then a call to SBR_0 from another program block. See also Programming software (Page 29) S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Programming concepts 5.7 PLC error reaction PLC error reaction Click the PLC but- ton from the Infor- mation section of the PLC menu ribbon strip to see the current error status. To identify specific errors, refer to the error code lists (Page 791).
Programming concepts 5.7 PLC error reaction 5.7.1 Non-fatal errors and I/O errors The CPU does not change to STOP mode when it detects a non-fatal error. It only logs the event in SM memory and continues with the execution of your program. However, you can design your program to force the CPU to STOP mode when a non-fatal error is detected.
Programming concepts 5.7 PLC error reaction Refer to the non-fatal error code list (Page 792) for a description of compile rule violations and run-time programming problems. Refer to the description of the SM bits (Page 799) for more information about the SM bits used for reporting I/O and program execution errors.
Programming concepts 5.8 Program edit in RUN mode Program edit in RUN mode 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.
Page 131
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: ●...
Programming concepts 5.9 Features for debugging your program Performing a program edit and download in RUN mode To initiate a program edit in RUN mode, follow these steps: 1. From the Settings area of the Debug menu ribbon strip, click the Edit In Run button. Note If you have not saved your current program in the program editor, STEP 7-Micro/WIN SMART prompts you to save your project.
PLC device configuration Configuring the operation of the PLC system 6.1.1 System block The system block provides configuration of the S7-200 SMART CPU, signal boards, and expansion modules. Note The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support the use of expansion modules or signal boards.
Page 134
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.
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.2 Configuring communication Click the Communication node of the system block (Page 133) dialog to configure the Ethernet port, background time, and RS485 port. 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.
Page 136
PLC device configuration 6.1 Configuring the operation of the PLC system 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.
Page 137
PLC device configuration 6.1 Configuring the operation of the PLC system 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.
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.3 Configuring the digital inputs Click the Digital Inputs node of the system block (Page 133) dialog to configure digital input filters and pulse catch bits. Digital input filters You can filter digital input signals by setting an input delay time.
Page 139
PLC device configuration 6.1 Configuring the operation of the PLC system To set an input delay, follow these steps: 1. Select the time of the delay from the drop-down list beside one or more inputs. 2. Click the OK button to enter the selections. 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"...
PLC device configuration 6.1 Configuring the operation of the PLC system 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.
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: ●...
Page 142
PLC device configuration 6.1 Configuring the operation of the PLC system 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.
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.6 Configuring system security Click the Security node of the system block (Page 133) dialog to configure a password and security settings for the CPU. The password can be any combination of letters, numbers, and symbols and is case- sensitive.
Page 144
PLC device configuration 6.1 Configuring the operation of the PLC system Table 6- 1 S7-200 SMART CPU password-protected privilege levels Description of operation Full privileg- Read privi- Minimum Disallow es (Level 1) leges (Level privileges upload (Level 3) (Level 4) Read and write user data Permitted Permitted...
Page 145
PLC device configuration 6.1 Configuring the operation of the PLC system Communication write restrictions You can restrict communication writes to a specific range of V memory and disallow communication writes to other memory areas (I, Q, AQ, and M). To restrict communication writes to a specific range of V memory, select the "Restrict"...
Page 146
PLC device configuration 6.1 Configuring the operation of the PLC system Accessing a password-protected CPU 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.
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.7 Configuring the startup options Click the Startup node of the system block (Page 133) dialog to configure startup options for the PLC. CPU mode From this dialog you can select the mode for the CPU after a startup. You have one of the following three choices: ●...
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.
Page 149
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 ●...
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) ●...
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.10 Configuring the analog outputs Click the Analog Outputs node of the system block (Page 133) dialog to configure options for an analog output module that you have selected in the top section. Analog type configuration For each analog output channel you configure the type to be either voltage or current.
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) ●...
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.12 Configuring the RTD analog inputs Click the RTD analog Input node of the system block (Page 133) dialog to configure options for an RTD analog input module that you have selected in the top section. Note The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support the use of expansion modules or signal boards.
Page 154
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: Table 6- 2 RTD types and available resistors RTD types RTD resistors Resistance 4-wire 48 ohms...
Page 155
PLC device configuration 6.1 Configuring the operation of the PLC system Coefficient Depending upon the RTD resistor that you select, you can configure the following RTD temperature coefficients for the channel: RTD resistors RTD temperature coefficients Note: For these RTD resistors, you cannot con- 48 ohms •...
Page 156
PLC device configuration 6.1 Configuring the operation of the PLC system 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.
Page 157
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 RTD module: ● Wire break ● Upper limit exceeded ● Lower limit exceeded ●...
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.13 Configuring the TC analog inputs Click the TC (Thermocouple) analog input node of the system block (Page 133) dialog to configure options for a TC analog input module that you have selected in the top section. Note The CPU models CPU CR20s, CPU CR30s, CPU CR40s, and CPU CR60s do not support the use of expansion modules or signal boards.
Page 159
PLC device configuration 6.1 Configuring the operation of the PLC system 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) ●...
Page 160
PLC device configuration 6.1 Configuring the operation of the PLC system 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: ●...
Page 161
PLC device configuration 6.1 Configuring the operation of the PLC system Basic operation of a thermocouple 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;...
PLC device configuration 6.1 Configuring the operation of the PLC system 6.1.14 Configuring the RS485/RS232 CM01 communications signal board Click the CM01 communications signal board node of the system block (Page 133) dialog to configure options for an RS485/RS232 CM01 communications signal board that you have selected in the top section.
PLC device configuration 6.1 Configuring the operation of the PLC system Baud rate Choose the desired data baud rate from the dropdown list: ● 9.6 Kbps ● 19.2 Kbps ● 187.5 Kbps 6.1.15 Configuring the BA01 battery signal board Click the BA01 battery signal board node of the system block (Page 133) dialog to configure options for a BA01 battery signal board that you have selected in the top section.
PLC device configuration 6.1 Configuring the operation of the PLC system Operation of the Battery (BA01) Signal Board The battery signal board contains a red LED that provides the customer a visual indication of the battery health. An Illuminated LED indicates a battery low condition. The CPU automatically utilizes the real-time clock on the signal board and performs the battery test and battery health LED operation, whether or not the System block contains a configuration for the signal board.
Page 165
PLC device configuration 6.1 Configuring the operation of the PLC system 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.
Page 166
PLC device configuration 6.1 Configuring the operation of the PLC system Clearing the PLC using a reset-to-factory defaults memory card For standard CPUs, you can clear the PLC using a previously-made reset-to-factory defaults memory card. 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.
PLC device configuration 6.1 Configuring the operation of the PLC system Clearing the PLC by reset command followed by PLC power cycle To clear the PLC when you have forgotten the password, follow these steps: 1. Click the Clear button from the Modify area of the PLC menu ribbon strip. 2.
PLC device configuration 6.2 High-speed I/O High-speed I/O 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 17) chapter for the rates supported by your CPU. Dedicated inputs exist for clocks, direction control, and reset, where these functions are supported.
Program instructions Bit logic 7.1.1 Standard inputs Description Test a bit value in memory (M, SM, T, C, V, S, L) or process image register (I or Q). LAD: Normally open and normally closed switches are represented by a contact symbol. If power flow is present on the left-side and the contact is closed, then power flows through the contact to the right- side connector and to the next connected element.
Page 170
Program instructions 7.1 Bit logic FBD AND/OR input assignment The editor feature described in the following table is active only if an input stub is selected and colored red, inside the FBD box cursor. Input option Place cursor Tool button Shortcut key Add input On box...
Program instructions 7.1 Bit logic 7.1.2 Immediate inputs Description The immediate instruction obtains the physical input value when the instruction is executed, but the process image register is not updated. An immediate contact does not wait on the PLC scan cycle to update; it updates immediately.
Program instructions 7.1 Bit logic FBD editor input assignment The editor feature described in the following table is active only if an input stub is selected and colored red, inside the FBD box cursor. Input option Place cursor Tool button Shortcut key Add input On box...
Page 173
Program instructions 7.1 Bit logic Input networks and the logic stack As shown in the following figure, the CPU uses a logic stack to combine the logic states of STL inputs. In these examples, "iv0" to "iv31" identify the initial values of the logic stack levels, "nv"...
Program instructions 7.1 Bit logic 7.1.4 STL logic stack instructions Description 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.
Page 175
Program instructions 7.1 Bit logic 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.
Program instructions 7.1 Bit logic 7.1.6 Positive and negative transition detectors Description The positive transition contact instruction (Edge Up) allows power to flow for one scan for each OFF-to-ON transition. The negative transition contact instruction (Edge Down) allows power to flow for one scan for each ON-to-OFF transition. S7-200 SMART CPUs support a combined total (positive and nega- tive) of 1024 edge detector instructions in your program.
Program instructions 7.1 Bit logic 7.1.7 Coils: output and output immediate instructions Description The Output instruction writes the new value for the output bit to the process image register. LAD and FBD: When the output instruction is executed, the S7-200 turns the output bit in the process image register ON or OFF.
Program instructions 7.1 Bit logic 7.1.8 Set, reset, set immediate, and reset immediate functions Description bit, N The Set (S) and Reset (R) instructions set (ON) or reset (OFF) the number of bits (N), starting at the address (bit). You can set or reset from 1 to 255 bits.
Program instructions 7.1 Bit logic 7.1.9 Set and reset dominant bistable LAD/FBD 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) signals are both true, the output (OUT) is true.
Program instructions 7.1 Bit logic Example SR and RS NETWORK 1 LD I0.0 LD I0.1 A Q0.0 = Q0.0 NETWORK 2 LD I0.0 LD I0.1 A Q0.1 = Q0.1 O Q0.1 = Q0.1 7.1.10 NOP (No operation) instruction Description NOP N The No Operation (NOP) instruction has no effect on the user program execution.
Program instructions 7.1 Bit logic 7.1.11 Bit logic input examples Network 1 Normally-open contacts I0.0 AND I0.1 must be ON LD I0.0 (closed) to activate Q0.0. The NOT instruction acts A I0.1 as an inverter. In RUN mode, Q0.0 and Q0.1 have opposite logic states.
Program instructions 7.1 Bit logic 7.1.12 Bit logic output examples Network 1 Output instructions assign bit values to external I/O LD I0.0 (I, Q) and internal memory (M, SM, T, C, V, S, L). = Q0.0 = Q0.1 = V0.0 Network 2 Set a sequential group of 6 bits to a value of 1.
Page 184
Program instructions 7.1 Bit logic Run-mode timing for output examples S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Program instructions 7.2 Clock Clock 7.2.1 Read and set real-time clock LAD / FBD Description TODR The Read real-time clock instruction reads the current time and date from the CPU and loads it in an 8 byte Time buffer starting at byte address T. TODW 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.
Page 186
Program instructions 7.2 Clock Format of 8 byte time buffer, beginning at byte address T 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 years, in 2000 to 2099 range. T byte Description Data value...
Program instructions 7.2 Clock 7.2.2 Read and set real-time clock extended LAD / FBD Description TODRX The Read real-time clock extended instruction reads the current time, date, and daylight saving configuration from the PLC and loads it in a 19-byte buffer begin- ning at the address assigned by T.
Page 188
Program instructions 7.2 Clock Format of 19 byte time buffer, beginning at byte address T 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.
Page 189
Program instructions 7.2 Clock T byte Description Data value DST ending month 1 to 12 (BCD value) DST ending day 1 to 31 (BCD value) DST ending hour 0 to 23 (BCD value) DST ending minute 0 to 59 (BCD value) The following bytes 9-20 are used only for correction mode = EEH (extended user assigned) DST correction hours 0 to 23 (BCD value)
Page 190
Program instructions 7.2 Clock Extended power outage effect on the CPU clock See the S7-200 SMART system manual appendix A CPU specifications, for how long the real-time clock can maintain the correct time during power outages. A CPU initializes with the time values shown in the following table, after an extended power outage.
Program instructions 7.3 Communication Communication 7.3.1 GET and PUT (Ethernet) You can use the GET and PUT instructions for communication between S7-200 SMART CPUs through the Ethernet connection. 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.
Page 192
Program instructions 7.3 Communication 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.
Page 193
Program instructions 7.3 Communication The following figure describes the table that is referenced by the TABLE parameter, and the following table lists the error codes. Table 7- 3 Definition of GET and PUT instructions TABLE parameter Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3...
Page 194
Program instructions 7.3 Communication Table 7- 4 Error codes for the GET and PUT instructions TABLE parameter Code Definition No error 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 •...
Page 195
Program instructions 7.3 Communication 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.
Page 196
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.
Page 197
Program instructions 7.3 Communication Table 7- 6 Example: GET and PUT instructions Network 1 On the first scan, clear all LD SM0.1 receive and transmit buff- FILL +0, VW200, 40 ers. FILL +0, VW300, 40 Network 2 When the GET "Done" bit LD V200.7 (V200.7) is set and AW= VW217, +100...
Page 198
Program instructions 7.3 Communication Network 3 When the GET "Done" bit LD V200.7 is set, save the control MOVB VB216, VB400 data from case packer 1. Network 4 If not the first scan and LDN SM0.1 there are no errors: AN V200.6 1.
Program instructions 7.3 Communication 7.3.2 Transmit and receive (Freeport on RS485/RS232) You can use the Transmit (XMT) and Receive (RCV) instructions for communication between a S7-200 SMART CPU and other devices through the CPU serial port(s). Each S7-200 SMART CPU provides an integrated RS485 port (Port 0). The standard CPUs additionally support an optional CM01 Signal Board (SB) RS232/RS485 port (Port 1).
Page 200
Program instructions 7.3 Communication Non-fatal errors with ENO = 0 SM bits affected 0006H Indirect address SM 86.6 Receive message terminated on port 0 • • 0009H Simultaneous Trans- SM 186.6 Receive message terminated on port 1 • • mit/Receive on port 0 000BH Simultaneous Trans- •...
Page 201
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.
Page 202
Program instructions 7.3 Communication 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. ① Number of bytes to transmit ②...
Page 203
Program instructions 7.3 Communication Receive data The Receive instruction lets you receive a buffer of one or more characters, up to a maximum of 255. The following figure shows the format of the Receive buffer. ① Number of bytes received (byte field) ②...
Page 204
Program instructions 7.3 Communication Receive buffer format (SMB86 to SMB94, and SMB186 to SMB194) Port 0 Port 1 Description SMB86 SMB186 Receive message status byte n: 1 = Receive message function terminated; user issued disable command. r: 1 = Receive message function terminated; error in input parameters or missing start or end con- dition.
Page 205
Program instructions 7.3 Communication Start and End conditions for the Receive instruction The Receive instruction uses the bits of the receive message control byte (SMB87 or SMB187) to define the message start and end conditions. 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.
Page 206
Program instructions 7.3 Communication The Receive instruction supports several start conditions: Idle line detection: The idle line condition is defined as a quiet or idle time on the transmission line. A receive is started when the communications line has been quiet or idle for the number of milliseconds specified in SMW90 or SMW190.
Page 207
Program instructions 7.3 Communication Idle line and start character: The Receive instruction can start a message with the combination of an idle line and a start character. When the Receive instruction is executed, the receive message function searches for an idle line condition. After finding the idle line condition, the receive message function looks for the specified start character.
Page 208
Program instructions 7.3 Communication Any character: The Receive instruction can be configured to immediately start receiving any and all characters and placing them in the message buffer. This is a special case of the idle line detection. In this case the idle line time (SMW90 or SMW190) is set to zero. This forces the Receive instruction to begin receiving characters immediately upon execution.
Page 209
Program instructions 7.3 Communication The Receive instruction supports several ways to terminate a message. The message can be terminated on one or a combination of the following: End character detection: The end character is any character which is used to denote the end of the message.
Page 210
Program instructions 7.3 Communication 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.
Page 211
Program instructions 7.3 Communication Using character interrupt control to receive data To allow complete flexibility in protocol support, you can also receive data using character interrupt control. Each character received generates an interrupt. The received character is placed in SMB2, and the parity status (if enabled) is placed in SM3.0 just prior to execution of the interrupt routine attached to the receive character event.
Page 212
Program instructions 7.3 Communication Example: Transmit and Receive instructions MAIN Network 1 Network 1 //This program receives a string of characters until a line feed character is received. The message is then transmitted back to the sender. LD SM0.1 On the first scan: MOVB 16#09, SMB30 1.
Program instructions 7.3 Communication INT 2 Network 1 Network 1 LD SM0.0 Transmit Complete interrupt: Enable RCV VB100, 0 another receive. 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.
Program instructions 7.3 Communication Non-fatal error conditions with ENO = 0 SM bits affected None 006H Indirect address • 0004H Attempted to perform a • SET_ADDR instruction in an interrupt routine 0090H Port number is invalid • 0091H Port address is invalid •...
Page 215
Program instructions 7.3 Communication Non-fatal errors with ENO = 0 SM bits affected None 006H Indirect address • 0004H Attempted to execute a • SIP_ADDR instruction in an interrupt routine IP address cannot be changed (see • following note) IP address is invalid for the current •...
Page 216
Program instructions 7.3 Communication Similarly, consider the octets of the subnet mask "255.255.255.0": Octet decimal value Hexadecimal value 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.
Program instructions 7.3 Communication 7.3.5 Open user communication The Open User Communication (OUC) instructions give your program a way to communicate over an Ethernet network to another Ethernet capable device. The other Ethernet device can be another S7-200 SMART CPU or another third party device that supports either UDP, TCP, or ISO-on-TCP protocol.
Page 218
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.
Page 219
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.
Page 220
Program instructions 7.3 Communication TCON instruction tables The following tables contain the format and definitions for the TCON instruction. Refer to "OUC instruction error codes" (Page 228) for the error code listing. Refer to "Ports and TSAPs" (Page 419) for port number restrictions and further information: ●...
Page 221
Program instructions 7.3 Communication Table 7- 9 Definition of TCON instruction TABLE parameter structure for UDP and TCP Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 offset Error code (5 bits) Connection ID (2 bytes) Connection Type...
Page 222
Program instructions 7.3 Communication Table 7- 10 Definition of TCON instruction TABLE parameter structure for ISO-on-TCP Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 offset Error code (5 bits) Connection ID (2 bytes) Connection Type Remote...
Page 223
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.
Page 224
Program instructions 7.3 Communication 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.
Page 225
Program instructions 7.3 Communication Table 7- 11 Definition of TSEND and TRECV instruction TABLE parameter structure for TCP and ISO-on-TCP Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 offset Error code (5 bits) Connection ID (2 bytes) Data Length...
Page 226
Program instructions 7.3 Communication Table 7- 12 Definition of TSEND and TRECV instruction TABLE parameter structure for UDP Byte Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 offset Error code (5 bits) Connection ID (2 bytes) Data Length...
Page 227
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.
Program instructions 7.3 Communication 7.3.5.2 OUC instruction error codes The following table lists the Open User Communication (OUC) error codes: Error code Description No error The data length parameter is greater than the maximum allowed (1024 bytes). The data buffer is not in I, Q, M, or V memory areas. The data buffer does not fit in the memory area.
Page 229
Program instructions 7.3 Communication Error code Description One of the following IP address errors have occurred: The IP address is invalid (for example, address • 0.0.0.0). This IP address is the IP address of this CPU. • This CPU has IP address 0.0.0.0. •...
Program instructions 7.4 Compare Compare 7.4.1 Compare number values The compare instructions can compare two number values with the same data type. You can compare bytes, integers, double integers, and real numbers. For LAD and FBD: When the comparison is TRUE, the compare instruction sets ON a contact (LAD network power flow), or output (FBD logic flow).
Page 231
Program instructions 7.4 Compare Selecting the data types to be compared The data type identifier that you choose determines the required data type for the IN1 and IN2 parameters. Data type identifier Required IN1, IN2 data type Unsigned byte Signed word integer Signed double word integer Signed real LAD contacts, FBD boxes STL...
Page 232
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) •...
Page 233
Program instructions 7.4 Compare Example compare values Network 1 Activate I0.1 to load V memory addresses LD I0.1 with low values that make the compari- MOVW -30000, VW0 sons FALSE and that set the status indi- cators OFF. MOVD -200000000, VD2 MOVR 1.012E-006, VD6 Network 2 Activate I0.2 to load V memory addresses...
Program instructions 7.4 Compare 7.4.2 Compare character strings The compare string instructions can compare two ASCII character strings. For LAD and FBD: When the comparison is TRUE, the compare instruction turns ON the contact (LAD), or output (FBD). For STL: When the comparison is TRUE, the compare instruction loads, ANDs, or ORs a 1 with the value on the top of the logic stack.
Page 235
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) •...
Program instructions 7.5 Convert Convert 7.5.1 Standard conversion instructions These instructions convert an input value IN to the assigned format and store the output value in the memory location assigned by OUT. For example, you can convert a double integer value to a real number. You can also convert between integer and BCD formats. Standard conversions LAD / FBD Description...
Page 237
Program instructions 7.5 Convert LAD / FBD Description ROUND IN, OUT Round: Convert the 32-bit real-number value IN to a double integer value and place the rounded result at the address assigned to OUT. If the fraction portion is 0.5 or greater, the number is rounded up.
Page 238
Program instructions 7.5 Convert Coding for a seven-segment display Example: Using SEG to display the numeral 5 on a seven-segment display Network 1 LD I1.0 SEG VB48, AC1 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 239
Program instructions 7.5 Convert Examples: I_DI, DI_R, and BCD_I Network 1 Convert inches to centimeters: LD I0.0 1. Load a counter value (inches) into ITD C10, AC1 AC1 (ex. C10=101). DTR AC1, VD0 2. Convert the value to a real number MOVR VD0, VD8 (ex.
Program instructions 7.5 Convert 7.5.2 ASCII character array conversion Converting from or to ASCII character byte arrays The ASCII character array instructions use the BYTE data type for character input or output. An array of ASCII characters is referenced a sequence of byte addresses. This is not the STRING data type, as no length byte is used.
Page 241
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 (-). ●...
Page 242
Program instructions 7.5 Convert FMT operand for the integer to ASCII (ITA) instruction Double integer to ASCII LAD / FBD Description DTA IN, OUT, FMT The Double Integer to ASCII instruction converts a double word IN to an array of ASCII characters.
Page 243
Program instructions 7.5 Convert FMT operand for the double integer to ASCII (DTA) instruction Real to ASCII LAD / FBD Description RTA IN, OUT, FMT The Real to ASCII instruction converts a real-number value IN to ASCII charac- ters. The format parameter FMT specifies the conversion precision to the right of the decimal, whether the decimal point is shown as a comma or a period, and the output buffer size.
Page 244
Program instructions 7.5 Convert 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). FMT Operand for the Real to ASCII (RTA) instruction Example: ASCII to Hexadecimal Network 1 LD I3.2...
Program instructions 7.5 Convert Example: Real to ASCII Network 1 Convert the real value at VD2 to 10 LD I2.3 ASCII characters starting at VB10, RTA VD2, VB10, 16#A3 using a format of 16#A3 (a period for the decimal point, followed by 3 dig- its).
Page 246
Program instructions 7.5 Convert ASCII 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.
Page 247
Program instructions 7.5 Convert 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.
Page 248
Program instructions 7.5 Convert 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.
Program instructions 7.5 Convert 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.
Page 250
Program instructions 7.5 Convert Non-fatal error conditions with ENO = 0 SM bits affected 0006H Indirect address SM1.1 Overflow or illegal value • • 0091H Operand out of range • 009BH Index = 0 • SM1.1 Overflow or illegal value •...
Page 251
Program instructions 7.5 Convert Examples of valid and invalid input strings Example string conversion: Substring to integer, double integer, and real Network 1 S_I converts the numeric string to an inte- LD I0.0 ger value. STI VB0, 7, VW100 STD VB0, 7, VD200 STR VB0, 7, VD300 S_DI converts the numeric string to a double integer value.
Program instructions 7.5 Convert 7.5.5 Encode and decode LAD / FBD Description ENCO IN, OUT Encode writes the bit number of the least significant bit set in the input word IN, to the least significant "nibble" (4 bits) of the output byte OUT. DECO IN, OUT Decode sets the bit in the output word OUT that corresponds to the bit number represented by the least significant "nibble"...
Program instructions 7.6 Counters Counters 7.6.1 Counter instructions LAD / FBD Description CTU Cxxx, PV LAD/FBD: The CTU count up instruction counts up from the current value each time the count up CU input makes the transition from OFF to ON. When the current value Cxxx is greater than or equal to the preset value PV, the counter bit Cxxx is set ON.
Page 254
Program instructions 7.6 Counters Input / output Data type Operand Cxxx WORD Constant (C0 to C255) CU, CD (LAD) BOOL Power flow CU, CD (FBD) BOOL I, Q, V, M, SM, S, T, C, L, Logic flow (LAD) BOOL Power Flow (FBD) BOOL I, Q, V, M, SM, S, T, C, L, Logic flow...
Page 255
Program instructions 7.6 Counters Example CTD count down Network 1 Count down counter C1 current value LD I0.0 counts from 3 to 0 LD I0.1 With I0.1 OFF, I0.0 OFF-ON decre- CTD C1, +3 ments C1 current value I0.1 ON loads countdown preset value Network 2 C1 bit is ON when counter C1 current LD C1...
Page 256
Program instructions 7.6 Counters Example CTUD count up/down Network 1 I0.0 counts up LD I0.0 I0.1 counts down LD I0.1 I0.2 resets current value to 0 LD I0.2 CTUD C48, +4 Network 2 Count Up/Down counter C48 turns on LD C48 C48 bit when current value >= 4 = Q0.0 Timing diagram...
Program instructions 7.6 Counters 7.6.2 High-speed counter instructions High-speed counters can count high-speed events that cannot be controlled by standard counters. Standard counters operate at a slower rate that is limited by the PLC scan time. You can use the HDEF and HSC instructions and create your own HSC routines, or you can simplify the programming tasks by using the High Speed Counter wizard.
Page 258
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.
Page 259
Program instructions 7.6 Counters HSC counting mode support ● The compact models support a total of four HSC devices (HSC0, HSC1, HSC2, and HSC3). ● The SR and ST models support a total of six HSC devices (HSC0, HSC1, HSC2, HSC3, HSC4, and HSC5).
Program instructions 7.6 Counters 7.6.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: S model CPUs: 200 kHz 100 kHz = Maximum 1x count rate...
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 •...
Page 262
Program instructions 7.6 Counters 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.
Page 263
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.
Program instructions 7.6 Counters 7.6.5 High-speed counter programming You can use the high-speed counter wizard to simplify HSC programming tasks. The wizard helps you select the counter type/mode, preset/current values, counter options, and generates the necessary special memory assignments, subroutines, and interrupt routines. Note You must ensure that high-speed counter inputs are correctly filtered and wired for counting high frequency signals.
Page 265
Program instructions 7.6 Counters HDEF instruction sets the counting mode 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.
Page 266
Program instructions 7.6 Counters How mode selection affects counter operation HSC modes 0 and 1 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 267
Program instructions 7.6 Counters HSC modes 3 and 4 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 268
Program instructions 7.6 Counters HSC modes 6 and 7 When you use counting modes 6 or 7, and rising edges on both the up clock and down clock inputs occur within 0.3 microseconds of each other, the high-speed counter could see these events as happening simultaneously.
Page 269
Program instructions 7.6 Counters HSC modes 9 and 10 (AB quadrature phase 1x) S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 270
Program instructions 7.6 Counters HSC modes 9 and 10 (AB quadrature phase 4x) S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 271
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.
Page 272
Program instructions 7.6 Counters HSC0 HSC1 HSC2 HSC3 HSC4 HSC5 Description (used only when HDEF is executed) SM37.0 SM57.0 SM147.0 SM157.0 Active level control bit for Reset: support- support- 0 = Reset is active high • 1 = Reset is active low •...
Page 273
Program instructions 7.6 Counters HSC Control bytes HSC0 HSC1 HSC2 HSC3 HSC4 HSC5 Description SM37.3 SM47.3 SM57.3 SM137.3 SM147.3 SM157.3 Counting direction control bit: 0 = Count down • 1 =Count up • SM37.4 SM47.4 SM57.4 SM137.4 SM147.4 SM157.4 Write the counting direction to the HSC: 0 = No update •...
Page 274
Program instructions 7.6 Counters Example: Reading and saving the current count value Network 1 MAIN Save the value of HSC0 into LD I3.0 VD200 when I3.0 transitions from OFF to ON. MOVD HC0, VD200 Set current values and preset values with your program Each high-speed counter has a 32-bit current value (CV) and a 32-bit preset value (PV) stored internally.
Page 275
Program instructions 7.6 Counters Example: Updating the current and preset values Network 1 MAIN program network Update the current count to LD I2.0 1000 and the preset value to 2000 for HSC0 when I2.0 transitions from OFF to ON. MOVD 1000, SMD38 MOVD 2000, SMD42 = SM37.5 = SM37.6...
Page 276
Program instructions 7.6 Counters HSC status byte A status byte for each high-speed counter provides status memory bits that indicate the current counting direction and whether the current value is greater than or equal to the preset value. The following table defines these status bits for each high-speed counter. Note Status bits are valid only while the high-speed counter interrupt routine executes.
Program instructions 7.6 Counters 7.6.6 Example initialization sequences for high-speed counters HSC0 is used as the counter in the following descriptions of the initialization and operation sequences. ● HSC0, HSC2, HSC4, and HSC5 support counting modes (0, 1), (3, 4), (6, 7), and (9, 10). ●...
Page 278
Program instructions 7.6 Counters 6. In order to capture the current value equal to preset event, program an interrupt by attaching the CV = PV interrupt event (event 12) to an interrupt routine. See the section that discusses the Interrupt instructions for complete details on interrupt processing. 7.
Page 279
Program instructions 7.6 Counters Initialization of modes 6 and 7 The following steps describe how to initialize HSC0 for two-phase up/down counter with up/down clocks (modes 6 and 7): 1. Use the first scan memory bit to call a subroutine in which the initialization operations are performed.
Page 280
Program instructions 7.6 Counters Initialization of modes 9 and 10 The following steps describe how to initialize HSC0 as an AB quadrature phase counter (modes 9 and 10): 1. Use the first scan memory bit to call a subroutine in which the initialization operations are performed.
Page 281
Program instructions 7.6 Counters Change direction in modes 0 and 1 The following steps describe how to configure HSC0 for change direction for single-phase counter with internal direction (modes 0 and 1): 1. Load SMB37 to write the desired direction: SMB37 = 16#90 –...
Page 282
Program instructions 7.6 Counters Disabling a high-speed counter (any mode) The following steps describe how to disable the HSC0 high-speed counter (any mode): 1. Load SMB37 to disable the counter: SMB37 = 16#00 – Disables the counter 2. Execute the HSC instruction to disable the counter. S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 283
Program instructions 7.6 Counters Example: high-speed counter instruction Network 1 MAIN On the first scan, call SBR_0. LD SM0.1 CALL SBR_0 Network 1 SBR0 On the first scan, configure HSC0: LD SM0.1 1. Enable the counter MOVB 16#F8, SMB37 – Write a new current value.
Page 284
Program instructions 7.6 Counters Network 1 INT0 Program HSC0: LD SM0.0 1. Clear the current value of HSC0. 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: ●...
Program instructions 7.7 Pulse output Pulse output 7.7.1 Pulse output instruction (PLS) The Pulse output (PLS) instruction controls the Pulse train output (PTO) and Pulse width modulation (PWM) functions available on the high-speed outputs (Q0.0, Q0.1, and Q0.3). When using PWM, you can use an optional wizard to create the PWM instructions. LAD / FBD Description PLS N...
Page 286
Program instructions 7.7 Pulse output 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.
Program instructions 7.7 Pulse output 7.7.2 Pulse train output (PTO) PTO provides a square wave with a 50% duty cycle output for a specified number of pulses at a specified frequency. Refer to the figure below. PTO can produce either a single train of pulses or multiple trains of pulses using a pulse profile.
Page 288
Program instructions 7.7 Pulse output Single-Segment pipelining of PTO pulses In single-segment pipelining, you are responsible for updating the SM locations for the next pulse train. After the initial PTO segment has started, you must immediately modify the SM locations with the parameters of the second waveform. After you update the SM values, execute the PLS instruction again.
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. Table 7- 16 Profile table format for multiple-segment PTO operation Byte offset Segment Description of table entries Number of segments: 1 to 255 Starting Frequency (1 to 100,000 Hz) Ending Frequency (1 to 100,000 Hz)
Program instructions 7.7 Pulse output Pulse width time and cycle time and reactions in the PWM function Pulse width time / cycle time Reaction Pulse width time >= Cycle time value The duty cycle is 100%: the output is turned on continuously. Pulse width time = 0 The duty cycle is 0%: the output is turned off continuously.
Page 291
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.
Page 292
Program instructions 7.7 Pulse output Table 7- 17 SM locations for the PTO/PWM control registers Q0.0 Q0.1 Q0.3 Status bits SM66.4 SM76.4 SM566.4 PTO delta calculation error (due to an add error): 0 = No error • 1 = Aborted due to error •...
Page 293
Program instructions 7.7 Pulse output SMW70 SMW80 SMW570 PWM pulse width value: 0 to 65,535 SMD72 SMD82 SMD572 PTO pulse count value: 1 to 2,147,483,647 SMB166 SMB176 SMB576 Number of the segment in progress: Multiple-segment PTO operation only SMW168 SMW178 SMW578 Starting location of the profile table (byte offset from V0): Multiple-segment PTO operation only Table 7- 18 PTO/PWM control byte reference...
Program instructions 7.7 Pulse output 7.7.5 Calculating the profile table values The multiple-segment pipelining capability of the PTO generators can be useful in many applications, particularly in stepper motor control. For example, you can use PTO with a pulse profile to control a stepper motor through a simple ramp up (acceleration), run (no acceleration), and ramp down (deceleration) sequence.
Page 295
Program instructions 7.7 Pulse output 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.
Page 296
Program instructions 7.7 Pulse output 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.
Program instructions 7.8 Math Math 7.8.1 Add, subtract, multiply, and divide LAD / FBD Description +I IN1, OUT The Add Integer instruction adds two 16-bit integers to produce a 16-bit +D IN1, OUT result. The Add Double Integer instruction adds two 32-bit integers to pro- +R IN1, OUT duce a 32-bit result.
Page 298
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.
Page 299
Program instructions 7.8 Math Integer operations from the LAD example Add data Data address Multiply data Data address VW100 VW100 Divide data 4000 Data address W200 VW10 VW200 Example: Real math instructions Network 1 LD I0.0 +R AC1, AC0 *R AC1, VD100 /R VD10, VD200 Real number operations from the LAD example Add data...
Program instructions 7.8 Math 7.8.2 Multiply integer to double integer and divide integer with remainder LAD / FBD Description MUL IN1, OUT The multiply integer to double Integer instruction multiplies two 16-bit integers and produces a 32-bit product. In STL, the least-significant word (16 bits) of the 32-bit OUT is used as one of the factors.
Page 301
Program instructions 7.8 Math Example: MUL and DIV instructions Network 1 LD I0.0 MUL AC1, VD100 DIV VW10, VD200 VD100 contains: VW100 and VW102, and VD200 contains: VW200 and VW202. Real number operations from the LAD example MUL data 80000 Data address VW102 VD100...
Program instructions 7.8 Math 7.8.3 Trigonometry, natural logarithm/exponential, and square root Sine (SIN), Cosine (COS), and Tangent (TAN) instructions LAD / FBD Description SIN IN, OUT The sine (SIN), cosine (COS), and tangent (TAN) instructions evaluate the trigo- nometric function of the angle value IN and place the result in OUT. The input angle value is measured in radians.
Page 303
Program instructions 7.8 Math Natural logarithm (LN) and natural exponential (EXP) instructions LAD / FBD Description LN IN, OUT The Natural Logarithm instruction (LN) performs the natural logarithm of the value in IN and places the result in OUT. The Natural Exponential instruction (EXP) performs the exponential operation of e raised to the power of the value in IN and places the result in OUT.
Page 304
Program instructions 7.8 Math Square root (SQRT) instruction LAD / FBD Description SQRT IN, OUT The Square Root instruction (SQRT) takes the square root of a real number (IN) and produces a real number result OUT. SQRT (IN)= OUT • To obtain other roots: 5 cubed = 5^3 = EXP(3*LN(5)) = 125 •...
Program instructions 7.8 Math 7.8.4 Increment and decrement LAD / FBD Description INCB OUT The increment instructions add 1 to the input value IN and place the result into the INCW OUT location at OUT. INCD OUT LAD and FBD: IN + 1 = OUT •...
Page 306
Program instructions 7.8 Math Example: Increment and decrement Network 1 LD I4.0 INCW AC0 DECD VD100 Increment/decrement operations from the LAD example Increment word Data address Decrement double word 128000 127999 Data address VD100 VD100 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Program instructions 7.9 PID LAD / FBD Description PID TBL, LOOP The PID loop instruction (PID) executes a PID loop calculation on the referenced LOOP based upon the input and configuration information in Table (TBL). Non-fatal errors with ENO = 0 SM bits affected 0013H Illegal PID loop table SM1.1 Overflow...
Program instructions 7.9 PID 7.9.1 Using the PID wizard Use the PID wizard to configure your PID loop 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.
Page 309
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) You assign how the loop Process Variable (PV) is to be scaled.
Page 310
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;...
Page 311
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.
Page 312
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. This screen shows a list of the subrou- tines and interrupt routines generated by the PID wizard and gives a brief...
Program instructions 7.9 PID 7.9.2 PID algorithm In steady state operation, a PID controller regulates the value of the output so as to drive the error (e) to zero. A measure of the error is given by the difference between the setpoint (SP) (the desired operating point) and the process variable (PV) (the actual operating point).
Page 314
Program instructions 7.9 PID Since the digital computer must calculate the output value each time the error is sampled beginning with the first sample, it is only necessary to store the previous value of the error and the previous value of the integral term. As a result of the repetitive nature of the digital computer solution, a simplification in the equation that must be solved at any sample time can be made.
Page 315
Program instructions 7.9 PID Understanding the elements of the PID equation Proportional term of the PID equation: The proportional term MP is the product of the gain ), which controls the sensitivity of the output calculation, and the error (e), which is the difference between the setpoint (SP) and the process variable (PV) at a given sample time.
Page 316
Program instructions 7.9 PID To avoid step changes or bumps in the output due to derivative action on setpoint changes, this equation is modified to assume that the setpoint is a constant (SP = SP ). This results in the calculation of the change in the process variable instead of the change in the error as shown: * (T ) * ((SP...
Program instructions 7.9 PID 7.9.3 Converting and normalizing the loop inputs A loop has two input variables, the setpoint and the process variable. The setpoint is generally a fixed value such as the speed setting on the cruise control in your automobile. The process variable is a value that is related to loop output and therefore measures the effect that the loop output has on the controlled system.
Program instructions 7.9 PID 7.9.4 Converting the loop output to a scaled integer value The loop output is the control variable, such as the throttle setting of the cruise control on an automobile. The loop output is a normalized, real number value between 0.0 and 1.0. Before the loop output can be used to drive an analog output, the loop output must be converted to a 16-bit, scaled integer value.
Program instructions 7.9 PID 7.9.5 Forward- or reverse-acting loops The loop is forward-acting if the gain is positive and reverse-acting if the gain is negative. (For I or ID control, where the gain value is 0.0, specifying positive values for integral and derivative time will result in a forward-acting loop, and specifying negative values will result in a reverse-acting loop.) Variables and ranges...
Page 320
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.
Page 321
Program instructions 7.9 PID Loop table The loop table is 80 bytes long and has the format shown in the following table. Offset Field Format Type Description Process variable (PV REAL Contains the process variable, which must be scaled between 0.0 and 1.0. Setpoint (SP REAL Contains the setpoint, which must be scaled be-...
Program instructions 7.10 Interrupt 7.10 Interrupt 7.10.1 Interrupt instructions When you make the transition to RUN mode, interrupts are initially disabled. In RUN mode, you can enable interrupt processing by executing the ENI (enable Interrupt) instruction. Executing the DISI (disable interrupt) instruction inhibits the processing of interrupts; however, active interrupt events will continue to be queued.
Page 323
Program instructions 7.10 Interrupt ATCH, DTCH, and CEVENT LAD / FBD Description ATCH INT, EVNT The attach interrupt instruction associates an interrupt event EVNT with an inter- rupt routine number INT and enables the interrupt event. DTCH EVNT The detach interrupt instruction disassociates an interrupt event EVNT from all interrupt routines and disables the interrupt event.
Program instructions 7.10 Interrupt 7.10.2 Interrupt routine overview and CPU model event support Before you can invoke an interrupt routine, you must assign an association between the interrupt event and the program segment that you want to execute when the event occurs. Use the attach interrupt instruction to associate an interrupt event (specified by the interrupt event number) and the program segment (specified by an interrupt routine number).
Page 325
Program instructions 7.10 Interrupt Event Description CPU CR20s CPU CR30s SR20/ST20 CPU CR40s CPU CR60s SR30/ST30 SR40/ST40 SR60/ST60 PTO1 Pulse count complete Timer T32 CT=PT (current time = preset time) Timer T96 CT=PT (current time = preset time) Port 0 Receive message complete Port 1 Receive message complete Port 1 Receive character Port 1 Transmit complete...
Program instructions 7.10 Interrupt 7.10.3 Interrupt programming guidelines Interrupt routine execution An interrupt routine executes in response to an associated internal or external event. Once the last instruction of an interrupt routine has executed, control returns to the point in the scan cycle at the point of the interruption.
Page 327
Program instructions 7.10 Interrupt Ensuring access for a single shared variable ● For an STL program that is sharing a single variable: If the shared data is a single byte, word, or double word variable and your program is written in STL, then correct shared access can be ensured by storing the intermediate values from operations on shared data only in non-shared memory locations or accumulators.
Program instructions 7.10 Interrupt 7.10.4 Types of interrupt events that the S7-200 SMART CPU supports Communication port interrupts The serial communications port of the CPU can be controlled by your program. This mode of operating the communications port is called Freeport mode. In Freeport mode, your program defines the baud rate, bits per character, parity, and protocol.
Page 329
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.
Program instructions 7.10 Interrupt 7.10.5 Interrupt priority, queuing, and example program 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.
Page 331
Program instructions 7.10 Interrupt Priority order for interrupt events Priority group Event Description Communications Port 0 Receive character Highest Priority Port 0 Transmit complete Port 0 Receive message complete Port 1 Receive message complete Port 1 Receive character Port 1 Transmit complete Discrete PTO0 Pulse count complete Medium Priority...
Page 332
Program instructions 7.10 Interrupt Example 1: Input signal edge detector interrupt Network 1 MAIN On the first scan: LD SM0.1 Network 1 1. Define interrupt routine ATCH INT_0, 1 INT_0 to be a falling-edge interrupt for I0.0. 2. Globally enable interrupts. Network 2 Network 2 If an I/O error is detected, disa-...
Page 333
Program instructions 7.10 Interrupt Example 2: Timed interrupt for reading the value of an analog input Network 1 MAIN On the first scan, call subrou- LD SM0.1 Network 1 tine 0. CALL SBR_0 Network 1 SBR 0 Set the interval for the timed LD SM0.0 Network 1 interrupt 0 to 100 ms.
Program instructions 7.11 Logical operations 7.11 Logical operations 7.11.1 Invert LAD / FBD Description INVB OUT The Invert Byte, Invert Word, and Invert Double Word instructions form the one's INVW OUT complement of the input IN and load the result into the memory location OUT INVD OUT Non-fatal errors with ENO = 0 SM bits affected...
Program instructions 7.11 Logical operations 7.11.2 AND, OR, and exclusive OR LAD / FBD Description ANDB IN1, The AND Byte, AND Word, and AND Double Word instructions logically AND the corre- sponding bits of two input values IN1 and IN2 and load the result in a memory location ANDW IN1, assigned to OUT.
Page 337
Program instructions 7.11 Logical operations Example: AND, OR, and Exclusive OR instructions Network 1 LD I4.0 ANDW AC1, AC0 ORW AC1, VW100 XORW AC1, AC0 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Program instructions 7.12 Move 7.12 Move 7.12.1 Move byte, word, double word, or real LAD / FBD Description MOVB IN, OUT The Move Byte, Move Word, Move Double Word, and Move Real instructions move MOVW IN, OUT a data value from a source (constant or memory location) IN to a new memory MOVD IN, OUT location OUT, without changing the value stored in a source memory location.
Program instructions 7.12 Move 7.12.2 Block move LAD / FBD Description BMB IN, OUT, The Block Move Byte, Block Move Word, and Block Move Double Word instruc- tions move an assigned block of data values from a source memory location BMW IN, OUT, (starting address IN and successive addresses) to a new memory location (start- ing address OUT and successive addresses).
Program instructions 7.12 Move Example: Block Move instruction Network 1 Move (copy) data in source four byte LD I2.1 address sequence (VB20 to VB23) to BMB VB20, VB100, 4 destination four byte address se- quence (VB100 to VB103). Source data values Source data addresses VB20 VB21...
Program instructions 7.12 Move Example: Swap instructions Network 1 LD I2.1 SWAP VW50 Hexadecimal data values Data addresses VB50 VB51 If I2.1 = 1, then execute SWAP to exchange the byte data in a data word Hexadecimal data values Data addresses VB50 VB51 7.12.4...
Program instructions 7.13 Program control 7.13 Program control 7.13.1 FOR-NEXT loop LAD / FBD Description FOR INDX, The FOR instruction executes the instructions between the FOR and the NEXT INIT, FINAL instructions. You assign the index value or current loop count INDX, the starting loop count INIT, and the ending loop count FINAL.
Page 343
Program instructions 7.13 Program control Example: FOR-NEXT loop Network 1 When I2.0 is ON, the outside LD I2.0 loop (Network 1 - 4) is exe- FOR VW100, +1, cuted 100 times. +100 Network 2 The inside loop (Network 2 - LD I2.1 3) is executed twice for each FOR VW225, +1, +2...
Program instructions 7.13 Program control 7.13.2 JMP (jump to label) 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.
Program instructions 7.13 Program control 7.13.3 SCR (sequence control relay) SCR (Sequence Control Relay) instructions provide a simple yet powerful state control programming technique for a LAD, FBD, or STL program. Whenever an application consists of a sequence of operations that must be performed repetitively, you can use SCRs to structure the program so that it corresponds directly to your application.
Page 346
Program instructions 7.13 Program control Description LSCR S_bit The SCR instruction loads the SCR and logic stacks with the value of the S bit referenced by the instruction. The resulting value of the SCR stack either energizes or de-energizes the SCR stack.
Page 347
Program instructions 7.13 Program control S stack and logic stack interaction The figure shows the S stack and the logic stack and the effect of executing the Load SCR instruction. Controlling program flow with SCR segments The main program consists of instructions that execute sequentially once per scan of the PLC.
Page 348
Program instructions 7.13 Program control SCR operations ● SCR (Load SCR) marks the beginning of an SCR segment, and the SCRE (End SCR) marks the end of an SCR program segment. All logic between the SCR and the SCRE instructions is dependent upon the value of the S stack for its execution. Logic between SCRE and the next SCR instruction is not dependent on the value of the S stack.
Page 349
Program instructions 7.13 Program control Example: SCR sequential control flow In the following sample program, the first scan bit SM0.1, is used to set S0.1, which will be the active State 1 on the first scan. After a 2-second delay, T37 causes a transition to State 2.
Page 350
Program instructions 7.13 Program control Network 8 After a 25 second delay, transi- LD T38 tion to state 3. SCRT S0.3 Network 9 End of SCR region for state 2. SCRE Sequential control flow A process with a well-defined sequence of steps is easy to model with SCR segments. For example, consider a cyclical process, with 3 steps, that should return to the first step when the third has completed.
Page 351
Program instructions 7.13 Program control 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. Example: SCR divergent flow control Network 1 Beginning of state L control re- LSCR S3.4 gion...
Page 352
Program instructions 7.13 Program control Example: SCR convergent flow control Beginning of state L control region Network 1 LSCR S3.4 Network 2 Transition to State L' LD V100.5 SCRT S3.5 Network 3 End of SCR region for state L SCRE Network 4 Beginning of state M control re- LSCR S6.4...
Page 353
Program instructions 7.13 Program control Divergence of a control stream, depending on transition conditions In other situations, a control stream might be directed into one of several possible control streams, depending upon which transition condition becomes true first. Example: SCR divergent flow control, depending of transition conditions Network 1 Beginning of state L control region LSCR S3.4...
Program instructions 7.13 Program control 7.13.4 END, STOP, and WDR (watchdog timer reset) Description The conditional END instruction terminates the current scan based upon the condition of the preceding logic. You can use the conditional END instruction in the main program, but you cannot use it in either subroutines or interrupt routines.
Page 355
Program instructions 7.13 Program control Example: STOP, END, and WDR (Watchdog reset) instructions Network 1 When an I/O error is detected, LD SM5.0 force the transition to STOP STOP mode. Network 1 When M5.6 is ON, execute the LD SM5.6 watchdog reset instruction to extend the allowed scan time by 500 milliseconds.
Program instructions 7.13 Program control 7.13.5 GET_ERROR (Get non-fatal error code) LAD / FBD Description GERR ECODE The get non-fatal error code instruction stores the CPU's current non-fatal error code in the location assigned to ECODE. After the error code is stored, the non- fatal error code is cleared in the CPU.
Program instructions 7.14 Shift and rotate 7.14 Shift and rotate 7.14.1 Shift and rotate Shift instructions (only the byte size LAD box is illustrated, the others are similar) LAD / FBD Shift type Description SLB OUT, Shift left byte The shift instructions shift the bit values of input value IN right or left by the bit position shift count N and load the result in the memory location assigned to OUT.
Page 358
Program instructions 7.14 Shift and rotate Rotate instructions (only the byte size LAD box is illustrated, the others are similar) LAD / FBD Rotate type Description RLB OUT, Rotate left byte The rotate instructions rotate the bit values of input value IN right or left by the bit position rotate count N and load the result in the memory location assigned to OUT.
Page 359
Program instructions 7.14 Shift and rotate Example: Shift and Rotate instructions Network 1 LD I4.0 RRW AC0, 2 SLW VW200, 3 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Program instructions 7.14 Shift and rotate 7.14.2 Shift register bit The Shift Register Bit instruction shifts a bit value into the Shift Register. This instruction provides an easy method for sequencing and controlling product flow or data. Use this instruction to shift the entire register one bit, once per scan. LAD / FBD Description SHRB DATA,...
Page 361
Program instructions 7.14 Shift and rotate The following figure shows bit shifting for negative and positive values of N. A Shift Minus operation is indicated by a nega- tive value of length N. The input value of DATA shifts into the most significant bit of the shift reg- ister, and shifts out of the least significant bit location assigned by S_BIT.
Program instructions 7.15 String 7.15 String 7.15.1 String (Get length, copy, and concatenate) SLEN (String length) LAD / FBD Description SLEN IN, OUT The string length instruction returns the length in bytes of the string specified by Note: Because Chinese characters are not represented by a single byte, the STR_LEN function does not return the number of characters in a string contain- ing Chinese characters.
Page 363
Program instructions 7.15 String Error conditions with ENO = 0 SM bits affected None 0006H Indirect address • 0091H Operand out of range • Inputs/Outputs Data types Operands STRING VB, LB, *VD, *LD, *AC, Constant string STRING VB, LB, *VD, *LD, *AC Example: Concatenate string, copy string, and string length Instructions Network 1 1.
Program instructions 7.15 String 7.15.2 Copy substring from string LAD / FBD Description SSCPY IN, The copy substring from string instruction copies the assigned number of charac- INDX, N, OUT ters N from the string specified by IN, starting at the index INDX, to a new string assigned by OUT.
Program instructions 7.15 String 7.15.3 Find string and first character within string LAD / FBD Description SFND IN1, IN2, OUT STR_FIND searches for the first occurrence of the string IN2 within the string IN1. The search begins at the starting position assigned by the initial value of OUT (which must be in the range of 1 to the IN1 string length be- fore STR_FIND execution).
Page 366
Program instructions 7.15 String Example: Find string within string instruction A string stored at VB0 is used as a command for turning a pump on or off. A string "On" is stored at VB20 and a string "Off" is stored at VB30. The result of the find string within string instruction is stored in AC0 (the OUT parameter).
Page 367
Program instructions 7.15 String Example: Find character within string instruction A string stored at VB0 contains the temperature. The string constant at IN1 provides all the numeric characters (0-9, +, and -) that can identify a temperature number in a string. CHR_FIND execution finds the starting position of the character "9"...
Program instructions 7.16 Table 7.16 Table 7.16.1 Add to table LAD / FBD Description ATT DATA, The add to table instruction adds word values DATA to a table TBL. The first value in the table is the maximum table length TL. The second value is the entry count EC, which stores the number of entries in the table and is updated automatically.
Page 369
Program instructions 7.16 Table Example: Add to Table instruction Network 1 On the first scan only, load the maximum table LD SM0.1 length 6 to VW200. MOVW +6, VW200 Network 2 When I0.0 makes a transition to 1, add a third data LD I0.0 value (from VW100) to the table at VW200.
Program instructions 7.16 Table 7.16.2 First-in-first-out and last-in-first-out Table 7- 20 FIFO and LIFO instructions LAD / FBD Description FIFO TBL, DATA The first-in-first-out instruction moves the oldest (or first) entry in a table to an output memory address, by removing the first entry in the assigned table (TBL) and moving the value to the location assigned by DATA.
Program instructions 7.16 Table 7.16.3 Memory fill LAD / FBD Description FILL IN, OUT, The memory fill instruction writes N consecutive words, beginning at address OUT, with the word value contained in address IN. N has a range of 1 to 255. Non-fatal errors with ENO = 0 SM bits affected None...
Program instructions 7.16 Table 7.16.4 Table find LAD / FBD Description FND= TBL, PTN, The Table Find instruction searches a table for data that matches your search INDX criteria. The Table Find instruction searches the table TBL, starting with the FND<>...
Page 374
Program instructions 7.16 Table Differences in table formats for ATT, LIFO, FIFO, and TBL_FIND instructions Example: Table Find instruction Network 1 LD I2.1 FND= VW202, 16#3130, AC1 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 375
Program instructions 7.16 Table 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.
Page 376
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).
Program instructions 7.17 Timer 7.17 Timer 7.17.1 Timer instructions LAD / FBD Description TON Txxx, PT Use TON On-delay timers for a timing a single time interval. TONR Txxx, PT Use TONR On-delay retentive timers for accumulating the time value of many timed intervals.
Page 378
Program instructions 7.17 Timer Timer number and resolution options Timer type Resolution Maximum value Timer number TON, TOF 1 ms 32.767 s T32, T96 10 ms 327.67 s T33-T36, T97-T100 100 ms 3276.7 s T37-T63, T101-T255 TONR 1 ms 32.767 s T0, T64 10 ms 327.67 s...
Page 379
Program instructions 7.17 Timer TOF timer operation The TOF instruction is used to delay turning an output OFF for a fixed period of time after the input turns OFF. When the enabling input turns ON, the timer bit turns ON immediately, and the current value is set to 0.
Program instructions 7.17 Timer 7.17.2 Timer programming tips and examples 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 ●...
Page 381
Program instructions 7.17 Timer 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.
Page 382
Program instructions 7.17 Timer TON self-resetting On-delay timer example Network 1 10 ms timer T33 times out after 1 s LDN M0.0 (100 x 10 ms). TON T33, +100 M0.0 pulse is too fast to monitor with Status view. Network 2 The Compare contact becomes TRUE LDW>= T33, +40 at a rate that is visible in Status view.
Page 383
Program instructions 7.17 Timer TONR retentive On-delay timer example Network 1 10 ms TONR timer T1 times out at LD I0.0 PT = 1 s (100 x 10 ms). TONR T1, +100 Network 2 T1 bit is controlled by timer T1. LD T1 Q0.0 is ON after the timer accumulates = Q0.0...
Page 384
Program instructions 7.17 Timer TOF Off-delay timer example Network 1 10-ms timer T33 times out after 1 s LD I0.0 (100 x 10 ms). TOF T33, +100 I0.0 ON-to-OFF = T33 enabled • I0.0 OFF-to-ON=disable and reset • Network 2 Timer T33 controls Q0.0 through timer LD T33 contact T33.
Page 385
Program instructions 7.17 Timer Example: automatically retriggered One-shot timers The corrected examples use the normally closed contact Q0.0 instead of the timer bit as the timer enabling input. This ensures that output Q0.0 is turned ON for one scan cycle, each time a timer reaches the preset value.
Program instructions 7.17 Timer 100 ms timer Q0.0 is always turned ON for one scan whenever the timer’s current value reaches the preset value. 7.17.3 Interval timers LAD / FBD Description BITIM OUT The Begin interval time instruction reads the current value of the built-in 1 milli- second counter and stores the value in OUT.
Page 387
Program instructions 7.17 Timer Example: Begin and Calculate interval timers Network 1 Capture the time that Q0.0 LD Q0.0 turned ON. BITIM VD0 Ex1_Interval_time_net1 Network 2 Calculate the time Q0.0 has LD Q0.0 been ON. CITIM VD0, VD4 S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Program instructions 7.18 Subroutine 7.18 Subroutine 7.18.1 CALL (subroutine) and RET (conditional return) 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.
Page 389
Program instructions 7.18 Subroutine Error conditions with ENO = 0 SM bits affected None 0006H Indirect address • 008H Maximum subroutine nesting • exceeded Input / output Data type Operand SBR_n WORD Constant: 0-127 BOOL V, I, Q, M, SM, S, T, C, L, Power Flow (LAD), Logic flow (FBD) BYTE VB, IB, QB, MB, SMB, SB, LB, AC, *VD, *LD, *AC , Constant...
Page 390
Program instructions 7.18 Subroutine Variable table parameter types for a subroutine Parameter Description 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.
Page 391
Program instructions 7.18 Subroutine Example variable table Example: Subroutine call with call parameters STL only: Network 1 LD I0.0 CALL SBR_0, I0.1, VB10, I1.0, &VB100, *AC1, VD200 To display correctly in LAD and FBD: Network 1 LD I0.0 = L60.0 LD I0.1 = L63.7 LD L60.0...
Page 392
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.
Page 393
Program instructions 7.18 Subroutine Example: Subroutine call using string parameter This example copies a different string literal to a unique address depending upon the given input. The unique address of this string is saved. The string address is then passed to the subroutine by using an indirect address.
Page 394
Program instructions 7.18 Subroutine S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Communication 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 –...
Communication 8.1 CPU communication connections CPU communication connections The CPU supports the following maximum number of simultaneous, asynchronous communication connections: ● Ethernet programming port: – Open User Communication (OUC) connections: Eight active (client) connections and eight passive (server) connections to support S7-200 SMART CPUs or other Ethernet devices.
– STEP 7-Micro/WIN SMART programming when using a USB-PPI cable – TDs/HMI: RS485 type – Freeport (XMT/RCV) including Siemens-provided USS and Modbus RTU libraries ● PROFIBUS port: The S7-200 SMART CPUs can support two EM DP01 modules for PROFIBUS DP and HMI communication if your CPU model supports expansion modules.
Communication 8.3 HMIs and communication drivers 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 –...
Page 399
● 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: ●...
Communication 8.4 Ethernet 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).
Communication 8.4 Ethernet 8.4.3 Sample Ethernet network configurations You have three different types of communication options when using the S7-200 SMART CPU Ethernet network: ● Connecting a CPU to a programming device ● Connecting a CPU to an HMI ● Connecting a CPU to another S7-200 SMART CPU Programming device connected to the CPU HMI connected to the CPU A CPU connected to another CPU...
Communication 8.4 Ethernet 8.4.4 Assigning Internet Protocol (IP) addresses 8.4.4.1 Assigning IP addresses to programming and network devices If your programming device is using a network adapter card connected to your plant LAN (and possibly the World Wide Web), both the programming device and the CPU must exist on the same subnet.
Page 403
Communication 8.4 Ethernet 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: ●...
Communication 8.4 Ethernet 8.4.4.2 Configuring or changing an IP address for a CPU or device in your project You must enter the following IP information for each S7-200 SMART CPU that is attached to your Ethernet 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.
Page 405
Communication 8.4 Ethernet ● 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. Note A subnet mask of 255.255.255.0 is generally suitable for a local network.
Page 406
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) ●...
Page 407
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. ●...
Page 408
Communication 8.4 Ethernet ● Highlight a CPU, and then click "OK". To enter or change IP information, perform the following: ● Click the required CPU. ● If you need to identify which CPU to configure or change, click the "Flash Lights" button. This button flashes the STOP, RUN, and FAULT lights for the highlighted CPU in the list.
Page 409
Communication 8.4 Ethernet Configuring the IP information in the System Block dialog (static IP information) IP information configuration or changes done in the system block are part of the project and do not become active until you download your project to the CPU. To access this dialog, perform one of the following: •...
Page 410
Communication 8.4 Ethernet To enter or change IP information, perform the following: ● If not already checked, click the "IP address data is fixed to the values below and cannot be changed by other means" checkbox. The Ethernet port IP information fields are enabled.
Page 411
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.
Communication 8.4 Ethernet Configuring the IP information in the user program (dynamic IP information) The SIP_ADDR instruction sets the CPU’s IP address to the value found in its "ADDR" input, the CPU’s subnet mask to the value found in its "MASK" input, and the CPU’s gateway to the value found in its "GATE"...
Communication 8.4 Ethernet The IP address of a CPU is not associated with a STEP 7-Micro/WIN SMART project. Opening a STEP 7-Micro/WIN SMART project does not automatically select an IP address or establish a connection to a CPU. Every time you create a new or open an existing STEP 7-Micro/WIN SMART project, you must go to the Communications dialog to establish a connection to a CPU.
Page 414
Communication 8.4 Ethernet 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. ① MAC address S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Communication 8.4 Ethernet 8.4.6 HMI-to-CPU communication The CPU supports Ethernet communication connections to HMIs. 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.
Page 416
Communication 8.4 Ethernet To ensure that your CPU and HMI are communicating properly, follow the sequence of steps in the table below: Table 8- 1 Required steps in configuring communications between an HMI and a CPU Step Task Establishing the hardware communications connection An Ethernet interface establishes the physical connection between an HMI and a CPU.
Communication 8.4 Ethernet 8.4.7 Open user communication 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...
Communication 8.4 Ethernet 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.
Communication 8.4 Ethernet 8.4.7.3 Ports and TSAPs Ports and Transport Service Access Points (TSAPs) provide for the routing of messages to the proper receiver within the CPU or other device. 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.
Page 420
Communication 8.4 Ethernet 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;...
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.
Page 422
Communication 8.5 PROFIBUS In the figure below, the S7-200 SMART CPU is a DP device for an S7-1200 controller: 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.
Communication 8.5 PROFIBUS 8.5.1 EM DP01 PROFIBUS DP module 8.5.1.1 Distributed Peripheral (DP) standard communications PROFIBUS DP (or DP Standard) is a remote I/O communications protocol defined by the European Standard EN 50170. Devices that adhere to this standard are compatible even though they are manufactured by different companies.
Communication 8.5 PROFIBUS 8.5.1.2 Using the EM DP01 to connect an S7-200 SMART as a DP device You can connect the S7-200 SMART CPU to a PROFIBUS DP network through the EM DP01 PROFIBUS DP module. You connect the EM DP01 to the S7-200 SMART CPU as an expansion module, and you connect the PROFIBUS network to the EM DP01 PROFIBUS DP module through its DP communications port.
Page 425
Communication 8.5 PROFIBUS S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Communication 8.5 PROFIBUS 8.5.1.3 Configuring the EM DP01 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.
Communication 8.5 PROFIBUS 8.5.1.4 Data consistency PROFIBUS supports three types of data consistency: ● Byte: Ensures that bytes are transferred as whole units ● Word: Ensures that word transfers cannot be interrupted by other processes in the CPU. ● Buffer: Ensures that the entire buffer of data is transferred as a single unit, uninterrupted by any other process in the CPU.
Communication 8.5 PROFIBUS 8.5.1.5 Supported configurations The following table lists the configurations that are supported by the S7-200 SMART EM DP01 PROFIBUS DP module: Table 8- 2 EM DP01 PROFIBUS DP configuration options Configuration Inputs to master Outputs from master Data consistency Universal module Buffer consistency...
Communication 8.5 PROFIBUS 8.5.1.6 Installing the EM DP01 GSD file A PROFIBUS GSD file describes the DP device and its capabilities. The programmer uses the GSD file to configure the DP master. To install the EM DP01 GSD file, follow these steps: 1.
Page 430
Communication 8.5 PROFIBUS 7. This action installs the EM DP01 GSD file in the Hardware catalog as shown in the following figure: 8. Insert a CPU 315-2 DP, for example, as the DP master. 9. Insert the EM DP01 PROFIBUS DP module. 10.Create a PROFIBUS network between the DP master and device as shown in the figure above.
Communication 8.5 PROFIBUS 8.5.1.7 Configuring the EM DP01 I/O You can configure the EM DP01 I/O by using pre-configured or universal module I/O configuration selections. The EM DP01 configuration allows for two slots so that you can have more than 128 bytes of data transferred between the DP master and the S7-200 SMART CPU.
Page 432
Communication 8.5 PROFIBUS Universal module configuration In this example, slots one and two contain the "Universal module" I/O selection, and you can configure these two slots with the number of inputs and outputs your application requires (up to a maximum of 244 input bytes and 244 output bytes). In the "Properties", "General"...
Communication 8.5 PROFIBUS 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. 8.5.1.8 Example of V memory and I/O address area The following figure shows an example of the V memory in the S7-200 SMART CPU and the I/O address area of an S7-300 PROFIBUS DP master: In this example, the DP master has defined an I/O configuration consisting of two slots and a...
Page 434
DP master to recognize its DP devices and to write the required parameters and I/O configuration to each of its DP devices. 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.
Communication 8.5 PROFIBUS 8.5.1.9 User program considerations After a DP master successfully configures the EM DP01 PROFIBUS DP module, the EM DP01 and the DP master enter data exchange mode. In data exchange mode, the DP master writes output data to the EM DP01, and the EM DP01 then responds with the most recent S7-200 SMART CPU input data.
Page 436
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.
Communication 8.5 PROFIBUS 8.5.1.10 LED status indicators for the EM DP01 PROFIBUS DP The EM DP01 PROFIBUS DP module has four status LEDs on the front panel to indicate the operational state of the DP port: ● DIAG LED: – Dual color (red / green) LED indicates the operating state and fault status of the EM DP01 –...
Page 438
Communication 8.5 PROFIBUS The following table summarizes the status indications signified by the EM DP01 status LEDs: Table 8- 5 EM DP01 PROFIBUS DP module status LEDs Description POWER LED DIAG LED DP ERROR DX MODE LED (Green) (Dual Red / (Green) Green) (Red)
Communication 8.5 PROFIBUS 8.5.1.11 Using HMIs and S7-CPUs with the EM DP01 The EM DP01 PROFIBUS DP module can be used as a communications interface to MPI masters, whether or not it is being used as a PROFIBUS DP device. The EM DP01 can provide a connection from an S7-300/400 to the S7-200 SMART using the X_GET/X_PUT functions of the S7-300/400.
If your version of software does not include a configuration file for the EM DP01, you can access the latest GSD file (SIEM81C7.GSD) from Siemens Customer Support. If you are using a non-Siemens master device, refer to the documentation provided by the manufacturer on how to configure the master device by using the GSD file.
Page 441
Communication 8.5 PROFIBUS GSD file for the EM DP01 PROFIBUS-DP 6ES7288-7DP01-0AA0 Table 8- 6 General parameters Parameters Values #Profibus_DP GSD_Revision Vendor_Name = "Siemens" Model_Name = "EM DP01 PROFIBUS-DP" Revision = "V01.00.00" Ident_Number = 0x81C7 Protocol_Ident Station_Type FMS_supp Hardware_Release Software_Release = "V01.00.00"...
Page 445
Communication 8.5 PROFIBUS Table 8- 12 Example: Configuring DP communications to an S7-200 SMART CPU LAD/FBD Description Network 1: Calculate the Output LDB= SMB224, 2 data pointer. If in data MOVD &VB0, VD1000 exchange mode: ITD SMW226, AC0 1. Output buffer is an +D AC0, VD1000 offset from VB0.
Communication 8.6 RS485 LAD/FBD Description Network 3: Transfer Master out- LDB= SMB224, 2 puts to CPU outputs. BMB *VD1000, QB0, Copy CPU inputs to VB1008 the Master inputs. If in BMB IB0, *VD1004, data exchange mode: VB1009 1. Copy Master out- puts to CPU out- puts.
Communication 8.6 RS485 8.6.1 PPI protocol 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. Masters communicate to slaves by means of a shared connection which is managed by the PPI protocol.
Communication 8.6 RS485 8.6.2 Baud rate and network address 8.6.2.1 Definition of baud rate and network address 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.
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 398), you must configure the RS485 network address and baud rate for the S7-200 SMART CPU.
Page 450
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. S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Communication 8.6 RS485 8.6.3 Sample RS485 network configurations 8.6.3.1 Single-master PPI networks 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 Single-master PPI networks In the sample network in the figure below, a human-machine interface (HMI) device (for example, a TD400C, TP, or KP) is the network master: In the sample network, the CPU is a slave that responds to requests from the master.
Communication 8.6 RS485 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. 8.6.4 Assigning RS485 addresses 8.6.4.1...
Page 453
Communication 8.6 RS485 Configuring RS485 network information in the System Block dialog RS485 network information configuration or changes done in the system block are part of the project and do not become active until you download your project to the CPU. To access this dialog, perform one of the following: •...
Page 454
Communication 8.6 RS485 After completing the RS485 network configuration, download the project to the CPU. 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: ●...
Page 455
Communication 8.6 RS485 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.
Page 456
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: –...
Communication 8.6 RS485 8.6.4.2 Searching for CPUs and devices on your RS485 network You can search for and identify the S7-200 SMART CPUs that are attached to your RS485 network in the "Communications" dialog. To access this dialog, click one of the following: "Communications"...
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.
Communication 8.6 RS485 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. Isolation is required when you connect devices at different ground potentials.
Communication 8.6 RS485 8.6.5.4 Specifications for RS485 cable S7-200 SMART CPU networks use the RS485 standard on twisted pair cables. The following table lists the specifications for the network cable. You can connect up to 32 devices on a network segment. Specifications Description Cable type...
Page 461
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...
8.6 RS485 8.6.5.6 Biasing and terminating the network cable Siemens provides two types of network connectors that you can use to easily connect multiple devices to a network: ● Standard network connector ● Connector that includes a port which allows you to connect an HMI device to the network...
Communication 8.6 RS485 Table 8- 20 Termination and bias switch positions Switch position = On: Termination and biased Switch position = Off: No termination or bias ① Pin number ② Network connector ③ Cable shield 8.6.5.7 Biasing and terminating the CM01 signal board You can use the CM01 signal board to easily connect multiple devices to a network.
Using HMI devices on your RS485 network 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.
Communication 8.6 RS485 8.6.6 Freeport mode 8.6.6.1 Creating user-defined protocols with Freeport mode 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.
Page 466
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.
Page 467
Communication 8.6 RS485 Table 8- 22 Using Freeport mode Network configuration Description Using Freeport over an Example: Using an S7-200 SMART CPU with an RS232 connection electronic scale that has an RS232 port. Connect the two devices using one of the follow- •...
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.
Page 469
Communication 8.6 RS485 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.
Communication 8.7 RS232 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: ●...
Libraries 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 476), Open User Communication (Page 498), and USS protocol (Page 545)) ● User-defined (Page 563) (libraries that you create from project POUs or obtain from other...
Page 472
Ethernet port and do not support any functions related to the use of Ethernet communications. 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.
Libraries 9.2 Overview of Modbus communication Overview of Modbus communication STEP 7-Micro/WIN SMART and the S7-200 SMART CPUs make communicating to Modbus devices easier by including pre-configured subroutines and interrupt routines for Modbus RTU communication through the serial ports of the CPUs. 9.2.1 Modbus addressing Modbus addresses are five-to-six digit numbers that indicate the data type as well as the...
Page 474
Libraries 9.2 Overview of Modbus communication Mapping Modbus addresses to CPU addresses All Modbus addresses are one-based. Table 9- 1 Mapping Modbus addresses to CPU addresses Modbus address CPU address 00001 Q0.0 00002 Q0.1 00003 Q0.2 00255 Q31.6 00256 Q31.7 10001 I0.0 10002...
Libraries 9.2 Overview of Modbus communication 9.2.2 Modbus read and write functions The Modbus RTU master instructions utilize the Modbus functions shown below to read or write a specific Modbus address. The Modbus RTU slave device must support the appropriate Modbus function to read or write a particular Modbus address. Table 9- 2 Required Modbus slave function support Modbus address...
Modbus communication overview 9.3.1.1 Modbus RTU library features STEP 7-Micro/WIN SMART includes Siemens Modbus RTU libraries. The Modbus RTU libraries includes pre-configured subroutines and interrupt routines that make communicating to Modbus RTU master and slave devices easier. STEP 7-Micro/WIN SMART supports Modbus communication over RS-485 (integrated port 0 and optional signal board port 1) and RS-232 (optional signal board port 1 only) for both master and slave devices.
Libraries 9.3 Modbus RTU library 9.3.1.2 Requirements for using Modbus instructions Modbus RTU master protocol Modbus master instructions use the following resources from the CPU: ● MBUS_CTRL / MB_CTRL2 (Page 481) execution initializes the Modbus master protocol and dedicates the assigned CPU port (0 or 1) for Modbus master communication. When you use a CPU port for Modbus communications, you cannot use it for any other purpose, including communication with an HMI.
Libraries 9.3 Modbus RTU library Modbus RTU slave protocol Modbus slave protocol instructions use the following resources from the CPU: ● The MBUS_INIT instruction (Page 491) initializes the Modbus slave protocol and dedicates the assigned CPU port (0 or 1) for Modbus slave communication. When you use a CPU port for Modbus communication, you cannot use it for any other purpose, including communications with an HMI.
Libraries 9.3 Modbus RTU library ● 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.
Page 480
Libraries 9.3 Modbus RTU library 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.
Libraries 9.3 Modbus RTU library 9.3.2.2 MBUS_CTRL / MB_CTRL2 instruction (initialize master) MBUS_CTRL and MB_CTRL2 have identical behavior and parameters. MBUS_CTRL is for a single Modbus RTU master. MB_CTRL2 is for a second Modbus RTU master. Correspondingly, MBUS_MSG is for use with MBUS_CTRL and a single Modbus RTU master.
Page 482
Libraries 9.3 Modbus RTU library 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).
Libraries 9.3 Modbus RTU library 9.3.2.3 MBUS_MSG / MB_MSG2 instruction MBUS_MSG and MB_MSG2 have identical behavior and parameters. MBUS_MSG is for a single Modbus RTU master. MB_MSG2 is for a second Modbus RTU master. Table 9- 5 MBUS_MSG / MB_MSG2 instruction LAD / FBD Description CALL MBUS_MSG, First, Slave,...
Page 484
Libraries 9.3 Modbus RTU library 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.
Page 485
Libraries 9.3 Modbus RTU library 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.
Page 486
Libraries 9.3 Modbus RTU library The CPU reads and writes the bit data (addresses 0xxxx and 1xxxx) areas as packed bytes; that is, each byte consists of 8 bits of data. The least significant bit of the first data byte is the addressed bit number (the parameter Addr).
Libraries 9.3 Modbus RTU library 9.3.2.4 Modbus RTU master execution error codes The high numbered error codes (starting with 101) are errors that are returned by the Modbus slave device. These errors indicate that the slave does not support the requested function or that the requested address (either data type or range of addresses) is not supported by the Modbus slave device.
Page 488
Libraries 9.3 Modbus RTU library MBUS_MSG Description error code No error 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.
Libraries 9.3 Modbus RTU library 9.3.3 Modbus RTU slave 9.3.3.1 Using the Modbus RTU slave instructions 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.
Page 490
Libraries 9.3 Modbus RTU library 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 Read single/multiple coil (discrete output) status.
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.
Libraries 9.3 Modbus RTU library The Error output (Page 493) 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. Table 9- 12 Example program of S7-200 SMART CPU operating as a Modbus slave Network 1 Initialize the Modbus Slave protocol on LD SM0.1...
Libraries 9.3 Modbus RTU library 9.3.4 Modbus RTU master example program This example program shows how to use the Modbus Master instructions to write and read four holding registers to and from a Modbus slave each time input I0.0 turns on. The CPU writes four words starting at VW100 to the holding registers of the Modbus slave starting at address 40001.
Page 495
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. Table 9- 13 Example Modbus master program 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.
Libraries 9.3 Modbus RTU library Description 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.
Page 497
Libraries 9.3 Modbus RTU library 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.
Libraries 9.4 Open user communication library Open user communication library The STEP 7-Micro/WIN SMART Open User Communication (OUC) library instructions create the tables required by the OUC instructions (Page 217) (TCON, TSEND, TRECV, and TDCON). The library instructions build the table as needed, call the OUC instruction, and then present you the status values on the outputs of the library instruction.
Libraries 9.4 Open user communication library 9.4.1 Parameters common to the OUC library instructions The following parameters are common to the OUC library instructions: ● EN: You set the EN input to TRUE to call the instruction. You must set the EN input to TRUE until the instruction completes (until either Done or Error is set).
Page 500
Libraries 9.4 Open user communication library ● 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: –...
Libraries 9.4 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.
Page 502
Libraries 9.4 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.
Page 503
Libraries 9.4 Open user communication library 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.
Libraries 9.4 Open user communication library Example This is an example usage of the TCP_CONNECT instruction: 9.4.2.2 ISO_CONNECT instruction The ISO_CONNECT instruction creates a connection to another device using the ISO-on- TCP protocol. This protocol uses RFC1006 in addition to the TCP protocol to better delineate messages.
Page 505
Libraries 9.4 Open user communication library 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.
Page 506
Libraries 9.4 Open user communication library 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.
Page 507
Libraries 9.4 Open user communication library Example This is an example usage of the ISO_CONNECT instruction: STEP7-Micro/WIN SMART always uses pointers to pass a string to the ISO_CONNECT instruction for the RemTsap and the LocTsap. If you use a constant string (as in the example above), STEP7-Micro/WIN SMART automatically creates the string and the pointer.
Libraries 9.4 Open user communication library 9.4.2.3 UDP_CONNECT instruction The UDP_CONNECT instruction creates a passive connection using UDP protocol. UDP is a connectionless protocol so there is no actual connection created between this CPU and the remote device. The UDP connection opens the selected local port to use with UDP protocol. LAD/FBD Description UDP_CONNECT Req, ConnID,...
Page 509
Libraries 9.4 Open user communication library Table 9- 16 Parameters of the UDP_CONNECT instruction Parameter Declaration Data type Description BOOL Enable input BOOL The CPU starts the connect operation if Req = TRUE. If Req = FALSE, then the outputs show the current status of the connection.
Libraries 9.4 Open user communication library 9.4.2.4 TCP_SEND instruction The TCP_SEND instruction transmits the requested number of bytes (DataLen) from the requested buffer location (DataPtr) over the existing connection (ConnID). You use the instruction for both TCP protocol and for ISO-on-TCP protocol. LAD/FBD Description TCP_SEND Req, ConnID,...
Page 511
Libraries 9.4 Open user communication library 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.
Page 512
Libraries 9.4 Open user communication library 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.
Libraries 9.4 Open user communication library 9.4.2.5 TCP_RECV instruction The TCP_RECV instruction retrieves data over an existing connection. You use this instruction for both TCP protocol and ISO-on-TCP protocol. LAD/FBD Description TCP_RECV ConnID, MaxLen, The TCP_RECV retrieves data over an existing connection. DataPtr, Done, Busy, Er- ror, Status, Length The TCP_RECV instruction only has an EN (Enable) input.
Page 514
Libraries 9.4 Open user communication library 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.
Page 515
Libraries 9.4 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).
Libraries 9.4 Open user communication library Example This is an example usage of the TCP_RECV instruction: 9.4.2.6 UDP_SEND instruction The UDP_SEND instruction transmits the requested number of bytes (DataLen) from the requested buffer location (DataPtr) to the device specified by the IP address (IPaddr1 – IPaddr4) and port (RemPort).
Page 517
Libraries 9.4 Open user communication library 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.
Page 518
Libraries 9.4 Open user communication library Note that UDP messages are not guaranteed to be delivered. There is no error returned if the remote device is not present. Table 9- 19 Parameters of the UDP_SEND instruction Parameter Declaration Data type Description BOOL Enable input...
Libraries 9.4 Open user communication library Example This is an example usage of the UDP_SEND instruction: 9.4.2.7 UDP_RECV instruction The UDP_RECV instruction retrieves data over an existing connection. This instruction is used only for UDP protocol on connections created with UDP_CONNECT. LAD/FBD Description UDP_RECV ConnID, MaxLen,...
Page 520
Libraries 9.4 Open user communication library 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 ●...
Page 521
Libraries 9.4 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. Table 9- 20 Parameters of the UDP_RECV instruction Parameter...
Libraries 9.4 Open user communication library Example This is an example usage of the UDP_RECV instruction: 9.4.2.8 DISCONNECT instruction The DISCONNECT instruction terminates an existing communication connection. The DISCONNECT instruction is used for all protocols. LAD/FBD Description DISCONNECT ConnID, The DISCONNECT terminates an existing communication connec- LocPort, Done, Busy, Er- tion for all protocols.
Page 523
Libraries 9.4 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. Table 9- 21 Parameters of the DISCONNECT instruction Parameter Declaration Data type Description...
Libraries 9.4 Open user communication library 9.4.3 Open user communication library instruction error codes The following table lists the Open User Communication (OUC) library (Page 498) instruction error codes: Error code Description No error The data length input parameter is greater than the max- imum allowed (1024 bytes).
Libraries 9.4 Open user communication library Error code Description No connection resource is available. All connections of the requested type (active/passive) are in use. The local or remote port number is reserved or the port number is already in use for another server (passive) connection.
Libraries 9.4 Open user communication library 9.4.4.1 Active partner (client) This program implements a simple state machine to manage the creating of a connection, cyclically sending/receiving a message, and handling errors. The flow of this state machine is to connect, then repeatedly send and receive a message. If the connection is dropped, the state machine tries to reconnect.
Page 527
Libraries 9.4 Open user communication library Network 3: State "Connect"... Start the connection process. Network 4: Create an active connection to the passive device. The program only calls the TCP_CONNECT instruction one time in this state. Set the Req input to TRUE to start the connection process. Since this is the active side of the connection, the instruction sets the Active input to TRUE.
Page 528
Libraries 9.4 Open user communication library 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. Network 8: If Done is TRUE, this means that the CPU established the connection, so continue in the "Idle"...
Page 529
Libraries 9.4 Open user communication library Network 10: Capture the interval timer and then change to the "Idle Wait" state to delay until it is time to transmit again. Network 11: State "Idle Wait"... Stay in this state for the number of milliseconds specified (IdleTimeDelay). Network 12: Calculate the time since you entered the "Idle"...
Page 530
Libraries 9.4 Open user communication library 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"...
Page 531
Libraries 9.4 Open user communication library 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.
Page 532
Libraries 9.4 Open user communication library 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.
Page 533
Libraries 9.4 Open user communication library Network 27: Go to the "Idle" state in all situations. Network 28: State "Disconnect"... Initiate a disconnect. Network 29: Initiate the disconnect with the ConnID by calling the DISCONNECT instruction with Req = TRUE. Network 30: If Done is TRUE, this means that the disconnect is complete (probably will never happen), so go try to reconnect.
Page 534
Libraries 9.4 Open user communication library 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.
Libraries 9.4 Open user communication library 9.4.4.2 CheckErrors subroutine The CheckErrors subroutine checks the Open User Communication error codes and determines if the program requires a state change. You use the same CheckErrors subroutine for both the Active partner (client) and Passive partner (server). Network 1: The program malfunctioned if there is no error code.
Libraries 9.4 Open user communication library 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. 9.4.4.3 Active partner symbol table The table below lists the Symbol names, addresses, and comments for the Active partner (client) program.
Libraries 9.4 Open user communication library 9.4.4.4 Passive partner (server) This program implements a simple state machine to manage the opening of a connection, receiving a message, sending a response, and handling errors. The flow of this state machine is to connect, then repeatedly receive a message and send a response.
Page 538
Libraries 9.4 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.
Page 539
Libraries 9.4 Open user communication library 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. Network 8: If Done is TRUE, this means that the CPU established the connection so continue in the "Idle"...
Page 540
Libraries 9.4 Open user communication library 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. In all cases, exit the state machine for this scan.
Page 541
Libraries 9.4 Open user communication library Network 15: Send the data back to the partner. 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. If Busy is TRUE (this is the normal situation), go to the "Transmit Wait"...
Page 542
Libraries 9.4 Open user communication library 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.
Libraries 9.4 Open user communication library Network 23: State "Disconnect Wait"... Wait in this state for the disconnect operation to complete. Network 24: Call the DISCONNECT instruction with Req = FALSE to check the status of the disconnect operation. Network 25: If Done is TRUE, this means that the disconnect is complete, so try to reconnect on the next scan.
Libraries 9.4 Open user communication library 9.4.4.6 Passive partner symbol table The table below lists the Symbol names, addresses, and comments for the Passive partner (server) program. Symbol Address Comments Always_On SM0.0 Always ON First_Scan_On SM0.1 On for the first scan cycle only State SendBuffer VB1000...
Siemens designed the USS communications library for use with Siemens general purpose drives such as the Siemens Micromaster series. Siemens does not intend for the USS communications library to be used with special purpose drives such as the V90 servo drive.
You use the USS_INIT instruction to select either USS or PPI for port 0 or port 1. (USS refers to the USS protocol for Siemens drives.) When a port is set to use the USS protocol for communicating with drives, you cannot use the port for any other purpose, including communicating with an HMI.
Libraries 9.5 USS library 9.5.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: ●...
Libraries 9.5 USS library 9.5.2 USS program instructions 9.5.2.1 Using the USS protocol instructions 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.
CALL USS_INIT, Mode, Baud, The USS_INIT instruction is used to enable and initialize, Port, Active, Done, Error or to disable Siemens drive communications. Before any other USS instruction can be used, the USS_INIT instruc- tion must be executed without errors. The instruction completes and the "Done"...
Page 550
Libraries 9.5 USS library Table 9- 26 Format for the Active drive parameter This figure shows the description and format of the active drive input. Any drive that is marked as "Active" is automatically polled in the background to control the drive, collect status, and prevent serial link time-outs in the drive.
CALL USS_CTRL, RUN, OFF2, OFF3, The USS_CTRL instruction is used to control an F_ACK, DIR, Drive, Type, active Siemens drive. The USS_CTRL instruction Speed_SP, Resp_R, Error, Status, places the selected commands in a communications buffer, which is then sent to the addressed drive Speed, Run_EN, D_Dir, Inhibit, ("Drive"...
Page 552
Libraries 9.5 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: ●...
Page 553
Libraries 9.5 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" •...
Libraries 9.5 USS library 9.5.2.4 USS_RPM_x instruction Table 9- 31 USS_RPM_x instructions LAD / FBD Description CALL USS_RPM_W, XMIT_REQ, Drive, There are three read instructions for the USS protocol: Param, Index, DB_Ptr, Done, Er- USS_RPM_W instruction reads an unsigned word •...
Page 555
Libraries 9.5 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_RPM_x request is transmitted to the drive on each scan when the "XMT_REQ" input is on. Therefore, the "XMT_REQ"...
Page 556
Libraries 9.5 USS library USS_RPM_x and USS_WPM_x example program Table 9- 34 USS_RPM_x and USS_WPM_x example program Network 1 Network 1 LD M10.5 = L60.0 LD M10.5 = 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...
Libraries 9.5 USS library 9.5.2.5 USS_WPM_x instruction Table 9- 35 USS_WPM_x instructions LAD / FBD Description CALL USS_WPM_W, XMT_REQ, EEPROM, There are three write instructions for the USS protocol: Drive, Param, Index, Value, USS_WPM_W instruction writes an unsigned word • DB_Ptr, Done, Error parameter.
Page 558
Libraries 9.5 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"...
Page 559
Libraries 9.5 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...
Libraries 9.5 USS library Refer to "Using the USS protocol instructions" (Page 548) for and a listing of USS protocol instructions and error codes and example programs. 9.5.2.6 USS protocol execution error codes Table 9- 39 USS protocol execution error codes Error code Description No error...
Libraries 9.5 USS library 9.5.2.7 USS protocol example program Table 9- 40 Sample USS program 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...
Page 562
Libraries 9.5 USS library 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.
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.
Page 564
Libraries 9.6 Creating a user-defined library of instructions S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Debugging and troubleshooting 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 578) as a guide for determining the cause and possible solution when troubleshooting problems with the hardware.
Debugging and troubleshooting 10.1 Debugging your program 10.1.2 Cross reference table 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.
Page 567
Debugging and troubleshooting 10.2 Displaying program status Examples The following examples show the cross-reference table for a simple program in all three languages: LAD, FBD, and STL. Language Program Cross reference S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Debugging and troubleshooting 10.2 Displaying program status 10.2 Displaying program status 10.2.1 Displaying status in the program editor To display current data values and I/O status in the program editor, click the Program Status ON/OFF button from either the program editor toolbar or from the Debug menu ribbon strip Status data collection begins and shows the results of all logic operations during the...
Page 569
Debugging and troubleshooting 10.2 Displaying program status Example program status in an STL program When you start program status in STL, the program editor window is divided into a code region and a status region. You can customize the status region according to the types of values that you want to monitor.
Page 570
Debugging and troubleshooting 10.2 Displaying program status Example program status in the LAD program editor The example below shows status in the LAD program editor. The program editor displays the values of operands and indicates powerflow as each instruction executes during the execute program phase of a scan cycle.
Debugging and troubleshooting 10.2 Displaying program status 10.2.2 Configuring the STL status options To configure the STL program status display options, follow these steps: 1. Click the Options button from the Settings area of the Tools menu ribbon strip. 2. Under Options, click Program Editor > STL > Status. 3.
Debugging and troubleshooting 10.3 Using a status chart to monitor your program 10.3 Using a status chart to monitor your program In a status chart, you can enter addresses or defined symbol names to monitor or modify the status of program inputs, outputs, or variables by displaying the current values. The status chart also allows you to force or change the values of the process variables.
Page 573
Debugging and troubleshooting 10.3 Using a status chart to monitor your program Building a status chart To build a status chart, follow these steps: 1. Enter the address (or symbol name) for each desired value in the Address field. Symbol names must be names that you have already defined in the symbol table.
Debugging and troubleshooting 10.4 Forcing specific values 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.
Debugging and troubleshooting 10.5 Writing and forcing outputs in STOP mode You can use the status chart to force values. 1. To force a new value, enter the value in the New Value column of the Status Chart, then click the Force button on the status chart toolbar, or right-click in the New Value column and select "Force"...
Debugging and troubleshooting 10.6 How to execute a limited number of scans 10.6 How to execute a limited number of scans You can specify that the PLC execute your program for a limited number of scans (from 1 scan to 65,535 scans). By selecting the number of scans for the PLC to run, you can monitor the program as it changes the process variables.
Page 577
Debugging and troubleshooting 10.6 How to execute a limited number of scans See also Overview of debugging and monitoring features (Page 565) How to display status in the editor windows (Page 568) How to display status in a status chart (Page 572) How to download a program (Page 89) Timestamp mismatch error (Page 791) (ensuring that project in programming device matches project in PLC)
Debugging and troubleshooting 10.7 Hardware troubleshooting guide 10.7 Hardware troubleshooting guide Table 10- 1 Troubleshooting guide for the S7-200 SMART hardware Symptom Possible cause Possible solution Outputs stop working The device being controlled has When connecting to an inductive load caused an electrical surge that dam- (such as a motor or relay), a proper aged the output...
Page 579
Debugging and troubleshooting 10.7 Hardware troubleshooting guide Symptom Possible cause Possible solution Serial communications (RS-485 or RS- The communications cable can provide Refer to the wiring guidelines in • 232) are damaged when connecting to a path for unwanted currents if all non- Chapter 3 and to the network guide- an external device.
Page 580
Debugging and troubleshooting 10.7 Hardware troubleshooting guide S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
PID loops and tuning 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.
PID loops and tuning 11.1 PID loop definition table 11.1 PID loop definition table Eighty (80) bytes are allocated for the loop table from the starting address you enter for Table (TBL) in the PID instruction box. The PID instruction for the S7-200 SMART CPU references this loop table that contains the loop parameters.
Page 583
PID loops and tuning 11.1 PID loop definition table Offset Field Format Type Description Suggested Integral Time REAL Suggested integral time as determined by the auto-tune (AT_T process. Suggested Derivative REAL Suggested derivative time as determined by the auto- Time (AT_T tune process.
Page 584
PID loops and tuning 11.1 PID loop definition table Table 11- 2 Expanded description of control and status fields Field Description AT Control (ACNTL) Input - Byte Set to 1 to start auto-tune; set to 0 to abort auto-tune AT Status (ASTAT) Output - Byte Warning: The deviation setting is not four times greater than the hysteresis set- ting.
Page 585
PID loops and tuning 11.1 PID loop definition table Field Description AT Config (ACNFG) Input - Byte Dynamic response Fast response Medium response Slow response Very slow response Deviation setting: 0 - use deviation value from loop table 1 - determine deviation value automatically Hysteresis setting: 0 - use hysteresis value from loop table 1 - determine hysteresis value automatically...
PID loops and tuning 11.2 Prerequisites 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.
PID loops and tuning 11.4 Auto-tune 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.
Page 588
PID loops and tuning 11.4 Auto-tune 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.
PID loops and tuning 11.5 Exception conditions 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: ●...
PID loops and tuning 11.6 Notes concerning PV out-of-range (result code 3) 11.6 Notes concerning PV out-of-range (result code 3) The process variable is considered to be in-range by the auto-tuner if its value is greater than 0.0 and less than 1.0. If the PV is detected to be out-of-range during the auto-hysteresis sequence, then the tuning is immediately aborted with a process out-of-range error result.
Page 591
PID loops and tuning 11.7 PID Tune control panel STEP 7-Micro/WIN SMART opens the PID control panel if the connected CPU is in RUN mode: The PID control panel includes the following fields: ● Current values: The values of the SP (Setpoint), PV (Process Variable), OUT (Output), Sample Time, Gain, Integral time, and Derivative time are displayed.
Page 592
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.
Page 593
PID loops and tuning 11.7 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. In the figure below, the loop responds to a setpoint change with the original tuning parameters (before running auto-tune).
Page 594
PID loops and tuning 11.7 PID Tune control panel 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.
Open loop motion control 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.) ●...
Open loop motion control 12.1 Using the PWM output 12.1 Using the PWM output PWM provides a fixed cycle time output with a variable duty cycle. The PWM output runs continuously after being started at the specified frequency (cycle time). The pulse width is varied as required to affect the desired control.
Page 597
Open loop motion control 12.1 Using the PWM output Use one of the following methods to open the PWM wizard: ● Click the "PWM" button from the Wizards area of the Tools menu. ● Open the Wizards folder in the project tree and double-click "PWM", or select "PWM" and press the Enter key.
Open loop motion control 12.1 Using the PWM output 12.1.2 PWMx_RUN subroutine To simplify the use of Pulse Width Modulation (PWM) control in your application, STEP 7-Micro/WIN SMART provides a PWM wizard (Page 596) to configure your on-board PWM generators and control the duty cycle of a PWM output. The PWMx_RUN subroutine is used to execute PWM under program control.
Open loop motion control 12.2 Using motion control 12.2 Using motion control The motion control built into the CPU uses an Axis of Motion to control both the speed and motion of a stepper motor or a servo motor. Using the Axis of Motion requires expertise in the field of motion control. This chapter is not meant to educate the novice in this subject.
Open loop motion control 12.2 Using motion control 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.
Open loop motion control 12.2 Using motion control Specify the following times in milliseconds: ● ACCEL_TIME: Time required for the motor to accelerate from SS_SPEED to MAX_SPEED. Default = 1000 ms ● DECEL_TIME: Time required for the motor to decelerate from MAX_SPEED to SS_SPEED.
Page 602
Open loop motion control 12.2 Using motion control Selecting the mode of operation for the profile You configure the profile according to the mode of operation desired. The Axis of Motion supports absolute position, relative position, single-speed continuous rotation, and two- speed continuous rotation.
Page 603
Open loop motion control 12.2 Using motion control Mode selections for the Axis of Motion Two-Speed, Continuous Rotation, with triggered stop Creating the steps of the profile A step is a fixed distance that a tool moves, including the distance covered during acceleration and deceleration times.
Open loop motion control 12.3 Features of motion control 12.3 Features of motion control Motion control provides the functionality and performance that you need for open-loop position control in up to three Axes of Motion: ● Provides high-speed control, with a range from 20 pulses per second up to 100,000 pulses per second ●...
Page 605
Open loop motion control 12.3 Features of motion control 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.
Open loop motion control 12.4 Programming an Axis of Motion 12.4 Programming an Axis of Motion STEP 7-Micro/WIN SMART provides easy-to-use tools for configuring and programming the Axis of Motion. Simply follow these steps: 1. Configure the Axis of Motion: STEP 7-Micro/WIN SMART provides a Motion wizard for creating the configuration/profile table and the position instructions.
Open loop motion control 12.5 Configuring an Axis of Motion 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.
Page 608
Open loop motion control 12.5 Configuring an Axis of Motion Configuring the input pin locations You can program inputs related to motion control, to include STP, LMT-, LMT+, RPS, TRIG, and ZP, with a configuration in SDB0. Table 12- 5 STP, RPS, LMT+, LMT-, TRIG, and ZP pin locations Pin definition for inputs Description...
Page 609
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. Mapping the I/O STEP 7-Micro/WIN SMART enforces a fixed output assignment for PWM and Axis of Motion.
Page 610
Open loop motion control 12.5 Configuring an Axis of Motion Editing default input and output configuration To change or view the default configuration of the integrated inputs/outputs select the required input/output node: ● In the "Active level" field, use the dropdown list to select the active level (High or Low). When the level is set to High, a logic 1 is read when current is flowing in the input.
Page 611
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.
Page 612
Open loop motion control 12.5 Configuring an Axis of Motion ● 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.
Page 613
Open loop motion control 12.5 Configuring an Axis of Motion ● AB quadrature phase (2 output): P0 leads P1 for a negative direction. P1 leads P0 for a positive direction. This is shown in the figure below: AB quadrature phase (2 output) (Negative polarity): positive rotation (Negative polarity): negative rotation P1 leads P0...
Page 614
Open loop motion control 12.5 Configuring an Axis of Motion Entering jog parameters Enter the JOG_SPEED and the JOG_INCREMENT values: ● JOG_SPEED: The JOG_SPEED (Jog speed for the motor) is the maximum speed that can be obtained while the JOG command remains active. ●...
Page 615
Open loop motion control 12.5 Configuring an Axis of Motion Entering jerk time Available on certain types of moves, jerk compensation provides smoother position control by reducing the jerk (rate of change) in the acceleration and deceleration parts of the motion profile.
Page 616
Open loop motion control 12.5 Configuring an Axis of Motion Configuring reference point and seek parameters 1. Select using a reference point or not using a reference point for your application: – If your application requires that movements start from or be referenced to an absolute position, you must establish a reference point (RP) or zero position that fixes the position measurements to a known point on the physical system.
Page 617
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.
Page 618
Open loop motion control 12.5 Configuring an Axis of Motion Defining the motion profile 1. In the motion profile definition screen, click the new profile button to enable defining the profile. 2. Choose the desired mode of operation: – For an absolute position profile: Fill in the target speed and the ending position.
Page 619
Open loop motion control 12.5 Configuring an Axis of Motion Finishing the configuration 1. After you have configured the operation of the Axis of Motion, you simply click "Generate". The Motion wizard performs the following tasks: – Inserts the axis configuration and profile table into the system block and data block for your CPU program –...
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 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.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 12.6.1 Guidelines for using the Motion subroutines You must ensure that only one motion subroutine is active at a time. You can execute the AXISx_RUN and AXISx_GOTO from an interrupt routine as long as the interrupt is called cyclically.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 12.6.2 AXISx_CTRL subroutine Table 12- 6 AXISx_CTRL LAD / FBD Description CALL AXISx_CTRL, The AXISx_CTRL subroutine (Control) enables and initializes the Axis MOD_EN, Done, Error, of Motion by automatically commanding the Axis of Motion to load the C_Pos, C_Speed, configuration/profile table each time the CPU changes to RUN mode.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion The C_Dir parameter indicates the current direction of the motor: ● Signal state of 0 = positive ● Signal state of 1 = negative Note The Axis of Motion reads the configuration/profile table only at power-up or when commanded to load the configuration.
Page 624
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion Table 12- 9 Parameters for the AXISx_MAN subroutine Inputs/Outputs Data type Operands RUN, JOG_P, BOOL I, Q, V, M, SM, S, T, C, L, Power Flow JOG_N Speed DINT, REAL...
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 12.6.4 AXISx_GOTO subroutine Table 12- 10 AXISx_GOTO LAD / FBD Description CALL AXISx_GOTO, The AXISx_GOTO subroutine commands the Axis of Motion to go to a START, Pos, Speed, desired location.
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 659) contains the result of this subroutine.
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.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 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.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 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.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 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).
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 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 659) contains the result of this subroutine.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 12.6.11 AXISx_CFG subroutine Table 12- 24 AXISx_CFG LAD / FBD Description CALL AXISx_CFG, The AXISx_CFG subroutine (Reload Configuration) commands the Axis START, Done, Error of Motion to read the configuration block from the location specified by the configuration/profile table pointer.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 12.6.12 AXISx_CACHE subroutine Table 12- 26 AXISx_CACHE LAD / FBD Description CALL AXISx_CACHE, The AXISx_CACHE subroutine (Cache Profile) commands a caching of START, Profile, a motion profile before the profile is executed.
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 12.6.13 AXISx_RDPOS subroutine Table 12- 28 AXISx_RDPOS LAD / FBD Description CALL AXISx_RDPOS, The AXISx_RDPOS subroutine returns the current motion axis position. Error, I_Pos Table 12- 29 Parameters for the AXISx_RDPOS subroutine Inputs/Outputs Data type...
The AXISx_ABSPOS subroutine reads the absolute position from cer- START, RDY, INP, tain Siemens servo drives, such as the V90. You read the absolute Res, Drive, Port, position value in order to update the current position value in the Axis of Done, Error, D_Pos Motion.
Page 636
Open loop motion control 12.6 Subroutines created by the Motion wizard for the Axis of Motion 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.
Open loop motion control 12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive 12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive The following sections provide information about how to use the AXISx_ABSPOS subroutine in your project to read the absolute position from a SINAMICS V90 servo drive.
Open loop motion control 12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive Network 2: When the operation is LD V600.0 done, capture the error code and also capture AB= VB601, 0 the servo position, if no MOVD VD602, error.
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 12.7.3.1 Control mode "PTI" mode is the drive control mode setting that allows movement speed and distance to be controlled from an external pulse train.
Page 640
Open loop motion control 12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive 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: Electronic gearing In the V90 servo drive, the "a"...
Page 641
Open loop motion control 12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive Measurement system settings in the Motion wizard When using the STEP 7-Micro/WIN SMART Motion wizard to configure the measurement system for a CPU Axis of Motion, you must assign the three conversion settings: ●...
Open loop motion control 12.7 Using the AXISx_ABSPOS subroutine to read the absolute position from a SINAMICS servo drive Setting 3: "One motor revolution produces how many "xxx" of motion?" This setting defines the relationship between motor revolutions and load movement in the defined engineering unit (for example, cm and degrees).
Open loop motion control 12.8 Axis of Motion example programs 12.8 Axis of Motion example programs 12.8.1 Axis of Motion simple relative move (cut-to-length application) example The example program shows a simple relative move that uses the AXISx_CTRL and AXISx_GOTO subroutines to perform a cut-to-length operation. This program does not require an RP seek mode or a motion profile, and the length can be measured in either pulses or engineering units.
Page 644
Open loop motion control 12.8 Axis of Motion example programs LAD/FBD Description LD Q0.2 Network 4: 1. Move to a certain point: = L60.0 2. Enter the length to cut. LD M0.1 3. Enter the target speed into Speed. = L63.7 4.
Open loop motion control 12.8 Axis of Motion example programs 12.8.2 Axis of Motion AXISx_CTRL, AXISx_RUN, AXISx_SEEK, and AXISx_MAN example This program provides an example of the AXISx_CTRL, AXISx_RUN, AXISx_RSEEK, and AXISx_MAN subroutines. You must configure the RP seek mode and a motion profile. Table 12- 34 Example: Axis of Motion AXISx_CTRL, AXISx_RUN, AXISx_SEEK, and AXISx_MAN subroutines application LAD/FBD Description...
Page 646
Open loop motion control 12.8 Axis of Motion example programs LAD/FBD Description LD CPU_Input0 Network 4 Start the process. When CPU_Input0 is toggled from S M0.0, 2 off to on, the State_Machine_Step is set MOVB 1, to "1". State_Machine_ Step Symbol and Address: CPU_Input0 = I0.0 •...
Page 647
Open loop motion control 12.8 Axis of Motion example programs LAD/FBD Description LD Always_On Network 8 When the State Machine = L60.0 enters Step 2, it executes a LDB= move of the selected profile. State_Machine_ Step, 2 Symbol and Address: Always_On = SM0.0 •...
Page 648
Open loop motion control 12.8 Axis of Motion example programs LAD/FBD Description LDB= Network 10 Wait for Step 3. State_Machine_ Step, 3 Symbol and Address: TON T33, 200 State_Machine_Step = • VB1500 LDB= Network 11 If the State Machine moves State_Machine_ to Step 3, wait for 2 s.
Open loop motion control 12.9 Monitoring the Axis of Motion LAD/FBD Description LDB= Network 14 If the State Machine is in State_Machine_ Step 4, you must Step, 4 acknowledge the error by toggling Input I0.2. This A CPU_Input2 action resets the state to MOVB 0, Step 0.
Page 650
Open loop motion control 12.9 Monitoring the Axis of Motion 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.) The Axis of Motion Operation (Page 651), Configuration (Page 656), and Profile Configuration (Page 656) 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.
Open loop motion control 12.9 Monitoring the Axis of Motion 12.9.1 Displaying and controlling the operation of the Axis of Motion In the Operation node, you can interact with the operations of the Axis of Motion. The control panel displays the current speed, the current position, and the current direction of the Axis of Motion.
Page 652
Open loop motion control 12.9 Monitoring the Axis of Motion Motion commands You can also generate the following motion commands: Table 12- 35 Motion control panel commands Command Description Execute continuous speed move: This command allows you to use the manual controls for positioning the tool. Enter "Target Speed"...
Page 653
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.
Page 654
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. Load axis configuration: This command loads a new config- uration by commanding the Axis of Motion to read the con- figuration block from the V memory of the CPU.
Page 655
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"...
Open loop motion control 12.9 Monitoring the Axis of Motion 12.9.2 Displaying and modifying the configuration of the Axis of Motion In the Configuration node, you can view and modify the configuration settings for the Axis of Motion that is stored in the data block of the CPU. After you modify the configuration settings, you simply click the write button to send the data values to the CPU.
Page 657
Open loop motion control 12.9 Monitoring the Axis of Motion 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.
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) Table 12- 36 Axis of Motion error codes Error code Description No error Reserved Configuration block not present Configuration block pointer error Size of configuration block exceeds available V memory Illegal configuration block format...
Open loop motion control 12.9 Monitoring the Axis of Motion Error code Description No ZP input defined (If Homing mode 3 or 4 is defined, then ZP must be defined also.) Phase A (P0) output conflict Phase B (P1) output conflict DIS output conflict Reserved Invalid SDB0 record size...
Page 660
Open loop motion control 12.9 Monitoring the Axis of Motion Error code Description Illegal distance RPS/TRIG trigger occurred before target speed reached Insufficient RPS active region width Speed out-of-range Insufficient distance to perform desired speed change Illegal position Zero position unknown No DIS output is defined Reserved Aborted due to CPU going to stop...
Open loop motion control 12.10 Advanced topics 12.10 Advanced topics 12.10.1 Understanding the configuration/profile table for the Axis of Motion 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.
Page 662
Open loop motion control 12.10 Advanced topics Table 12- 38 Configuration/Profile table: Configuration block Configuration/Profile table Byte off- Name Function description Type Configuration block MOD_ID Axis of Motion identification field CB_LEN Length of the configuration block in bytes (1 byte) IB_LEN Length of the interactive block in bytes (1 byte) PF_LEN...
Page 663
Open loop motion control 12.10 Advanced topics Configuration/Profile table Byte off- Name Function description Type Configuration block Reserved: Set to 0 PLS/REV Specifies the number of pulses per revolution of the DInt motor, (only applicable when MEAS_SYS is set to 1) - (4 bytes) UNITS/REV Specifies the engineering units per revolution of the...
Page 664
Open loop motion control 12.10 Advanced topics Configuration/Profile table Byte off- Name Function description Type Configuration block 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) SS_SPEED Start/Stop Speed.
Page 665
Open loop motion control 12.10 Advanced topics Table 12- 39 Configuration/Profile table: Interactive block Configuration/Profile table Byte offset Name Function description Type Interactive block MOVE_CMD Selects the mode of operation (1 byte): 0: Absolute position • 1: Relative position • 2: Single-speed, continuous positive rotation •...
Page 666
Open loop motion control 12.10 Advanced topics Table 12- 40 Configuration/Profile table: Profile block 0 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 •...
Page 667
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. Table 12- 41 Configuration/Profile table: Profile block 1 Configuration/Profile table Byte offset Name Function description Type Profile block 1 STEPS Number of steps in this move sequence (1 byte) Note: There can be up to 16 steps.
Page 668
Open loop motion control 12.10 Advanced topics Table 12- 43 Profile detail for Mode 1 (Relative position) Byte offset Step Name Field size Value from start of number profile STEPS byte n = Number of steps configured in this profile MODE byte 0 = Relative position...
Page 669
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) Byte offset Step Name Field size Value from start of number profile STEPS byte MODE byte...
Open loop motion control 12.10 Advanced topics 12.10.2 Special memory (SM) locations for the Axis of Motion The CPU allocates 50 bytes of special memory (SM) to each Axis of Motion. (See the following table.) When the Axis of Motion detects an error condition or a change in status of the data, the Axis of Motion updates these SM locations.
Page 671
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...
Page 672
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 OR (Target speed out of range): • –...
Open loop motion control 12.11 Understanding the RP Seek modes of the Axis of Motion 12.11 Understanding the RP Seek modes of the Axis of Motion The following figures provide diagrams of the different options for each RP Seek mode: ●...
Page 674
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 Default configuration: RP seek direction: positive and RP approach direction: positive ①...
Page 675
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 Default configuration: RP seek direction: positive and RP approach direction: positive ①...
Page 676
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 Default configuration: RP seek direction: positive and RP approach direction: positive ①...
Page 677
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 Default configuration: RP seek direction: positive and RP approach direction: positive ①...
Open loop motion control 12.11 Understanding the RP Seek modes of the Axis of Motion 12.11.1 Selecting the work zone location to eliminate backlash The following figure shows the work zone in relationship to the reference point (RP), the RPS Active zone, and the limit switches (LMT+ and LMT-) for an approach direction that eliminates the backlash.
– 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...
Page 680
Technical specifications A.1 General specifications Industrial environments The S7-200 SMART automation system is designed for use in industrial environments. Table A- 1 Industrial environments Application field Noise emission requirements Noise immunity requirements Industrial EN 61000-6-4: EN 61000-6-2: 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.
Page 681
Technical specifications A.1 General specifications Environmental conditions Table A- 4 Transport and storage Environmental conditions - Transport and storage EN 60068-2-2, Test Bb, Dry heat and -40 °C to +70 °C EN 60068-2-1, Test Ab, Cold EN 60068-2-30, Test Db, Damp heat 25 °C to 55 °C, 95% humidity EN 60068-2-14, Test Na, temperature shock -40 °C to +70 °C, dwell time 3 hours, 2 cycles...
Page 682
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. Contamination level/overvoltage category according to IEC 61131-2 ●...
Page 683
Technical specifications A.1 General specifications Rated voltages Table A- 7 Rated voltages Rated voltage Tolerance 24 V DC 20.4 V DC to 28.8 V DC 120/240 V AC 85 V AC to 264 V AC, 47 to 63 Hz Note When a mechanical contact turns on output power to the S7-200 SMART CPU, or any digital expansion module, it sends a "1"...
Page 684
Technical specifications A.1 General specifications Relay electrical service life The typical performance data supplied by relay vendors is shown below. Actual performance may vary depending upon your specific application. An external protection circuit that is adapted to the load will enhance the service life of the contacts. ①...
Technical specifications A.2 S7-200 SMART CPUs S7-200 SMART CPUs A.2.1 CPU ST20, CPU SR20, and CPU CR20s A.2.1.1 General specifications and features General specifications and features of the CPU ST20, CPU SR20, and CPU CR20s Table A- 8 General specifications Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay...
Page 686
Technical specifications A.2 S7-200 SMART CPUs Table A- 9 CPU features 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 memory User data (V) 8 Kbytes 8 Kbytes 8 Kbytes Retentive 10 Kbytes max.
Page 687
Technical specifications A.2 S7-200 SMART CPUs Table A- 10 Performance Type of instruction Execution speed Boolean 150 ns instruction Move Word 1.2 μs/instruction Real math 3.6 μs/instruction Table A- 11 User program elements supported Element Description POUs Type/quantity Main program: 1 Subroutines: 128 (0 to 127) Interrupt routines: 128 (0 to 127) Nesting depth...
Page 688
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 Ethernet: Transformer Ethernet: Transformer Ethernet: Not available to PLC logic) isolated, 1500 V AC isolated, 1500 V AC RS485: None RS485: none RS485: none Cable type...
Technical specifications A.2 S7-200 SMART CPUs A.2.1.2 Digital inputs and outputs Table A- 15 Digital inputs Technical data CPU ST20 DC/DC/DC CPU SR20 AC/DC/Relay CPU CR20s AC/DC/Relay Number of inputs 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)
Page 690
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 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, •...
Page 691
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 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.
Technical specifications A.2 S7-200 SMART CPUs A.2.1.3 Wiring diagrams Table A- 17 Wiring diagram for the CPU ST20 DC/DC/DC (6ES7288-1ST20-0AA0) CPU ST20 DC/DC/DC (6ES7288-1ST20-0AA0) ① 24 V DC Sensor Power Table A- 18 Connector pin locations for CPU ST20 DC/DC/DC (6ES7288-1ST20-0AA0) DI a.7 DI a.0 DI b.0...
Page 693
Technical specifications A.2 S7-200 SMART CPUs Table A- 19 Wiring diagram for the CPU SR20 AC/DC/Relay (6ES7288-1SR20-0AA0) CPU SR20 AC/DC/Relay (6ES7288-1SR20-0AA0) ① 24 V DC sensor power output Table A- 20 Connector pin locations for CPU SR20 AC/DC/Relay (6ES7288-1SR20-0AA0) DI a.7 DI a.0 DI b.0 DQ a.0...
Page 694
Technical specifications A.2 S7-200 SMART CPUs Table A- 21 Wiring diagram for the CPU CR20s AC/DC/Relay (6ES7288-1CR20-0AA1) CPU CR20s AC/DC/Relay (6ES7288-1CR20-0AA1) IN WORK Table A- 22 Connector pin locations for CPU CR20s AC/DC/Relay (6ES7288-1CR20-0AA1) DI a.7 DI a.0 DI b.0 DQ a.0 DI a.1 DI b.1...
Technical specifications A.2 S7-200 SMART CPUs A.2.2 CPU ST30, CPU SR30, and CPU CR30s A.2.2.1 General specifications and features General specifications and features of the CPU ST30, CPU SR30 and CPU CR30s Table A- 23 General specifications Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay Article number...
Page 696
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 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...
Page 697
Technical specifications A.2 S7-200 SMART CPUs Table A- 27 Communication Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay Number of ports Ethernet: 1 Ethernet: 1 Ethernet: 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...
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 (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 20 ms at 24 V DC 30 ms at 120 V AC...
Page 699
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 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):...
Page 700
Technical specifications A.2 S7-200 SMART CPUs Table A- 31 Digital outputs Technical data CPU ST30 DC/DC/DC CPU SR30 AC/DC/Relay CPU CR30s AC/DC/Relay Number of outputs 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 Logic 1 signal at max.
Technical specifications A.2 S7-200 SMART CPUs A.2.2.3 Wiring diagrams Table A- 32 Wiring diagram for the CPU ST30 DC/DC/DC (6ES7288-1ST30-0AA0) CPU ST30 DC/DC/DC (6ES7288-1ST30-0AA0) ① 24 V DC Sensor Power Table A- 33 Connector pin locations for CPU ST30 DC/DC/DC (6ES7288-1ST30-0AA0) DI a.7 DQ a.6 DI a.0...
Page 702
Technical specifications A.2 S7-200 SMART CPUs Table A- 34 Wiring diagram for the CPU SR30 AC/DC/Relay (6ES7288-1SR30-0AA0) CPU SR30 AC/DC/Relay (6ES7288-1SR30-0AA0) ① 24 V DC Sensor Power Table A- 35 Connector pin locations for CPU SR30 AC/DC/Relay (6ES7288-1SR30-0AA0) DI a.7 DQ a.6 DI a.0 DI b.0...
Page 703
Technical specifications A.2 S7-200 SMART CPUs Table A- 36 Wiring diagram for the CPU CR30s AC/DC/Relay (6ES7288-1CR30-0AA1) CPU CR30s AC/DC/Relay (6ES7288-1CR30-0AA1) Table A- 37 Connector pin locations for CPU CR30s AC/DC/Relay (6ES7288-1CR30-0AA1) DI a.7 DQ a.6 DI a.0 DI b.0 DQ a.0 DQ a.7 DI a.1...
Technical specifications A.2 S7-200 SMART CPUs A.2.3 CPU ST40, CPU SR40, and CPU CR40s A.2.3.1 General specifications and features General specifications and features of the CPU ST40, CPU SR40, and CPU CR40s Table A- 38 General specifications Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s AC/DC/Relay Article number...
Page 705
Technical specifications A.2 S7-200 SMART CPUs Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s AC/DC/Relay Expansion modules ex- 6 max. 6 max. Not available pansion Signal board expansion 1 max. 1 max. Not available High- Total speed Single phase 4 at 200 kHz 4 at 200 kHz 4 at 100 kHz...
Page 706
Technical specifications A.2 S7-200 SMART CPUs Table A- 42 Communication Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s AC/DC/Relay Number of ports Ethernet: 1 Ethernet: 1 Ethernet: 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...
Page 707
Technical specifications A.2 S7-200 SMART CPUs Table A- 43 Power supply Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s 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...
Technical specifications A.2 S7-200 SMART CPUs A.2.3.2 Digital inputs and outputs Table A- 45 Digital inputs Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s AC/DC/Relay Number of inputs Type Sink/Source (IEC Type 1 sink, Sink/Source (IEC Type 1 Sink/Source (IEC Type 1 except I0.0 to I0.3) sink)
Page 709
Technical specifications A.2 S7-200 SMART CPUs Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s AC/DC/Relay Number of inputs on sim- 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 •...
Page 710
Technical specifications A.2 S7-200 SMART CPUs Technical data CPU ST40 DC/DC/DC CPU SR40 AC/DC/Relay CPU CR40s AC/DC/Relay 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.
Technical specifications A.2 S7-200 SMART CPUs A.2.3.3 Wiring diagrams Table A- 47 Wiring diagram for the CPU ST40 DC/DC/DC (6ES7288-1ST40-0AA0) ① 24 V DC Sensor Power Table A- 48 Connector pin locations for CPU ST40 DC/DC/DC (6ES7288-1ST40-0AA0) DI a.7 DI a.0 DI b.0 DQ b.0 DI a.1...
Page 712
Technical specifications A.2 S7-200 SMART CPUs Table A- 49 Wiring diagram for the CPU SR40 AC/DC/Relay (6ES7288-1SR40-0AA0) ① 24 V DC Sensor Power Table A- 50 Connector pin locations for CPU SR40 AC/DC/Relay (6ES7288-1SR40-0AA0) DI a.7 DQ b.0 DI a.0 DI b.0 DQ a.0 DQ b.1...
Page 713
Technical specifications A.2 S7-200 SMART CPUs N / 120 - 240 V AC Functional Earth Table A- 51 Wiring diagram for the CPU CR40s AC/DC/Relay (6ES7288-1CR40s-0AA1) Table A- 52 Connector pin locations for CPU CR40s AC/DC/Relay (6ES7288-1CR40-0AA1) DI a.7 DQ b.0 DI a.0 DI b.0 DQ a.0...
Technical specifications A.2 S7-200 SMART CPUs M / 24 V DC Functional Earth A.2.4 CPU ST60, CPU SR60, and CPU CR60s A.2.4.1 General specifications and features Table A- 53 General specifications Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s AC/DC/Relay Article number 6ES7288-1ST60-0AA0 6ES7288-1SR60-0AA0...
Page 715
Technical specifications A.2 S7-200 SMART CPUs Table A- 54 CPU features Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s AC/DC/Relay User Program 30 Kbytes 30 Kbytes 12 Kbytes memory User data (V) 20 Kbytes 20 Kbytes 8 Kbytes Retentive 10 Kbytes max.
Page 716
Technical specifications A.2 S7-200 SMART CPUs Table A- 55 Performance Type of instruction Execution speed Boolean 150 ns instruction Move Word 1.2 μs/instruction Real math 3.6 μs/instruction Table A- 56 User program elements supported Element Description POUs Type/quantity Main program: 1 Subroutines: 128 (0 to 127) Interrupt routines: 128 (0 to 127) Nesting depth...
Page 717
Technical specifications A.2 S7-200 SMART CPUs Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s AC/DC/Relay Isolation (external signal Ethernet: Transformer isolat- Ethernet: Transformer isolat- Ethernet: Not available to PLC logic) ed, 1500 V AC ed, 1500 V AC RS485: none RS485: none RS485: none...
Technical specifications A.2 S7-200 SMART CPUs A.2.4.2 Digital inputs and outputs Table A- 60 Digital inputs Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s AC/DC/Relay Number of inputs Type Sink/Source (IEC Type 1 sink, Sink/Source (IEC Type 1 Sink/Source (IEC Type 1 except I0.0 to I0.3) sink)
Page 719
Technical specifications A.2 S7-200 SMART CPUs Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s AC/DC/Relay Number of inputs on sim- 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 •...
Page 720
Technical specifications A.2 S7-200 SMART CPUs Technical data CPU ST60 DC/DC/DC CPU SR60 AC/DC/Relay CPU CR60s AC/DC/Relay 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.
Technical specifications A.2 S7-200 SMART CPUs A.2.4.3 Wiring diagrams Table A- 62 Wiring diagram for the CPU ST60 DC/DC/DC (6ES7288-1ST60-0AA0) ① 24 V DC Sensor Power Output Table A- 63 Connector pin locations for CPU ST60 DC/DC/DC (6ES7288-1ST60-0AA0) DI c.3 DI a.0 DI c.4 DI a.1...
Page 722
Technical specifications A.2 S7-200 SMART CPUs DI c.1 M / 24 V DC DQ b.6 DI c.2 Functional Earth DQ b.7 Table A- 64 Wiring diagram for the CPU SR60 AC/DC/Relay (6ES7288-1SR60-0AA0) ① 24 V DC Sensor Power Output Table A- 65 Connector pin locations for CPU SR60 AC/DC/Relay (6ES7288-1SR60-0AA0) DI c.3 DI a.0...
Page 723
Technical specifications A.2 S7-200 SMART CPUs DI b.5 DI e.1 DQ b.3 DI b.6 DI e.2 DI b.7 DI e.3 DQ b.4 DI c.0 L1 / 120 - 240 V AC DQ b.5 DI c.1 N / 120 - 240 V AC DQ b.6 DI c.2 Functional Earth...
Technical specifications A.2 S7-200 SMART CPUs DI b.1 DI d.5 DI b.2 DI d.6 DQ b.0 DI b.3 DI d.7 DQ b.1 DI b.4 DI e.0 DQ b.2 DI b.5 DI e.1 DQ b.3 DI b.6 DI e.2 DI b.7 DI e.3 DQ b.4 DI c.0...
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Digital inputs and outputs expansion modules (EMs) A.3.1 EM DE08 and EM DE16 digital input specifications Table A- 69 General specifications Model EM Digital 8 x Inputs (EM DE08) EM Digital 16 x Inputs (EM DE16) Article number 6ES7288-2DE08-0AA0 6ES7288-2DE16-0AA0...
Page 726
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 71 Wiring diagram for the EM DE08 Digital 8 x Inputs (6ES7288-2DE08-0AA0) and EM DE16 Digital 16 x Input (6ES7288-2DE16-0AA0) EM DE08 Digital 8 x Inputs EM DE16 Digital 16 x Inputs (6ES7288-2DE08-0AA0) (6ES7288-2DE16-0AA0) Table A- 72...
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 73 Connector pin locations for EM DE16 Digital 16 x Input (6ES7288-2DE16-0AA0) No connection Functional Earth No connection No connection No connection No connection No connection No connection DI a.0 DI a.4 DI b.0...
Page 728
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 75 Digital outputs Model EM Digital EM Digital EM Digital EM Digital 8 x Outputs 8 x Outputs Relay 16 x Outputs Relay 16 x Outputs Transis- (EM DT08) (EM DR08) (EM QR16) tor (EM QT16)
Page 729
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Model EM Digital EM Digital EM Digital EM Digital 8 x Outputs 8 x Outputs Relay 16 x Outputs Relay 16 x Outputs Transis- (EM DT08) (EM DR08) (EM QR16) tor (EM QT16) Output behavior in STOP Last value or substi-...
Page 730
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 77 Connector pin locations for EM DT08 Digital 8 x Outputs (6ES7288-2DT08-0AA0 1L+ / 24 V DC No connection 1M / 24 V DC 2L+ / 24 V DC Functional Earth 2M / 24 V DC DQ a.0...
Page 731
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 79 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) EM QR16 Digital 16 x Outputs Relay EM QT16 Digital 16 x Outputs Transition (6ES7288-2QR16-0AA0) (6ES7288-2QT16-0AA0)
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 81 Connector pin locations for EM QT16 Digital 16 x Outputs Transition (6ES7288-2QT16- 0AA0) No connection 1L / 24 V DC 4L / 24 V DC No connection DQ a.0 1M / 24 V DC 4M / 24 V DC...
Page 733
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 83 Digital inputs Model EM Digital EM Digital EM Digital EM Digital 8 x Inputs/ 8 x Inputs/ 16 x Inputs/ Digital 16 x Inputs / Digital 8 x Outputs 8 x Relay Outputs 16 x Outputs 16 x Relay Outputs...
Page 734
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 84 Digital outputs Model EM Digital EM Digital EM Digital EM Digital 8 x Inputs/ 8 x Inputs/ 16 x Inputs/ Digital 16 x Inputs/ Digital 8 x Outputs 8 x Relay Outputs 16 x Outputs 16 x Relay Outputs...
Page 735
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 85 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...
Page 736
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 87 Connector pin locations for EM DR16 Digital 8 x Inputs / 8 x Relay Outputs (6ES7288- 2DR16-0AA0) L+ / 24 V DC Functional Earth No connection No connection M / 24 V DC No connection No connection...
Page 737
Technical specifications A.3 Digital inputs and outputs expansion modules (EMs) Table A- 89 Connector pin locations for EM DT32 Digital 16 x Inputs / Digital 16 x Outputs (6ES7288- 2DT32-0AA0) 4L+ / 24 V DC Functional Earth 3L+ / 24 V DC DQ b.0 4M / 24 V DC No connection...
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Analog inputs and outputs expansion modules (EMs) A.4.1 EM AE04 and EM AE08 analog input specifications Table A- 91 General specifications Model EM Analog 4 x inputs (EM AE04) EM Analog 8 x inputs (EM AE08) Article number 6ES7288-3AE04-0AA0 6ES7288-3AE08-0AA0...
Page 739
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Model EM Analog 4 x inputs (EM AE04) EM Analog 8 x inputs (EM AE08) Accuracy (25 °C / 0 to 55 °C) Voltage mode: ±0.1% / ±0.2% of full Voltage mode: ±0.1% / ±0.2% of full scale scale Current mode: ±0.2% / ±0.3% of full scale...
Page 740
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 94 Wiring diagram EM AE04 Analog 4 x Inputs (6ES7288-3AE04-0AA0) and EM AE08 Ana- log 8 x Inputs (6ES7288-3AE08-0AA0 EM AE04 Analog 4 x Inputs EM AE08 Analog 8 x Inputs (6ES7288-3AE04-0AA0) (6ES7288-3AE08-0AA0) Note: Connectors must be gold.
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 96 Connector pin locations for EM AE08 Analog 8 x Inputs (6ES7288-3AE08-0AA0) X10 (gold) X11 (gold) X12 (gold) X13 (gold) L+ / 24 V DC No connection No connection No connection M / 24 V DC No connection...
Page 742
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 98 Analog outputs Technical data EM Analog 2 x outputs (EM AQ02) EM Analog 4 x outputs (EM AQ04) Number of outputs Type Voltage or current Voltage or current Range ±10 V or 0 to 20 mA ±10 V or 0 to 20 mA...
Page 743
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 100 Wiring diagram for the EM AQ02 Analog 2 x Outputs (6ES7288-3AQ02-0AA0) and EM AQ04 Analog 4 x Outputs (6ES7288-3AQ04-0AA0) EM AQ02 Analog 2 x Outputs (6ES7288-3AQ02- EM AQ04 Analog 4 x Outputs (6ES7288-3AQ04- 0AA0) 0AA0) Note: Connectors must be gold.
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 102 Connector pin locations for EM AQ04 Analog 4 x Outputs (6ES7288-3AQ04-0AA0) X10 (gold) X11 (gold) X12 (gold) X13 (gold) L+ / 24 V DC No connection No connection No connection M / 24 V DC No connection...
Page 745
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 104 Analog inputs Model EM 2 x Analog Inputs / 1 x Analog Out- EM 4 x Analog Inputs / 2 x Analog Outputs puts (AM03) (AM06) Number of inputs Type Voltage or current (differential): Se- Voltage or current (differential): Selectable...
Page 746
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 105 Analog outputs 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 Type Voltage or current...
Page 747
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) EM AM03 wiring current transducers Wiring current transducers are available as 2-wire transducers and 4-wire transducers as shown below. Table A- 107 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...
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 108 Connector pin locations for AM03 2 x Analog Inputs / 1 x Analog Outputs (6ES7288- 3AM03-0AA0) X10 (gold) X11 (gold) X12 (gold) L+ / 24 V DC No connection No connection M / 24 V DC...
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) A.4.5 Sample time and update times for the analog inputs Table A- 111 Sample time and update time Rejection frequency (Integra- Sample time Module update time for all channels tion time) 4-channel SM 8-channel SM 400 Hz (2.5 ms)
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 113 Analog input representation for current (SB and EM) System Current measuring range Decimal Hexadecimal 0 mA to 20 mA 4 mA to 20 mA 32767 7FFF 23.70 mA 22.96 mA Overflow 32512...
Page 751
Technical specifications A.4 Analog inputs and outputs expansion modules (EMs) Table A- 115 Analog output representation for current (SB and EM) System Current output range Decimal Hexadecimal 0 mA to 20 mA 4 mA to 20 mA 32767 7FFF See note 1 See note 1 Overflow 32512...
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) Thermocouple and RTD expansion modules (EMs) A.5.1 Thermocouple expansion modules (EMs) A.5.1.1 EM AT04 thermocouple specifications Table A- 116 General specifications Model EM AT04 AI 4 x 16 bit TC Article number 6ES7288-3AT04-0AA0 Dimensions W x H x D (mm) 45 x 100 x 81...
Page 753
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) Model EM AT04 AI 4 x 16 bit TC Module update time See Filter selection table. Cold junction error ±1.5 °C Cable length (meters) 100 m to sensor max. Wire resistance 100 Ω...
Page 754
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).
Page 755
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) Note Unused analog inputs should be shorted. The thermocouple unused channels can be deactivated. No error will occur if an unused channel is deactivated. Thermocouples are formed whenever two dissimilar metals are electrically bonded to each other.
Page 756
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) The ranges and accuracy for the different thermocouple types supported by the EM AT04 Thermocouple expansion module are shown in the table below. Table A- 121 EM AT04 Thermocouple selection table Type Under-range Nominal range...
Page 757
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) 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.
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) A.5.2 RTD expansion modules (EMs) EM RTD specifications Table A- 124 General 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...
Page 759
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) Cable length (max.), in meters 100 m to sensor max. 100 m to sensor max. Wire re- except 10 Ω...
Page 760
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) The EM RTD module supports measurements with 2-wire, 3-wire and 4-wire connections to the sensor resistor. Table A- 127 Ranges and accuracy for the different sensors supported by the RTD expansion module Temperature coef- RTD type Under range...
Page 761
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) Table A- 128 Resistance Range Under range Nominal range Nominal range Over range Normal range Normal range minimum low limit high limit maximum accuracy @ 25 accuracy -20 °C °C to 60°C 150 Ω...
Page 762
Technical specifications A.5 Thermocouple and RTD expansion modules (EMs) Table A- 130 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) EM AR02 RTD 2 x 16 bit EM AR04 RTD 4 x 16 bit (6ES7288-3AR02-0AA0) (6ES7288-3AR04-0AA0)
Technical specifications A.6 Digital signal boards Table A- 132 Connector pin locations for EM AR04 RTD 4 x 16 bit (6ES7288-3AR04-0AA0) X10 (gold) X11 (gold) X12 (gold) X13 (gold) L+ / 24 V DC No connection No connection No connection M / 24 V DC No connection No connection...
Page 764
Technical specifications A.6 Digital signal boards Table A- 134 Digital inputs Technical data SB Digital 2 x Inputs / 2 x Digital Outputs (DT04) Number of inputs Type Sink (IEC Type 1 sink) Rated voltage 24 V DC at 4 mA, nominal Continuous permissible voltage 30 V DC max.
Page 765
Technical specifications A.6 Digital signal boards Table A- 135 Digital outputs Technical data SB Digital 2 x Inputs / 2 x Digital Outputs (DT04) Number of outputs Output type Solid state - MOSFET (sourcing) Voltage range 20.4 to 28.8 V DC Logic 1 signal at max.
Page 766
Technical specifications A.6 Digital signal boards Table A- 136 Wiring diagram for the SB DT04 2 Digital Input/2 Digital Output (6ES7288-5DT04-0AA0) SB DT04 2 Digital Input/2 Digital Output (6ES7288-5DT04-0AA0) Table A- 137 Connector pin locations for SB DT04 2 Digital Input/2 Digital Output (6ES7288-5DT04- 0AA0) DQ f.0 DQ f.1...
Technical specifications A.7 Analog signal boards Analog signal boards A.7.1 SB AE01 analog input specifications Table A- 138 General specifications Technical data SB Analog 1 x Input (SB AE01) Article number 6ES7288-5AE01-0AA0 Dimensions W x H x D (mm) 35 x 52.2 x 16 Weight 20 grams Power dissipation...
Page 768
Technical specifications A.7 Analog signal boards Technical data SB Analog 1 x input (SB AE01) Isolation (field side to logic) None Cable length (meters) 100 m twisted and shielded Table A- 140 Diagnostics Model SB Analog 1 x input (SB AE01) Overflow/underflow 24 V DC low voltage None...
Technical specifications A.7 Analog signal boards Table A- 142 Connector pin locations for SB AE01 Analog Input 1 x Input (6ES7288-5AE01-0AA0) No connection No connection AI R AI 0+ AI 0+ AI 0- A.7.2 SB AQ01 analog output specifications Table A- 143 General specifications Technical data SB Analog 1 x Output (SB AQ01) Article number...
Page 770
Technical specifications A.7 Analog signal boards Table A- 145 Diagnostics Technical data SB Analog 1 x Output (SB AQ01) Overflow/underflow Short to ground (voltage mode only) Wire break (current mode only) Table A- 146 Wiring diagram for the SB AQ01 Analog 1 x Output (6ES7288-5AQ01-0AA0) SB AQ01 Analog 1 x Output (6ES7288-5AQ01-0AA0) Table A- 147 Connector pin locations for SB AQ01 Analog 1 x Output (6ES7288-5AQ01-0AA0) No connection...
Technical specifications A.8 RS485/RS232 signal boards RS485/RS232 signal boards A.8.1 SB RS485/RS232 specifications Table A- 148 General specifications Technical data SB RS485/RS232 Article number 6ES7288-5CM01-0AA0 Dimensions W x H x D (mm) 35 x 52.2 x 16 Weight 18.2 grams Power dissipation 0.5 W Current consumption (5 V DC)
Page 772
Technical specifications A.8 RS485/RS232 signal boards Table A- 150 RS232 Transmitter and receiver Technical data SB RS485/RS232 Transmitter output voltage +/-5 V min. at RL = 3K Ω Transmit output voltage +/- 15 V DC max. Receiver input impedance 3 K Ω min. Receiver threshold/sensitivity 0.8 V min.
Technical specifications A.9 Battery board signal boards (SBs) Battery board signal boards (SBs) A.9.1 SB BA01 Battery board SB BA01 Battery board The S7-200 SMART SB BA01 battery board provides for long-term backup of the real-time clock. The battery board plugs into the signal board slot of the S7-200 SMART CPU (firmware V2.0 and later versions).
Page 774
Technical specifications A.9 Battery board signal boards (SBs) Diagnostics SB BA01 Battery Board Critical battery level < 2.5 V Battery diagnostic Low voltage indicator: Low battery voltage causes the LED on the BA01 panel • to illuminate with the red light continuously ON. Diagnostic alarm and/or digital output status of battery •...
Technical specifications A.10 EM DP01 PROFIBUS DP module A.10 EM DP01 PROFIBUS DP module Table A- 155 General specifications Technical data EM DP01 PROFIBUS DP Article number 6ES7288-7DP01-0AA0 Dimensions W x H x D (mm) 70 x 100 x 81 Weight 176.2 g Power dissipation...
Technical specifications A.10 EM DP01 PROFIBUS DP module Table A- 157 Power supply Technical data EM DP01 PROFIBUS DP 24 V DC input power requirements Voltage range 20.4 to 28.8 V DC (Class 2, Limited Power, or sensor power from PLC) Maximum current: Module only with port active 30 mA...
Technical specifications A.10 EM DP01 PROFIBUS DP module A.10.2 Connector pin assignments for EM DP01 The RS485 communication serial port on the EM DP01 is RS485-compatible on a nine-pin subminiature D female connector, in accordance with the PROFIBUS standard as defined in the European Standard EN 50170.
Technical specifications A.11 S7-200 SMART cables A.10.3 EM DP01 PROFIBUS DP module wiring diagram Table A- 160 Wiring diagram for the EM DP01 PROFIBUS DP module (6ES7288-7DP01-0AA0 EM DP01 PROFIBUS DP module (6ES7288-7DP01-0AA0) Table A- 161 Connector pin locations for EM DP01 PROFIBUS DP module (6ES7288-7DP01-0AA0) L+ / 24 V DC M / 24 V DC Functional Earth...
Technical specifications A.11 S7-200 SMART cables A.11 S7-200 SMART cables A.11.1 S7-200 SMART I/O expansion cable Table A- 162 S7-200 SMART Expansion cable Technical Data Article number 6ES7288-6EC01-0AA0 Cable length Weight 80 g Refer to the installation section for information about installing and removing the S7-200 SMART expansion cable.
Technical specifications A.11 S7-200 SMART cables A.11.2.2 RS-232/PPI Multi-Master Cable Table A- 164 RS-232/PPI Multi-Master Cable - Pin-outs for RS-485 to RS-232 Local Mode Connector RS-485 Connector Pin-out RS-232 Local Connector Pin-out Pin Number Signal description Pin number Signal Description No connect Data Carrier Detect (DCD) (not used) 24 V Return (RS-485 logic...
Page 782
Technical specifications A.11 S7-200 SMART cables Use the RS-232/PPI Multi-Master Cable for Freeport operation For connection directly to your personal computer: ● Set the PPI/Freeport mode (Switch 5=0) ● Set the baud rate (Switches 1, 2, and 3) ● Set Local (Switch 6=0). The Local setting is the same as setting the PC/PPI cable to DCE.
Page 783
Technical specifications A.11 S7-200 SMART cables RS-232/PPI Multi-Master cable dimensions, label and LEDs The following figure shows the RS-232/PPI Multi-Master Cable dimensions, label and LEDs. Color Description Green RS-232 transmit indicator Green RS-232 receive indicator Green RS-485 transmit indicator S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Technical specifications A.11 S7-200 SMART cables A.11.2.3 USB/PPI Multi-Master Cable To use the USB cable, you must have STEP 7-Micro/WIN SMART V2.3 (or later) installed. It is recommended that you use the USB cable only with S7-200 SMART CPUs firmware version V2.3 (or later).
Page 785
Technical specifications A.11 S7-200 SMART cables The following figure shows theUSB/PPI Multi-Master Cable dimensions and LEDs. Figure A-1 USB/PPI Multi-Master Cable Dimensions and LEDs Color Description Green USB transmit indicator Green USB receive indicator Green RS-485 transmit indicator S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Calculating a power budget 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.
Page 788
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.
Calculating a power budget B.2 Calculating a sample power requirement Calculating a sample power requirement Calculating a sample power requirement The following table shows a sample calculation of the power requirements for a CPU that includes the following: ● CPU SR40 AC/DC/Relay ●...
Calculating a power budget B.3 Calculating your power requirement Calculating your power requirement Calculating your power requirement Use the table below to determine how much power (or current) the CPU can provide for your configuration. Refer to the technical specifications (Page 679) for the power budgets of your CPU model and the power requirements of your digital modules, analog modules or signal boards.
Error codes 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.
Error codes C.2 PLC non-fatal error codes PLC non-fatal error codes PLC compiler and run-time errors are non-fatal errors. Non-fatal errors can degrade some aspect of the performance of your PLC, but do not render the PLC incapable of executing the user program or updating the I/O.
Page 793
Error codes C.2 PLC non-fatal error codes Hexadecimal error Non-fatal PLC program compiler errors code 0095 Missing LSCR instruction 0096 Missing SCRE instruction or illegal instruction before SCRE 0099 Too many password-protected POUs 009B Illegal index for a string operation 009D Illegal parameter detected in system block 009F...
Page 794
Error codes C.2 PLC non-fatal error codes Hexadecimal error Non-fatal run-time programming problem code 0014 Data log error: There are too many DATx_WRITE subroutine executions in one program • scan. Only 10 to 15 data log writes per second can be sustained. When there are too many DATx-WRITE executions per second, then the allot- ted memory will be full and for a short period of time no new data log rec- ords are stored.
Error codes C.3 PLC non-fatal error SM flags PLC non-fatal error SM flags 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 799), which can be accessed by the user program.
Error codes C.4 PLC fatal error codes 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.
Page 797
Error codes C.4 PLC fatal error codes 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...
Special memory (SM) and system symbol names 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.
Page 800
Special memory (SM) and system symbol names D.1 SM (Special Memory) overview ● SMB1100-SMB1399 (Page 827) EM (expansion module) hardware/firmware ID ● SMB1400-SMB1699 (Page 830) EM (expansion module) module-specific data SMB30 to SMB194 and SMB566 to SMB749 (S7-200 SMART read/write special memory) The S7-200 SMART CPU performs these actions: •...
Page 801
Special memory (SM) and system symbol names D.1 SM (Special Memory) overview ● SMB650-SMB699 (Page 825) Axis 1 open loop motion control ● SMB700-SMB749 (Page 825) Axis 2 open loop motion control 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.
Special memory (SM) and system symbol names D.2 SMB0: System status SMB0: System status Special Memory Byte 0 (SM0.0 - SM0.7) provides eight bits the S7-200 SMART CPU updates at the end of each scan cycle. Table D- 1 SMB0 system status bits S7-200 SMART SM address Description...
Special memory (SM) and system symbol names D.3 SMB1: Instruction execution status SMB1: Instruction execution status Special memory byte 1 (SM1.0 - SM1.7) provides execution status for various instructions, such as table and math operations. These bits are set and reset by instructions at execution time.
Special memory (SM) and system symbol names D.4 SMB2: Freeport receive character SMB2: Freeport receive character Special memory byte 2 is the Freeport receive character buffer. While in Freeport mode, the CPU stores each character that the CPU receives in this byte for easy access by your program.
Special memory (SM) and system symbol names D.6 SMB4: Interrupt queue overflow, run-time program error, interrupts enabled, freeport transmitter idle, and value forced SMB4: Interrupt queue overflow, run-time program error, interrupts enabled, freeport transmitter idle, and value forced Special memory byte 4 (SM4.0 - SM4.7) contains the interrupt queue overflow bits. These bits indicate either that interrupts are occurring at a rate greater than the CPU can process or that the global interrupt disable (DISI) instruction (Page 322) has disabled interrupts.
Special memory (SM) and system symbol names D.8 SMB6-SMB7: CPU ID, error status, and digital I/O points 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...
Special memory (SM) and system symbol names D.9 SMB8-SMB19: I/O module ID and errors SMB8-SMB19: I/O module ID and errors SMB8 through SMB19 are organized in byte pairs for expansion modules 0 to 5. The even-numbered byte of each pair is the module-identification register. These bytes identify the module type, the I/O type, and the number of inputs and outputs.
Special memory (SM) and system symbol names D.10 SMW22-SMW26: Scan times D.10 SMW22-SMW26: Scan times SMW22, SMW24, and SMW26 contain information on the scan time. You can read the last scan time, minimum scan time, and maximum scan time (millisecond values). Table D- 7 SMW22-SMW26 PLC scan times S7-200 SMART...
Special memory (SM) and system symbol names D.12 SMB30: (Port 0) and SMB130: (Port 1) D.12 SMB30: (Port 0) and SMB130: (Port 1) SMB30 configures Port 0 (onboard RS485 port). SMB130 configures Port 1 (optional CM01 signal board). You can read and write to SMB30 and SMB130. These bytes configure the respective communication port for Freeport operation and provide selection of either Freeport or system protocol support.
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 D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3), SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5): high-speed counters These bytes provide configuration and operation information for the high-speed counters: ●...
Page 811
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 SM address Description symbol name HSC0_CV SMD38 HSC0 new current value You use SMD38 to set HSC0 current value to any value you choose. To update the current value, write the new current value to SMD38;...
Page 812
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 Table D- 11 HSC2 configuration and operation S7-200 SMART SM address Description symbol name HSC2_Status SMB56 HSC2 counter status Note: Counter status bits are valid only while the CPU is executing an inter- rupt routine that a high-speed counter event triggered.
Page 813
Special memory (SM) and system symbol names D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3), SMB146-SMB1 Table D- 12 HSC3 configuration and operation S7-200 SMART SM address Description symbol name HSC3_Status SMB136 HSC3 counter status Note: Counter status bits are valid only while the CPU is executing an inter- rupt routine that a high-speed counter event triggered.
Page 814
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 Table D- 13 HSC4 configuration and operation S7-200 SMART SM address Description symbol name HSC4_Status SMB146 HSC4 counter status Note: Counter status bits are valid only while the CPU is executing an inter- rupt routine that a high-speed counter event triggered.
Page 815
Special memory (SM) and system symbol names D.14 SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3), SMB146-SMB1 Table D- 14 HSC5 configuration and operation S7-200 SMART SM address Description symbol name HSC5_Status SMB156 HSC5 counter status Note: Counter status bits are valid only while the CPU is executing an inter- rupt routine that a high-speed counter event triggered.
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 D.15 SMB66-SMB85 (PTO0/PWM0, PTO1/PWM1), SMB166-SMB169 (PTO0), SMB176-SMB179 (PTO1), and SMB566-SMB579 (PTO2/PWM2): high-speed outputs The S7-200 SMART CPU uses the following special memory to monitor and control the pulse train outputs (PTO0 and PTO1) and pulse width modulation outputs (PWM0 and PWM1) for the PLS (Pulse) instruction: ●...
Page 817
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 SM address Function symbol name PTO0_Seg_Num SMB166 Byte data type: The currently executing segment number for PTO0's profile PTO0_Profile_Offset SMW168 Word data type: Starting location of PTO0's profile table (byte offset from Table D- 16 High-speed output 1 configuration and control S7-200 SMART...
Page 818
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 Table D- 17 High-speed output 2 configuration and control S7-200 SMART SM address Description symbol name PTO2_Status SMB566 PTO2 Status PLS2_Abort_AE SM566.4 PTO2 profile was aborted due to an add error: FALSE: No abort;...
Special memory (SM) and system symbol names D.16 SMB86-SMB94 and SMB186-SMB194: Receive message control D.16 SMB86-SMB94 and SMB186-SMB194: Receive message control You use SMB86-SMB94 and SMB186-SMB194 to control and read status of the RCV (Receive message) instruction (Page 199). S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Page 820
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.
Special memory (SM) and system symbol names D.17 SMW98: Expansion I/O bus communication errors D.17 SMW98: Expansion I/O bus communication errors SMW98 gives you information about errors on the expansion I/O bus. Table D- 18 SMW98 Expansion I/O bus communication error counter S7-200 SMART SM address Description...
Special memory (SM) and system symbol names D.18 SMW100-SMW114 System alarms D.18 SMW100-SMW114 System alarms Special memory words SMW100-SMW114 provide alarm and diagnostic error codes for CPU, SB (signal board), and EM (expansion modules). S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Special memory (SM) and system symbol names D.19 SMB130: Freeport control for port 1 (See SMB30) D.19 SMB130: Freeport control for port 1 (See SMB30) Refer to "SMB30: (Port 0) and SMB130: (Port 1)" (Page 809) for details. D.20 SMB146-SMB155 (HSC4) and SMB156-SMB165 (HSC5) Refer to "SMB36-45 (HSC0), SMB46-55 (HSC1), SMB56-65 (HSC2), SMB136-145 (HSC3), SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5): high-speed counters"...
Special memory (SM) and system symbol names D.23 SMB600-SMB749: Axis (0, 1, and 2) open loop motion control D.23 SMB600-SMB749: Axis (0, 1, and 2) open loop motion control Axis configuration and control SM addresses Wizard-generated program code reads and writes the axis special memory data. Axis data SM address Axis function Axis 0...
Special memory (SM) and system symbol names D.24 SMB650-SMB699: Axis 1 open loop motion control (See SMB600-SMB740) Axis data SM address Axis function Axis 0 Axis 1 Axis 2 SMB624 SMB674 SMB724 CUR_PF is a byte that indicates which profile the Axis of Motion is currently executing. SMB625 SMB675 SMB725...
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...
SM addresses for slot 0 Description SMW1100 EM bus Slot 0 vendor ID: 0x002A if a Siemens EM is present; 0x0000 if no EM is present SMB1102 to SMB1121 EM bus Slot 0 order ID (MLFB): ASCII characters, left-justified in field, padded with spaces...
Page 828
SM addresses for slot 2 Description SMW1200 EM bus slot 2 vendor ID: 0x002A if a Siemens EM is present; 0x0000 if no EM is present SMB1202 to SMB1221 EM bus slot 2 order ID (MLFB): ASCII characters, left-justified in field, padded with spaces...
Page 829
SM addresses for slot 4 Description SMW1300 EM bus slot 4 vendor ID: 0x002A if a Siemens EM is present; 0x0000 if no EM is present SMB1302 to SMB1321 EM bus slot 4 order ID (MLFB): ASCII characters, left-justified in field, padded with spaces...
Special memory (SM) and system symbol names D.29 SMB1400-SMB1699: EM (expansion module) module-specific data D.29 SMB1400-SMB1699: EM (expansion module) module-specific data The CPU reserves an additional 50 bytes for each expansion module for read-only module- specific data: SM addresses Description SMB1400 to SMB1449 EM bus Slot 0: Module specific information SMB1450 to SMB1499...
References 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. Table E- 1 Often-used special memory bits SM address System symbol name Description SM0.0 Always_On This bit is always TRUE. SM0.1 First_Scan_On The CPU sets this bit to TRUE, for the first scan cycle, and sets it to FALSE...
References E.2 Interrupt events in priority order Interrupt events in priority order Table E- 2 Priority order for interrupt events Priority group Event Description Communications Port 0 Receive character Highest Priority Port 0 Transmit complete Port 0 Receive message complete Port 1 Receive message complete Port 1 Receive character Port 1 Transmit complete...
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 C model CPUs: C model CPUs: • • HSC5 I1.0 I1.1 I1.3 S model CPUs: S model CPUs...
Page 835
References E.4 STL instructions Boolean instructions Description AWx IN1, IN2 AND result of Word Compare IN1 (x:<, <=,=, >=, >, <>)I N2 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...
Page 836
References E.4 STL instructions Math, increment, and decrement instructions Description +I IN1, OUT Add Integer, Double Integer or Real +D IN1, OUT IN1+OUT=OUT +R IN1, OUT -I IN1, OUT Subtract Integer, Double Integer, or Real -D IN1, OUT OUT-IN1=OUT -R IN1, OUT MUL IN1, OUT Multiply Integer (16*16->32) *I IN1, OUT...
Page 837
References E.4 STL instructions High-speed instructions Description HDEF HSC, MODE Define High-Speed Counter mode HSC n Activate High-Speed Counter PLS n Pulse Output: Real time clock instructions Description TODR T Read Time of Day clock TODW T Write Time of Day clock TODRX T Read Real Time Clock Extended TODWX T...
Page 838
References E.4 STL instructions Move, Shift, and Rotate instructions Description BMB IN, OUT, N Block Move Byte, Word, DWord BMW IN, OUT, N BMD IN, OUT, N SWAP IN Swap Bytes SHRB DATA, S_BIT, N Shift Register Bit SRB OUT, N Shift Right Byte, Word, DWord SRW OUT, N SRD OUT, N...
Page 839
References E.4 STL instructions String instructions 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 Table, Find, and Conversion instructions...
Page 840
References E.4 STL instructions Interrupt instructions Description CRETI Conditional Return from Interrupt 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 LAD/FBD Reads remote station data Writes data to a remote station...
References E.5 Memory ranges and features Memory ranges and features The following table provides the memory ranges and features for V2.3 CPUs. For CPUs of S7-200 SMART System Manual firmware versions prior to V2.3, refer to the for your specific CPU model and version.
Page 842
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 CR60s 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...
Ordering information CPU modules CPU models Article number CPU SR20, AC/DC/Relay 6ES7288-1SR20-0AA0 CPU ST20, DC/DC/DC 6ES7288-1ST20-0AA0 CPU CR20s, AC/DC/Relay 6ES7288-1CR20-0AA1 CPU SR30, AC/DC/Relay 6ES7288-1SR30-0AA0 CPU ST30, DC/DC/DC 6ES7288-1ST30-0AA0 CPU CR30s, AC/DC/Relay 6ES7288-1CR30-0AA1 CPU ST40, DC/DC/DC 6ES7288-1ST40-0AA0 CPU SR40, AC/DC/Relay 6ES7288-1SR40-0AA0 CPU CR40s, AC/DC/Relay 6ES7288-1CR40-0AA1 CPU SR60, AC/DC/Relay...
SB Battery (SB BA01) 6ES7288-5BA01-0AA0 Programming software Programming software Article number STEP 7-Micro/WIN SMART Individual License (CD-ROM) 6ES7288-8SW01-0AA0 Drives V90 (PC tools) software Can be downloaded from the Siemens Services and Support website S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Ordering information F.4 Communication Communication Communications cards Article number CP 5411: Short AT ISA 6GK1541-1AA00 CP 5512: PCMCIA Type II 6GK1551-2AA00 CP 5611: PCI card (version 3.0 or greater) 6GK1561-1AA00 Spare parts and other hardware Cables, network connectors, repeaters, and end retainers Article number I/O Expansion cable, 1 m 6ES7288-6EC01-0AA0...
Page 846
Ordering information F.5 Spare parts and other hardware Table F- 1 Terminal block spare kits If you have Use this terminal block spare kit (4/pk) S7-200 SMART module (article number) Terminal block article number Terminal block description CPU SR20, AC/DC/Relay (6ES7288-1SR20-0AA0) 6ES7292-1AH30-0XA0 8 pin, tin-plated 6ES7292-1AH40-0XA0...
Ordering information F.6 Human Machine Interface devices If you have Use this terminal block spare kit (4/pk) S7-200 SMART module (article number) Terminal block article number Terminal block description EM Digital 16 x Inputs / Digital 16 x Outputs (EM DT32) 6ES7292-1AL30-0XA0 11 pin, tin-plated (6ES7288-2DT32-0AA0)
Page 848
Ordering information F.6 Human Machine Interface devices S7-200 SMART System Manual, V2.3, 07/2017, A5E03822230-AF...
Index > *D (STL-Multiply double integer), 297 >=B, 230 *I (STL-Multiply integer), 297 >=R, 230 *R (STL-Multiply real), 297 >=W, 230 >B, 230 >R, 230 >W, 230 .mwp files, 108 .smart files, 108 A (STL-AND), 169 AB< (STL-AND compare byte less than), 230 AB<= (STL-AND compare byte less than or equal), 230 /D (STL-Divide double integer), 297 AB<>...
Page 850
Index example of pointer to access data in a table, 87 Assigning flag memory, 76 global symbols, 118 high-speed counters, 78 local variables, 124 local and expansion I/O, 83 variables (local), 121 local memory, 80 ATCH, 322 memory areas, 75 ATH, 240 process image output register, 75 ATT, 368...
Page 852
Index Ethernet hardware connection, 33 NOT, 176 Ethernet, RS485, and RS232, 28, 395 positive edge detector, 177 IP address, 406 Contamination level, 682 locating MAC address on CPU, 413 Convert instructions network, 32 ASCII array conversions, 240 number of connections (Ethernet), 396 ASCII sub-string to number value, 249 number of connections (RS232), 396 encode and decode, 252...
Page 853
Index SR20 specifications, 685 DECW (STL-Decrement word), 305 SR20 wiring diagram, 693 Default gateway IP address, 405 SR30 specifications, 695 Defining SR40 specifications, 704 local variables, 124 SR40 wiring diagram, 711 Device configuration of CPU and modules, 133 SR60 specifications, 714 DI_I, 236 SR60 wiring diagram, 721 DI_R, 236...
Page 854
Index data exchange mode, 435 Ethernet communications DP protocol, 423 STEP 7-Micro/WIN SMART settings, 34 GSD device database file, 440 Ethernet network on PROFIBUS network, 424 configuring the IP address for a CPU, 406 status LEDs, 777 searching for CPU, 412 wiring diagram, 778 EU STL-Edge Up), 177 ENCO, 252...
Page 855
Index Expansion module Features EM QR16, 727 CPU, 18 Expansion module (EM) expansion modules supported, 26 EM AE04 specifications, 738 Features of the new version, 21 EM AE04 wiring diagram, 740 FIFO, 370 EM AM06 specifications, 744 File menu EM AM06 wiring diagram, 748 Download, 89 EM AQ02 specifications, 741 Upload, 92...
Page 856
Index Guidelines IBCD (STL-Integer to BCD), 236 grounding and circuit, 62 Illegal syntax installation on a panel, 53 symbol table, 118 installation procedures, 52 Immediate I/O read/writes, 71 isolation, 63 Immediate instructions wiring guidelines, 64 LAD, FBD, and STL, 171 INC_B, 305 INC_DW, 305 INC_W, 305...
Page 857
Index Instructions LAD editor, 113 GET, 191 Lamp loads, 65 GET_ADDR, 213 LBL, 344 GIP_ADDR, 214 LD (STL stack-Load NOT immediate), 173 LD (STL stack-Load), 173 loop control (PID), 307 PUT, 191 LD (STL-Load), 169 quick reference guide, 834 LDB< (STL-Load compare byte less than), 230 SET_ADDR, 213 LDB<= (STL-Load compare byte less than or SIP_ADDR, 214...
Page 858
Index Library clearing PLC, 164 creating, 563 retentive range configuration, 141 types, 471 Memory card LIFO, 370 program transfer card, 97 LN (natural logarithm), 302 reset to factory defaults, 167 Local and expansion I/O addressing, 83 types of, 93 Local variables, 121 using, 94 Local/Partner connection, 400 Modbus general...
Page 859
Index EM DT08, 727 MOV_R, 338 EM DT16, 732 MOV_W, 338 EM DT32, 732 MOVB (STL-move byte), 338 EM QR16, 727 MOVD (STL-move double word), 338 EM QT16, 727 Move instructions SB AE01, 767 block move (byte, word, dword), 339 SB AQ01, 769, 770 move (byte, word, dword, real), 338 SB CM01, 771...
Page 860
Index OR>= (STL-OR compare real greater than or equal), 230 O (STL-OR), 169 ORB (STL-OR byte), 336 OB< (STL-OR compare byte less than), 230 ORD (STL-OR dword), 336 OB<= (STL-OR compare byte less than or equal), 230 Ordering information, 843 OB<>...
Page 861
Index loop control types, 316 JMP-LBL, 344 understanding, 313 SCR (Sequence control relay), 345 PID Tune control panel, 590 Program editor Pin assignments for network connector, 460 bookmarks, 565 Pipelining debugging and monitoring, 568 PTO pulses, 288 STL status options, 571 types, 112 clearing memory, 164 using, 40...
Page 862
Index instruction, 168 RS232, 470 pulse output instruction (PLS), 285 Freeport mode, 468 Pulse width modulation (PWM) number of communication connections, 396 cycle time, 289 types of communication, 28, 395 instruction, 168 RS232/PPI cable, 468 output, 596, 596 RS485 pulse output instruction (PLS), 285 communication overview, 446 pulse outputs, 598 communication ports configuration, 136...
Page 863
SMB34-SMB35 time interval values for timed SHRB, 360 interrupts, 809 SI (STL-set immediate), 179 SMB36-45 (HSC0) high-speed counter 0, 810 Siemens technical support, 3 SMB4 interrupt queue overflow, run-time program Siemens-supplied libraries, 471 error, interrupts enabled, Freeport transmitter idle, Signal board (SB...
Page 864
Index SMW22-SMW26 scan times, 808 SB DT04, 763, 766 SMW98 Expansion I/O bus - communication step response times (SM), 748 errors, 821 SQRT (square root), 302 Software debugging, 565 SR (LAD/FBD Set dominant bistable), 180 Special memory assignments and functions, 799 SRB (STL-Shift right byte), 357 Special memory bytes SRD (STL-Shift right dword), 357...
Page 866
Index EM AR02 (RTD), 762 EM DE08, 726 Uploading programs, 92 EM DP01 PROFIBUS DP module, 778 User-defined libraries, 563 EM DR08, 729 USS protocol instructions EM DR16, 735 example program, 561 EM DR32, 736 using, 548 EM DT08, 729 USS_CTRL, 551 EM DT16, 735 USS_INIT, 549...