Siemens Simatic S7-200 System Manual

Siemens Simatic S7-200 System Manual

Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

SIMATIC
S7-200 Programmable Controller
System Manual
This manual has the order number:
6ES7298-8FA22-8BH0
Edition 04/2002
A5E00157957-01
Preface, Contents
Product Overview
Getting Started
Installing the S7-200
PLC Concepts
Programming Concepts,
Conventions and Features
S7-200 Instruction Set
Communicating over a Network
Hardware Troubleshooting Guide
and Software Debugging Tools
Creating a Program for the
Position Module
Creating a Program for the
Modem Module
Using the USS Protocol Library to
Control a MicroMaster Drive
Using the Modbus Protocol
Library
Technical Specifications
Calculating a Power Budget
Error Codes
Special Memory (SM) Bits
S7-200 Order Numbers
Execution Times for STL
Instructions
S7-200 Quick Reference
Information
Index
1
2
3
4
5
6
7
8
9
10
11
12
A
B
C
D
E
F
G

Advertisement

Table of Contents
loading

Summary of Contents for Siemens Simatic S7-200

  • Page 1 Preface, Contents Product Overview Getting Started Installing the S7-200 SIMATIC PLC Concepts Programming Concepts, S7-200 Programmable Controller Conventions and Features System Manual S7-200 Instruction Set Communicating over a Network Hardware Troubleshooting Guide and Software Debugging Tools Creating a Program for the Position Module Creating a Program for the Modem Module...
  • Page 2: Edition

    Trademarks SIMATICR, SIMATIC HMIR and SIMATIC NETR are registered trademarks of SIEMENS AG. Some of other designations used in these documents are also registered trademarks; the owner’s rights may be violated if they are used by third parties for their own purposes.
  • Page 3 S7-200 with other components, such as the TP070 Touch Panel, Modbus, or a MicroMaster drive Standards Compliance The SIMATIC S7-200 series meets the following standards: European Community (CE) Low Voltage Directive 73/23/EEC EN 61131--2: Programmable Controllers -- Equipment requirements...
  • Page 4 S7-200 Programmable Controller System Manual Maritime Approvals At the time this manual was printed, the SIMATIC S7-200 series met the maritime agencies identifed below. For the latest product approvals, contact your local Siemens distributor or sales office. Agency Certificate Number...
  • Page 5 (FAQs), product updates, or application tips, refer to the following Internet addresses: www.ad.siemens.de for general Siemens information This Siemens Automation & Drives Internet site includes information about the SIMATIC product line and other products available from Siemens. www.siemens.com/S7--200 for S7-200 product information...
  • Page 6 Siemens products that you are using, they can provide the fastest and most efficient answers to any problems that you might encounter.
  • Page 7: Table Of Contents

    Contents Product Overview ............. S7-200 CPU .
  • Page 8 S7-200 Programmable Controller System Manual S7-200 Instruction Set ............Conventions Used to Describe the Instructions .
  • Page 9 Contents Shift and Rotate Instructions ............. Shift Right and Shift Left Instructions .
  • Page 10 S7-200 Programmable Controller System Manual Creating a Program for the Modem Module ........Features of the Modem Module .
  • Page 11 Contents Error Codes ..............Fatal Error Codes and Messages .
  • Page 12 S7-200 Programmable Controller System Manual...
  • Page 13: Product Overview

    Product Overview The S7-200 series of micro-programmable logic controllers (Micro PLCs) can control a wide variety of devices to support your automation needs. The S7-200 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.
  • Page 14: S7-200 Cpu

    Figure 1-1 S7-200 Micro PLC Siemens provides different S7-200 CPU models with a diversity of features and capabilities that help you create effective solutions for your varied applications. Table 1-1 briefly compares some of the features of the CPU. For detailed information about a specific CPU, see Appendix A.
  • Page 15: S7-200 Expansion Modules

    CD that contains an electronic version of this manual, application tips, and other useful information. Computer Requirements STEP 7–Micro/WIN runs on either a personal computer or a Siemens programming device, such as a PG 760. Your computer or programming device should meet the following minimum requirements:...
  • Page 16: Communications Options

    To install STEP 7–Micro/WIN on a Windows NT or Windows 2000 operating system, you must log in with Administrator privileges. Communications Options Siemens provides two programming options for connecting your computer to your S7-200: a direct connection with a PC/PPI cable, or a Communications Processor (CP) card with an MPI cable for MPI and PROFIBUS–DP networks.
  • Page 17: Getting Started

    Getting Started STEP 7–Micro/WIN makes it easy for you to program your S7-200. In just a few short steps using a simple example, you can learn how to connect, program, and run your S7-200. All you need for this example is a PC/PPI cable, an S7-200 CPU, and a programming device running the STEP 7–Micro/WIN programming software.
  • Page 18: Connecting The S7-200 Cpu

    S7-200 Programmable Controller System Manual Connecting the S7-200 CPU Connecting your S7-200 is easy. For this example, you only need to connect power to your S7-200 CPU and then connect the communications cable between your programming device and the S7-200 CPU. Connecting Power to the S7-200 CPU The first step is to connect the S7-200 to a power source.
  • Page 19 Getting Started Chapter 2 Starting STEP 7–Micro/WIN Click on the STEP 7–Micro/WIN icon to open a new project. Figure 2-3 shows a new project. Navigation bar Notice the navigation bar. You can use the icons on the navigation bar to open elements of the STEP 7–Micro/WIN project.
  • Page 20: Creating A Sample Program

    S7-200 Programmable Controller System Manual Creating a Sample Program Entering this example of a control program will help you understand how easy it is to use STEP 7–Micro/WIN. This program uses six instructions in three networks to create a very simple, self-starting timer that resets itself.
  • Page 21 Getting Started Chapter 2 Opening the Program Editor Click on the Program Block icon to open the program editor. See Figure 2-6. Notice the instruction tree and the program editor. You use the instruction tree to insert the LAD instructions into the networks of the program editor by dragging and dropping the instructions from the instruction tree to the networks.
  • Page 22 S7-200 Programmable Controller System Manual Entering Network 2: Turning the Output On When the timer value for T33 is greater than or equal to 40 (40 times 10 milliseconds, or 0.4 seconds), the contact provides power flow to turn on output Q0.0 of the S7-200. To enter the Compare instruction: Double-click the Compare icon to display the compare instructions.
  • Page 23: Downloading The Sample Program

    Getting Started Chapter 2 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 S7-200 CPU type and other parameters. To save the project: Select the File >...
  • Page 24 S7-200 Programmable Controller System Manual...
  • Page 25: Installing The S7-200

    Installing the S7-200 The S7-200 equipment is designed to be easy to install. You can use the mounting holes to attach the modules to a panel, or you can use the built-in clips to mount the modules onto a standard (DIN) rail. The small size of the S7-200 allows you to make efficient use of space.
  • Page 26: Guidelines For Installing S7-200 Devices

    S7-200 Programmable Controller System Manual Guidelines for Installing S7-200 Devices You can install an S7-200 either on a panel or on a standard rail, and you can orient the S7-200 either horizontally or vertically. Separate the S7-200 Devices from Heat, High Voltage, and Electrical Noise As a general rule for laying out the devices of your system, always separate the devices that generate high voltage and high electrical noise from the low-voltage, logic-type devices such as the S7-200.
  • Page 27: Installing And Removing The S7-200 Modules

    Installing the S7-200 Chapter 3 Power Budget All S7-200 CPUs have an internal power supply that provides power for the CPU, the expansion modules, and other 24 VDC user power requirements. The S7-200 CPU provides the 5 VDC logic power needed for any expansion in your system. Pay careful attention to your system configuration to ensure that your CPU can supply the 5V power required by your selected expansion modules.
  • Page 28 S7-200 Programmable Controller System Manual Mounting Dimensions The S7-200 CPUs and expansion modules include mounting holes to facilitate installation on panels. Refer to Table 3-1 for the mounting dimensions. Table 3-1 Mounting Dimensions * Minimum spacing 9.5 mm* between modules when hard-mounted 4 mm Mounting holes...
  • Page 29 Installing the S7-200 Chapter 3 Using DIN rail stops could be helpful if your S7-200 is in an environment with high vibration potential or if the S7-200 has been installed vertically. If your system is in a high-vibration environment, then panel-mounting the S7-200 will provide a greater level of vibration protection.
  • Page 30: Guidelines For Grounding And Wiring

    S7-200 Programmable Controller System Manual Guidelines for Grounding and Wiring 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 S7-200. Prerequisites Before you ground or install wiring to any electrical device, ensure that the power to that equipment has been turned off.
  • Page 31 Installing the S7-200 Chapter 3 Guidelines for Grounding the S7-200 The best way to ground your application is to ensure that all the common connections of your S7-200 and related equipment are grounded to a single point. This single point should be connected directly to the earth ground for your system.
  • Page 32 S7-200 Programmable Controller System Manual Guidelines for Suppression Circuits You should equip inductive loads with suppression circuits to limit voltage rise when the control output turns off. Suppression circuits protect your outputs from premature failure due to high inductive switching currents.
  • Page 33: Plc Concepts

    PLC Concepts The basic function of the S7-200 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. In This Chapter Understanding How the S7-200 Executes Your Control Logic .
  • Page 34: Understanding How The S7-200 Executes Your Control Logic

    S7-200 Programmable Controller System Manual Understanding How the S7-200 Executes Your Control Logic The S7-200 continuously cycles through the control logic in your program, reading and writing data. The S7-200 Relates Your Program to the Physical Inputs and Outputs The basic operation of the S7-200 is very simple: Start_PB E_Stop M_Starter...
  • Page 35 PLC Concepts Chapter 4 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 S7-200 does not update analog inputs as part of the normal scan cycle unless filtering of analog inputs is enabled.
  • Page 36: Accessing The Data Of The S7-200

    S7-200 Programmable Controller System Manual Accessing the Data of the S7-200 The S7-200 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.
  • Page 37 PLC Concepts Chapter 4 V B 100 V W 100 V D 100 Byte address Byte address Byte address Access to a byte size Access to a word size Access to a double word size Area identifier Area identifier Area identifier VB100 VB100 most significant bit...
  • Page 38 S7-200 Programmable Controller System Manual Timer Memory Area: T The S7-200 provides timers that count increments of time in resolutions (time-base increments) of 1 ms, 10 ms, or 100 ms. Two variables are associated with a timer: Current value: this 16-bit signed integer stores the amount of time counted by the timer. Timer bit: this bit is set or cleared as a result of comparing the current and the preset value.
  • Page 39 PLC Concepts Chapter 4 High-Speed Counters: HC 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 (such as HC0).
  • Page 40 S7-200 Programmable Controller System Manual Special Memory: SM The SM bits provide a means for communicating information between the CPU and your program. You can use these bits to select and control some of the special functions of the S7-200 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 41 PLC Concepts Chapter 4 Analog Inputs: AI The S7-200 converts an analog value (such as temperature or voltage) into a word-length (16-bit) digital value. You access these values by the area identifier (AI), size of the data (W), and the starting byte address.
  • Page 42 S7-200 Programmable Controller System Manual Format for Strings A string is a sequence of characters, with each character being stored as a byte. The first byte of the string defines the length of the string, which is the number of characters. Figure 4-9 shows the format for a string.
  • Page 43 PLC Concepts Chapter 4 Addressing the Local and Expansion I/O The local I/O provided by the CPU provides a fixed set of I/O addresses. You can add I/O points to the S7-200 CPU by connecting expansion I/O modules to the right side of the CPU, forming an I/O chain. The addresses of the points of the module are determined by the type of I/O and the position of the module in the chain, with respect to the preceding input or output module of the same type.
  • Page 44 S7-200 Programmable Controller System Manual Using Pointers for Indirect Addressing of the S7-200 Memory Areas Indirect addressing uses a pointer to access the data in memory. Pointers are double word memory locations that contain the address of another memory location. You can only use V memory locations, L memory locations, or accumulator registers (AC1, AC2, AC3) as pointers.
  • Page 45 PLC Concepts Chapter 4 Sample Program for Using an Offset to Access Data in V Memory 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). The value stored in the V memory address pointed to by LD10 is then copied to VB1900.
  • Page 46: Understanding How The S7-200 Saves And Restores Data

    S7-200 Programmable Controller System Manual Understanding How the S7-200 Saves and Restores Data The S7-200 provides a variety of safeguards to ensure that your program, the program data, and the configuration data for your S7-200 are properly retained. The S7-200 provides a super capacitor that S7-200 CPU maintains the integrity of the RAM after power RAM:...
  • Page 47 PLC Concepts Chapter 4 Saving the Retentive M Memory Area on Power Loss If you configured the first 14 bytes of bit memory S7-200 CPU (MB0 to MB13) to be retentive, these bytes are permanently saved to the EEPROM in the event Program block that the S7-200 loses power.
  • Page 48: Storing Your Program On A Memory Cartridge

    S7-200 Programmable Controller System Manual Storing Your Program on a Memory Cartridge The S7-200 supports an optional memory cartridge that provides a portable EEPROM storage for your program. The S7-200 stores the following elements on the memory cartridge: the program block, the data block, the system block, and the forced values.
  • Page 49: Selecting The Operating Mode For The S7-200 Cpu

    PLC Concepts Chapter 4 As shown in Figure 4-19, the S7-200 performs Program block the following tasks after you cycle power with the System block Memory memory cartridge installed: Data block Cartridge Forced values If the contents of the memory cartridge S7-200 CPU differ from the contents of the EEPROM, Program block...
  • Page 50: Using Your Program To Save V Memory To The Eeprom

    S7-200 Programmable Controller System Manual Using Your Program to Save V Memory to the EEPROM You can save a value (byte, word, or double word) stored in any location of the V memory area to the EEPROM. A Save-to-EEPROM operation typically increases the scan time by a maximum of 5 ms. The value written by the Save operation overwrites any previous value stored in the V memory area of the EEPROM.
  • Page 51: Features Of The S7-200

    PLC Concepts Chapter 4 Features of the S7-200 The S7-200 provides several special features that allow you to customize how the S7-200 functions to better fit your application. The S7-200 Allows Your Program to Immediately Read or Write the I/O The S7-200 instruction set provides instructions that immediately read from or write to the physical I/O.
  • Page 52 S7-200 Programmable Controller System Manual The S7-200 Allows You to Allocate Processing Time for Communications Tasks You can configure a percentage of the scan cycle to be dedicated for processing the communications requests that are associated with a RUN mode edit compilation or execution status. (Run mode edit and execution status are options provided by STEP 7–Micro/WIN to make debugging your program easier.) As you increase the percentage of time that is dedicated to processing communications requests, you increase the scan time, which makes your control process run more slowly.
  • Page 53 PLC Concepts Chapter 4 The S7-200 Allows You to Define Memory to Be Retained on Loss of Power You can define up to six retentive ranges to select the areas of memory you want to retain through power cycles. You can define ranges of addresses in the following memory areas to be retentive: V, M, C, and T. For timers, only the retentive timers (TONR) can be retained.
  • Page 54 S7-200 Programmable Controller System Manual The S7-200 Allows You to Filter the Analog Inputs The S7-200 allows you to select software filtering on individual analog inputs. The filtered value is the average value of a preselected number of samples of the analog input. The filter specification (number of samples and deadband) is the same for all analog inputs for which filtering is enabled.
  • Page 55 PLC Concepts Chapter 4 Figure 4-27 shows the basic operation of the S7-200 with and without pulse catch enabled. Scan cycle Next scan cycle Input update Input update Physical Input The S7-200 misses this pulse because the input turned Output from pulse catch on and off before the S7-200 updated the process-image input register Disabled...
  • Page 56 S7-200 Programmable Controller System Manual The S7-200 Provides Password Protection All models of the S7-200 provide password Table 4-3 Restricting Access to the S7-200 protection for restricting access to specific CPU Function Level 1 Level 2 Level 3 functions. Read and write user data Access Access Access...
  • Page 57 PLC Concepts Chapter 4 Recovering from a Lost Password If you forget the password, you must clear the memory of the S7-200 and reload your program. Clearing the memory puts the S7-200 in STOP mode and resets the S7-200 to the factory-set defaults, except for the network address, baud rate, and the time-of-day clock.
  • Page 58 S7-200 Programmable Controller System Manual The S7-200 Provides High-speed I/O High-Speed Counters The S7-200 provides integrated high-speed counter functions that count high speed external events without degrading the performance of the S7-200. See Appendix A for the rates supported by your CPU model.
  • Page 59: Programming Concepts, Conventions, And Features

    Programming Concepts, Conventions, and Features The S7-200 continuously executes your program to control a task or process. You use STEP 7–Micro/WIN to create this program and download it to the S7-200. STEP 7–Micro/WIN provides a variety of tools and features for designing, implementing, and debugging your program. In This Chapter Guidelines for Designing a Micro PLC System .
  • Page 60: Guidelines For Designing A Micro Plc System

    S7-200 Programmable Controller System Manual Guidelines for Designing a Micro PLC System There are many methods for designing a Micro 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.
  • Page 61: Basic Elements Of A Program

    Programming Concepts, Conventions, and Features Chapter 5 Create the Configuration Drawings Based on the requirements of the functional specification, create configuration drawings of the control equipment. Include the following items: Overview showing the location of each S7-200 in relation to the process or machine Mechanical layout of the S7-200 and expansion I/O modules (including cabinets and other equipment) Electrical drawings for each S7-200 and expansion I/O module (including the device model...
  • Page 62 S7-200 Programmable Controller System Manual Main Program The main body of the program contains the instructions that control your application. The S7-200 executes these instructions sequentially, once per scan cycle. The main program is also referred to as OB1. Subroutines These optional elements of your program are executed only when called: by the main program, by an interrupt routine, or by another subroutine.
  • Page 63: Using Step 7-Micro/Win To Create Your Programs

    Programming Concepts, Conventions, and Features Chapter 5 Using STEP 7–Micro/WIN to Create Your Programs To open STEP 7–Micro/WIN, double-click on the STEP 7–Micro/WIN icon, or select the Start > SIMATIC > STEP 7 MicroWIN 3.2 menu command. As shown in Figure 5-1, the STEP 7–Micro/WIN project window provides a convenient working space for creating your control program.
  • Page 64 S7-200 Programmable Controller System Manual Features of the LAD Editor The LAD editor displays the program as a graphical representation similar to electrical wiring diagrams. Ladder programs allow the program to emulate the flow of electric current from a power source through a series of logical input conditions that in turn enable logical output conditions.
  • Page 65: Choosing Between The Simatic And Iec 1131-3 Instruction Sets

    Programming Concepts, Conventions, and Features Chapter 5 Choosing Between the SIMATIC and IEC 1131–3 Instruction Sets Most PLCs offer similar basic instructions, but there are usually small differences from vendor to vendor in appearance, operation, and so forth. Over the last several years, the International Electrotechnical Commission (IEC) has developed an emerging global standard that specifically relates to many aspects of PLC programming.
  • Page 66: Understanding The Conventions Used By The Program Editors

    S7-200 Programmable Controller System Manual Understanding the Conventions Used by the Program Editors STEP 7–Micro/WIN uses the following conventions in all of the program editors: A # in front of a symbol name (#var1) indicates that the symbol is of local scope. For IEC instructions, the % symbol indicates a direct address.
  • Page 67 Programming Concepts, Conventions, and Features Chapter 5 General Conventions of Programming for an S7-200 EN/ENO Definition EN (Enable IN) is a Boolean input for boxes in LAD and FBD. Power flow must be present at this input for the box instruction to be executed. In STL, the instructions do not have an EN input, but the top of stack value must be a logic “1”...
  • Page 68: Using Wizards To Help You Create Your Control Program

    S7-200 Programmable Controller System Manual Using Wizards To Help You Create Your Control Program STEP 7–Micro/WIN provides wizards to make aspects of your programming easier and more automatic. In Chapter 6, instructions that have an associated wizard are identified by the following Instruction Wizard icon: Instruction Wizard...
  • Page 69 Programming Concepts, Conventions, and Features Chapter 5 I/O errors At startup, the S7-200 reads the I/O configuration from each module. During normal operation, the S7-200 periodically checks the status of each module and compares it against the configuration obtained during startup.
  • Page 70: Assigning Addresses And Initial Values In The Data Block Editor

    S7-200 Programmable Controller System Manual Assigning Addresses and Initial Values in the Data Block Editor The data block editor allows you to make initial data assignments to V memory (variable memory) only. You can make assignments to bytes, words, or double words of V memory. Comments are optional. Data The data block editor is a free-form text editor;...
  • Page 71: Using Local Variables

    Programming Concepts, Conventions, and Features Chapter 5 Using Local Variables You can use the local variable table of the program editor to assign variables that are unique to an individual subroutine or interrupt routine. See Figure 5-9. Local variables can be used as parameters that are passed in to a subroutine and they increase the portability or reuse of a subroutine.
  • Page 72: Creating An Instruction Library

    S7-200 Programmable Controller System Manual Creating an Instruction Library STEP 7–Micro/WIN allows you either to create a custom library of instructions, or to use a library created by someone else. See Figure 5-11. To create a library of instructions, you create standard STEP 7–Micro/WIN subroutine and interrupt routines and group them together.
  • Page 73: S7-200 Instruction Set

    S7-200 Instruction Set This chapter describes the SIMATIC and IEC 1131 instruction set for the S7-200 Micro PLCs. In This Chapter Conventions Used to Describe the Instructions ..........S7-200 Memory Ranges and Features .
  • Page 74 S7-200 Programmable Controller System Manual Program Control Instructions ............Conditional End .
  • Page 75: Conventions Used To Describe The Instructions

    S7-200 Instruction Set Chapter 6 Conventions Used to Describe the Instructions Figure 6-1 shows a typical description for an instruction and points to the different areas used to describe the instruction and its operation. The illustration of the instruction shows the format in LAD, FBD, and STL. The operand table lists the operands for the instruction and shows the valid data types, memory areas and sizes for each operand.
  • Page 76: S7-200 Memory Ranges And Features

    S7-200 Programmable Controller System Manual S7-200 Memory Ranges and Features Table 6-1 Memory Ranges and Features for the S7-200 CPUs Description CPU 221 CPU 222 CPU 224 CPU 226 CPU 226XM Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ...
  • Page 77 S7-200 Instruction Set Chapter 6 Table 6-2 Operand Ranges for the S7-200 CPUs Access Method CPU 221 CPU 222 CPU 224, CPU 226 CPU 226XM Bit access (byte.bit) 0.0 to 15.7 0.0 to 15.7 0.0 to 15.7 0.0 to 15.7 0.0 to 15.7 0.0 to 15.7 0.0 to 15.7...
  • Page 78: Bit Logic Instructions

    S7-200 Programmable Controller System Manual Bit Logic Instructions Contacts Standard Contacts The Normally Open contact instructions (LD, A, and O) and Normally Closed contact instructions (LDN, AN, ON) obtain the referenced value from the memory or from the process-image register. The standard contact instructions obtain the referenced value from the memory (or process-image register if the data type is I or Q).
  • Page 79 S7-200 Instruction Set Chapter 6 Because the Positive Transition and Negative Transition instructions require an on-to-off or an off-to-on transition, you cannot detect an edge-up or edge-down transition on the first scan. During the first scan, the S7-200 sets the state of the bit specified by these instructions. On subsequent scans, these instructions can then detect transitions for the specified bit.
  • Page 80: Coils

    S7-200 Programmable Controller System Manual Coils Output The Output instruction (=) writes the new value for the output bit to the process-image register. When the Output instruction is executed, the S7-200 turns the output bit in the process-image register on or off. For LAD and FBD, the specified bit is set equal to power flow.
  • Page 81 S7-200 Instruction Set Chapter 6 Example: Coil Instructions Network 1 //Output instructions assign bit values to external I/O (I, Q) //and internal memory (M, SM, T, C, V, S, L). I0.0 Q0.0 Q0.1 V0.0 Network 2 //Set a sequential group of 6 bits to a value of 1. //Specify a starting bit address and how many bits to set.
  • Page 82: Logic Stack Instructions

    S7-200 Programmable Controller System Manual Logic Stack Instructions AND Load 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 83 S7-200 Instruction Set Chapter 6 As shown in Figure 6-2, the S7-200 uses a logic stack to resolve the control logic. In these examples, “iv0” to “iv7” identify the initial values of the logic stack, “nv” identifies a new value provided by the instruction, and “S0”...
  • Page 84: Set And Reset Dominant Bistable Instructions

    S7-200 Programmable Controller System Manual Set and Reset Dominant Bistable Instructions The 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. The Reset Dominant Bistable is a latch where the reset dominates. If the set (S) and reset (R1) signals are both true, the output (OUT) is false.
  • Page 85: Clock Instructions

    S7-200 Instruction Set Chapter 6 Clock Instructions Read Real-Time Clock and Set Real-Time Clock The Read Real-Time Clock (TODR) instruction reads the current time and date from the hardware clock and loads it in an 8-byte Time buffer starting at address T. The Set Real-Time Clock (TODW) instruction writes the current time and date to the hardware clock, beginning at the 8-byte Time buffer address specified by T.
  • Page 86: Communications Instructions

    S7-200 Programmable Controller System Manual Communications Instructions Network Read and Network Write Instructions The Network Read instruction (NETR) initiates a communications operation to gather data from a remote device through the specified port (PORT), as defined by the table (TBL). The Network Write instruction (NETW) initiates a communications operation to write data to a remote device through the specified port (PORT), as defined by the table (TBL).
  • Page 87 S7-200 Instruction Set Chapter 6 Figure 6-4 describes the table that is referenced by the TBL parameter, and Table 6-10 lists the error codes. Done (function has been completed): 0 = not done 1 = done Byte Offset Active (function has been queued): 0 = not active 1 = active Error (function returned an error):...
  • Page 88 S7-200 Programmable Controller System Manual Case Packer #1 Case Packer #2 Case Packer #3 Case Packer #4 Diverter Station 2 Station 3 Station 4 Station 5 Station 6 TD 200 Station 1 VB100 Control VB100 Control VB100 Control VB100 Control VB200 VB300 Buffers...
  • Page 89 S7-200 Instruction Set Chapter 6 Example: Network Read and Network Write Instructions Network 1 //On the first scan, enable the PPI master mode /and clear all receive and transmit buffers. SM0.1 MOVB 2, SMB30 FILL +0, VW200, 68 Network 2 //When the NETR Done bit (V200.7) is set //and 100 cases have been packed: //1.
  • Page 90 S7-200 Programmable Controller System Manual Example: Network Read and Network Write Instructions , continued Network 4 //If not the first scan and there are no errors: //1. Load the station address of case packer #1. //2. Load a pointer to the data in the remote station. //3.
  • Page 91: Transmit And Receive Instructions (Freeport)

    S7-200 Instruction Set Chapter 6 Transmit and Receive Instructions (Freeport) The Transmit instruction (XMT) is used in Freeport mode to transmit data by means of the communications port(s). The Receive instruction (RCV) initiates or terminates the receive message function. You must specify a start and an end condition for the Receive box to operate.
  • Page 92 S7-200 Programmable Controller System Manual Changing PPI Communications to Freeport Mode SMB30 and SMB130 configure the communications ports, 0 and 1 respectively, for Freeport operation and provide selection of baud rate, parity, and number of data bits. Figure 6-7 describes the Freeport control byte.
  • Page 93 S7-200 Instruction Set Chapter 6 As shown in Table 6-12, the Receive instruction allows you to select the message start and message end conditions, using SMB86 through SMB94 for port 0 and SMB186 through SMB194 for port 1. The receive message function is automatically terminated in case of an overrun or a parity error. You must define a start condition and an end condition (maximum character count) for the receive message function to operate.
  • Page 94 S7-200 Programmable Controller System Manual 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. 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 error and termination of the receive message function.
  • Page 95 S7-200 Instruction Set Chapter 6 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 96 S7-200 Programmable Controller System Manual 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 97 S7-200 Instruction Set Chapter 6 Characters Characters Start of the message: The message timer expires: Starts the message timer Terminates the message and generates the Receive Message interrupt Figure 6-12 Using the Message Timer to Terminate the Receive Instruction Maximum character count: The Receive instruction must be told the maximum number of characters to receive (SMB94 or SMB194).
  • Page 98 S7-200 Programmable Controller System Manual Example: Transmit and Receive Instructions 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. SM0.1 //On the first scan: MOVB 16#09, SMB30 //1.
  • Page 99 S7-200 Instruction Set Chapter 6 Example: Transmit and Receive Instructions, continued Network 1 //Receive complete interrupt routine: //1. If receive status shows receive of end character, then attach a 10 ms timer to trigger a transmit and return. //2. If the receive completed for any other reason, then start a new receive.
  • Page 100: Get Port Address And Set Port Address Instructions

    S7-200 Programmable Controller System Manual Get Port Address and Set Port Address Instructions The Get Port Address instruction (GPA) reads the station address of the S7-200 CPU port specified in PORT and places the value in the address specified in ADDR. The Set Port Address instruction (SPA) sets the port station address (PORT) to the value specified in ADDR.
  • Page 101: Compare Instructions

    S7-200 Instruction Set Chapter 6 Compare Instructions Comparing Numerical Values The compare instructions are used to compare two values: IN1 = IN2 IN1 >= IN2 IN1 <= IN2 IN1 > IN2 IN1 < IN2 IN1 <> IN2 Compare Byte operations are unsigned. Compare Integer operations are signed.
  • Page 102 S7-200 Programmable Controller System Manual Example: Compare Instructions Network 1 //Turn analog adjustment potentiometer 0 to vary //the SMB28 byte value. //Q0.0 is active when the SMB28 value is less than //or equal to 50. //Q0.1 is active when the SMB28 value is greater than //or equal to 150.
  • Page 103: Compare String

    S7-200 Instruction Set Chapter 6 Compare String The Compare String instruction compares two strings of ASCII characters: IN1 = IN2 IN1 <> IN2 When the comparison is true, the Compare instruction turns the contact (LAD) or output (FBD) on, or the compare instruction Loads, ANDs or ORs a 1 with the value on the top of the stack (STL).
  • Page 104: Conversion Instructions

    S7-200 Programmable Controller System Manual Conversion Instructions Standard Conversion Instructions Numerical Conversions The Byte to Integer (BTI), Integer to Byte (ITB), Integer to Double Integer (ITD), Double Integer to Integer (DTI), Double Integer to Real (DTR), BCD to Integer (BCDI) and Integer to BCD (IBCD) instructions convert an input value IN to the specified format and stores the output value in the memory location specified by OUT.
  • Page 105 S7-200 Instruction Set Chapter 6 Operation of the BCD to Integer and Integer to BCD Instructions The BCD to Integer instruction (BCDI) converts the binary-coded Error conditions that set ENO = 0 decimal value IN to an integer value and loads the result into the H SM1.6 (invalid BCD) variable specified by OUT.
  • Page 106 S7-200 Programmable Controller System Manual Operation of the Round and Truncate Instructions The Round instruction (ROUND) converts the real-number value IN Error conditions that set ENO = 0 to a double integer value and places the result into the variable H SM1.1 (overflow) specified by OUT.
  • Page 107 S7-200 Instruction Set Chapter 6 Operation of the Segment Instruction To illuminate the segments of a seven-segment display, the Segment instruction (SEG) converts the character (byte) specified by IN to generate a bit pattern (byte) at the location specified by OUT. The illuminated segments represent the character in the least Error conditions that set ENO = 0 H 0006 (indirect address)
  • Page 108: Ascii Conversion Instructions

    S7-200 Programmable Controller System Manual ASCII Conversion Instructions Valid ASCII characters are the hexadecimal values 30 to 39, and 41 to 46. Converting between ASCII and Hexadecimal Values The ASCII to Hexadecimal instruction (ATH) converts a number LEN of ASCII characters, starting at IN, to hexadecimal digits starting at OUT.
  • Page 109 S7-200 Instruction Set Chapter 6 Figure 6-14 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 output buffer is formatted according to the following rules: Positive values are written to the output buffer without a sign.
  • Page 110 S7-200 Programmable Controller System Manual Operation of the Real to ASCII Instruction The Real to ASCII instruction (RTA) converts a real-number value IN Error conditions that set ENO = 0 to ASCII characters. The format FMT specifies the conversion H 0006 (indirect address) precision to the right of the decimal, whether the decimal point is H nnn >...
  • Page 111 S7-200 Instruction Set Chapter 6 Example: ASCII to Hexadecimal Instruction Network 1 I3.2 VB30, VB40, 3 ‘3’ ‘E’ ‘A’ Note: The X indicates that the “nibble” (half of a byte) is unchanged. VB30 VB40 Example: Integer to ASCII Instruction Network 1 //Convert the integer value at VW2 //to 8 ASCII characters starting at VB10, //using a format of 16#0B...
  • Page 112: String Conversion Instructions

    S7-200 Programmable Controller System Manual String Conversion Instructions Converting Numerical Values to String The Integer to String (ITS), Double Integer to String (DTS), and Real to String (RTS) instructions convert integers, double integers, or real number values (IN) to an ASCII string (OUT). Operation of the Integer to String The Integer to String instruction (ITS) converts an integer word IN to an ASCII string with a length of 8 characters.
  • Page 113 S7-200 Instruction Set Chapter 6 Out Out Out in=12 in=–123 in=1234 c = comma (1) or decimal point (0) nnn = digits to right of decimal point in = –12345 – Figure 6-17 FMT Operand for the Integer to String Instruction Operation of the Double Integer to String The Double Integer to String instruction (DTS) converts a double Error conditions that set ENO = 0...
  • Page 114 S7-200 Programmable Controller System Manual Operation of the Real to String The Real to String instruction (RTS) converts a real value IN to an Error conditions that set ENO = 0 ASCII string. The format (FMT) specifies the conversion precision to H 0006 (indirect address) the right of the decimal, whether the decimal point is to be shown as H 0091 (operand out of range)
  • Page 115 S7-200 Instruction Set Chapter 6 Converting Substrings to Numerical Values The Substring to Integer (STI), Substring to Double Integer (STD), and Substring to Real (STR) instructions convert a string value IN, starting at the offset INDX, to an integer, double integer or real number value OUT.
  • Page 116 S7-200 Programmable Controller System Manual Valid Input Strings Valid Input Strings for Integer and Double Integer for Real Numbers Invalid Input Strings Input String Output Integer Input String Output Real Input String ‘123’ ‘123’ 123.0 ‘A123’ ‘–00456’ –456 ‘–00456’ –456.0 ‘...
  • Page 117: Encode And Decode Instructions

    S7-200 Instruction Set Chapter 6 Encode and Decode Instructions Encode The Encode instruction (ENCO) writes the bit number of the least significant bit set of the input word IN into the least significant “nibble” (4 bits) of the output byte OUT. Decode The Decode instruction (DECO) sets the bit in the output word OUT that corresponds to the bit number represented by the least...
  • Page 118: Counter Instructions

    S7-200 Programmable Controller System Manual Counter Instructions SIMATIC Counter Instructions Count Up Counter The Count Up instruction (CTU) counts up from the current value each time the count up (CU) input makes the transition from off to on. When the current value Cxx is greater than or equal to the preset value PV, the counter bit Cxx turns on.
  • Page 119 S7-200 Instruction Set Chapter 6 Since there is one current value for each counter, do not assign the same number to more than one counter. (Up Counters, Up/Down Counters, and Down counters with the same number access the same current value.) When you reset a counter using the Reset instruction, the counter bit is reset and the counter current value is set to zero.
  • Page 120 S7-200 Programmable Controller System Manual Example: SIMATIC Count Up/Down Counter Instruction Network 1 //I0.0 counts up //I0.1 counts down //I0.2 resets current value to 0 I0.0 I0.1 I0.2 CTUD C48, +4 Network 2 //Count Up/Down counter C48 turns on C48 bit //when current value >= 4 Q0.0 Timing Diagram...
  • Page 121: Iec Counter Instructions

    S7-200 Instruction Set Chapter 6 IEC Counter Instructions Up Counter The Count Up instruction (CTU) counts up from the current value to the preset value (PV) on the rising edges of the Count Up (CU) input. When the current value (CV) is greater than or equal to the preset value, the counter output bit (Q) turns on.
  • Page 122 S7-200 Programmable Controller System Manual Example: IEC Counter Instructions Timing Diagram I4.0 CU – Up I3.0 CD – Down I2.0 R – Reset I1.0 LD – Load CV – Current Value Q0.0 QU – Up Q0.1 QD – Down...
  • Page 123: High-Speed Counter Instructions

    S7-200 Instruction Set Chapter 6 High-Speed Counter Instructions High-Speed Counter Definition The High-Speed Counter Definition instruction (HDEF) selects the operating mode of a specific high-speed counter (HSCx). The mode selection defines the clock, direction, start, and reset functions of the high-speed counter.
  • Page 124 S7-200 Programmable Controller System Manual Typically, a high-speed counter is 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.
  • Page 125 S7-200 Instruction Set Chapter 6 Defining Counter Modes and Inputs Use the High-Speed Counter Definition instruction to define the counter modes and inputs. Table 6-25 shows the inputs used for the clock, direction control, reset, and start functions associated with the high-speed counters.
  • Page 126 S7-200 Programmable Controller System Manual Examples of HSC Modes The timing diagrams in Figure 6-21 through Figure 6-25 show how each counter functions according to mode. Current value loaded to 0, preset loaded to 4, counting direction set to up. Counter enable bit set to enabled.
  • Page 127 S7-200 Instruction Set Chapter 6 When you use counting modes 6, 7, or 8, 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 128 S7-200 Programmable Controller System Manual Current value loaded to 0, preset loaded to 9, initial counting direction set to up. Counter enable bit set to enabled. Direction Changed PV=CV interrupt generated interrupt generated PV=CV interrupt generated Phase A Clock Phase B Clock Counter Current Value...
  • Page 129 S7-200 Instruction Set Chapter 6 Four counters have three control bits that are used to configure the active state of the reset and start inputs and to select 1x or 4x counting modes (quadrature counters only). These bits are located in the control byte for the respective counter and are only used when the HDEF instruction is executed.
  • Page 130 S7-200 Programmable Controller System Manual Setting the Control Byte After you define the counter and the counter mode, you can program the dynamic parameters of the counter. Each high-speed counter has a control byte that allows the following actions: Enabling or disabling the counter Controlling the direction (modes 0, 1, and 2 only), or the initial counting direction for all other modes Loading the current value Loading the preset value...
  • Page 131 S7-200 Instruction Set Chapter 6 Addressing the High-Speed Counters (HC) To access the count value for the high-speed counter, specify the address of the high-speed counter, using the memory type (HC) and the counter number (such as HC0). The current value of the high-speed counter is a read-only value that can be addressed only as a double word (32 bits), as shown in Figure 6-27.
  • Page 132 S7-200 Programmable Controller System Manual Sample Initialization Sequences for the High-Speed Counters HSC1 is used as the model counter in the following descriptions of the initialization and operation sequences. The initialization descriptions assume that the S7-200 has just been placed in RUN mode, and for that reason, the first scan memory bit is true.
  • Page 133 S7-200 Instruction Set Chapter 6 Initialization Modes 3, 4, or 5 The following steps describe how to initialize HSC1 for Single Phase Up/Down Counter with External Direction (Modes 3, 4, or 5): Use the first scan memory bit to call a subroutine in which the initialization operation is performed. Since you use a subroutine call, subsequent scans do not make the call to the subroutine, which reduces scan time execution and provides a more structured program.
  • Page 134 S7-200 Programmable Controller System Manual In order to capture direction changes, program an interrupt by attaching the direction changed interrupt event (event 14) to an interrupt routine. In order to capture an external reset event, program an interrupt by attaching the external reset interrupt event (event 15) to an interrupt routine.
  • Page 135 S7-200 Instruction Set Chapter 6 Change Direction in Modes 0, 1, or 2 The following steps describe how to configure HSC1 for Change Direction for Single Phase Counter with Internal Direction (Modes 0, 1, or 2): Load SMB47 to write the desired direction: SMB47 = 16#90 Enables the counter Sets the direction of the HSC to count down...
  • Page 136 S7-200 Programmable Controller System Manual Example: High-Speed Counter Instruction Network 1 //On the first scan, call SBR_0. SM0.1 CALL SBR_0 Network 1 //On the first scan, configure HSC1: //1. Enable the counter. – Write a new current value. – Write a new preset value. –...
  • Page 137: Pulse Output Instruction

    S7-200 Instruction Set Chapter 6 Pulse Output Instruction The Pulse Output instruction (PLS) is used to control the Pulse Train Output (PTO) and Pulse Width Modulation (PWM) functions available on the high-speed outputs (Q0.0 and Q0.1).You can use Position the Position Control wizard to configure the pulse outputs. Control PTO provides a square wave (50% duty cycle) output with user control of the cycle time and the number of pulses.
  • Page 138 S7-200 Programmable Controller System Manual Pulse Train Operation (PTO) PTO provides a square wave (50% duty cycle) output for a specified number of pulses and a specified cycle time. (See Figure 6-28.) PTO can produce either a single train of pulses or multiple trains of pulses (using a pulse profile).
  • Page 139 S7-200 Instruction Set Chapter 6 Table 6-32 Profile Table Format for Multiple-Segment PTO Operation Byte Offset Segment Description of Table Entries Number of segments: 1 to 255 Initial cycle time (2 to 65,535 units of the time base) Cycle time delta per pulse (signed value) (–32,768 to 32,767 units of the time base) Pulse count (1 to 4,294,967,295) Initial cycle time (2 to 65,535 units of the time base) Cycle time delta per pulse (signed value) (–32,768 to 32,767 units of the time base)
  • Page 140 S7-200 Programmable Controller System Manual The PWM Update Method bit (SM67.4 or SM77.4) in the control byte specifies the update type used when the PLS instruction is executed to invoke changes. If the time base is changed, an asynchronous update occurs regardless of the state of the PWM Update Method bit.
  • Page 141 S7-200 Instruction Set Chapter 6 Table 6-34 SM Locations of the PTO / PWM Control Registers Q0.0 Q0.1 Status Bits SM66.4 SM76.4 PTO profile aborted (delta calculation error): 0 = no error 1 = aborted SM66.5 SM76.5 PTO profile aborted due to user command: 0 = no abort 1 = aborted SM66.6...
  • Page 142 S7-200 Programmable Controller System Manual Calculating Profile Table Values The multiple-segment pipelining capability of the PTO/PWM Frequency generators can be useful in many applications, particularly in 10 kHz stepper motor control. 2 kHz For example, you can use PTO with a pulse profile to control a stepper motor through a simple ramp up, run, and ramp Time down sequence or more complicated sequences by defining...
  • Page 143 S7-200 Instruction Set Chapter 6 In order to determine if the transitions between waveform segments are acceptable, you need to determine the cycle time of the last pulse in a segment. Unless the delta cycle time is 0, you must calculate the cycle time of the last pulse of a segment, because this value is not specified in the profile.
  • Page 144 S7-200 Programmable Controller System Manual Sample Operation of a PWM Output The following description of the PWM initialization and operation sequences recommends using the First Scan bit (SM0.1) to initialize the pulse output. Using the First Scan bit to call an initialization subroutine reduces the scan time because subsequent scans do not call this subroutine.
  • Page 145 S7-200 Instruction Set Chapter 6 Example: Pulse Width Modulation (PWM) Network 1 //On the first scan, //set the image register bit low and call SBR_0. SM0.1 Q0.1, 1 CALL SBR_0 Network 2 //Set M0.0 elsewhere in the program //to change pulse width to 50% duty cycle. M0.0 CALL SBR_1...
  • Page 146 S7-200 Programmable Controller System Manual Sample Operation of a PTO Output The following description of the PTO initialization and operation sequences recommends using the First Scan memory bit (SM0.1) to initialize the pulse output. Using the First Scan bit to call an initialization subroutine reduces the scan time because subsequent scans do not call this subroutine.
  • Page 147 S7-200 Instruction Set Chapter 6 Changing the PTO Pulse Count (Single-Segment Operation) For a single-segment PTO operation, you can use an interrupt routine or a subroutine to change the pulse count. To change the PTO pulse count in an interrupt routine or a subroutine when using a single-segment PTO operation, follow these steps: Set the control byte (to enable the PTO/PWM function, to select PTO operation, to select the time base, and to set the update pulse count value) by loading either of the following values in SMB67:...
  • Page 148 S7-200 Programmable Controller System Manual Example: Single-Segment Pulse Train Operation (PTO) Network 1 //On the first scan, //set the image register bit low and call subroutine 0. SM0.1 Q0.0, 1 CALL SBR_0 Network 1 //Start of subroutine 0: Configure PTO //1.
  • Page 149 S7-200 Instruction Set Chapter 6 Example: Single-Segment Pulse Train Operation (PTO), continued Network 1 //If current cycle time is 500 ms: //Set the cycle time to 1000 ms and generate 4 pulses. LDW= SMW68, +500 MOVW +1000, SMW68 CRETI Network 2 //If current cycle time is 1000 ms: //Set the cycle time to 500 ms and generate 4 pulses.
  • Page 150 S7-200 Programmable Controller System Manual Example: Multiple-Segment Pulse Train Operation (PTO) Network 1 //On the first scan, //set the image register bit low and call subroutine 0 SM0.1 Q0.0, 1 CALL SBR_0 Network 1 //Preload the PTO profile table: //Set number of profile table segments to 3. //Configure each of the 3 segments.
  • Page 151 S7-200 Instruction Set Chapter 6 Example: Multiple-Segment Pulse Train Operation (PTO) , continued Network 2 //1. Set up the control byte: – Select PTO operation – Select multiple segment operation – Select ms increments – Enable the PTO function //2. Set the start address of the profile table to V500. //3.
  • Page 152: Math Instructions

    S7-200 Programmable Controller System Manual Math Instructions Add, Subtract, Multiply, and Divide Instructions Subtract IN1 + IN2 = OUT IN1 – IN2 = OUT LAD and FBD IN1 + OUT = OUT OUT – IN1 = OUT The Add Integer (+I) or Subtract Integer (–I) instructions add or subtract two 16-bit integers to produce a 16-bit result.
  • Page 153 S7-200 Instruction Set Chapter 6 Example: Integer Math Instructions Network 1 I0.0 AC1, AC0 AC1, VW100 VW10, VW200 Multiply Divide 4000 VW200 VW10 VW200 VW100 VW100 Example: Real Math Instructions Network 1 I0.0 AC1, AC0 AC1, VD100 VD10, VD200 Multiply Divide 4000.0 6000.0...
  • Page 154: Multiply Integer To Double Integer And Divide Integer With Remainder

    S7-200 Programmable Controller System Manual Multiply Integer to Double Integer and Divide Integer with Remainder Multiply Integer to Double Integer IN1 * IN2 = OUT LAD and FBD IN1 * OUT = OUT The Multiply Integer to Double Integer instruction (MUL) multiplies two 16-bit integers and produces a 32-bit product.
  • Page 155: Numeric Functions Instructions

    S7-200 Instruction Set Chapter 6 Numeric Functions Instructions Sine, Cosine, and Tangent The Sine (SIN), Cosine (COS), and Tangent (TAN) instructions evaluate the trigonometric function of the angle value IN and place the result in OUT. The input angle value is in radians. SIN (IN) = OUT COS (IN) = OUT TAN (IN) = OUT...
  • Page 156: Increment And Decrement Instructions

    S7-200 Programmable Controller System Manual Increment and Decrement Instructions Increment IN + 1 = OUT LAD and FBD OUT + 1 = OUT Decrement IN – 1 = OUT LAD and FBD OUT – 1 = OUT The Increment and Decrement instructions add or subtract 1 to or from the input IN and place the result into the variable OUT.
  • Page 157: Proportional/Integral/Derivative (Pid) Loop Instruction

    S7-200 Instruction Set Chapter 6 Proportional/Integral/Derivative (PID) Loop Instruction The PID Loop instruction (PID) executes a PID loop calculation on the referenced LOOP based on the input and configuration information in Table (TBL). Error conditions that set ENO = 0: H SM1.1 (overflow) H 0006 (indirect address) Special Memory bits affected:...
  • Page 158 S7-200 Programmable Controller System Manual Understanding the 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 159 S7-200 Instruction Set Chapter 6 The S7-200 uses a modified form of the above simplified equation when calculating the loop output value. This modified equation is: output proportional term integral term differential term where: is the calculated value of the loop output at sample time n is the value of the proportional term of the loop output at sample time n is the value of the integral term of the loop output at sample time n is the value of the differential term of the loop output at sample time n...
  • Page 160 S7-200 Programmable Controller System Manual Understanding the Differential Term of the PID Equation The differential term MD is proportional to the change in the error. The S7-200 uses the following equation for the differential term: ((SP – PV ) – (SP –...
  • Page 161 S7-200 Instruction Set Chapter 6 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.
  • Page 162 S7-200 Programmable Controller System Manual 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.
  • Page 163 S7-200 Instruction Set Chapter 6 By adjusting the bias as described, an improvement in system responsiveness is achieved once the calculated output comes back into the proper range. The calculated bias is also clamped between 0.0 and 1.0 and then is written to the bias field of the loop table at the completion of each PID calculation. The value stored in the loop table is used in the next PID calculation.
  • Page 164 S7-200 Programmable Controller System Manual Loop Table The loop table is 36 bytes long and has the format shown in Table 6-42. Table 6-42 Loop Table Offset Field Format Type Description Process variable Double word Contains the process variable, which must be scaled –...
  • Page 165 S7-200 Instruction Set Chapter 6 Example: PID Loop Instruction Network 1 //On the first scan, //Call the initialization subroutine SM0.1 CALL SBR_0 Network 1 //Load PID parameters and //attach the PID interrupt routine: //1. Load the loop setpoint = 75% full. //2.
  • Page 166 S7-200 Programmable Controller System Manual Example: PID Loop Instruction, continued Network 1 //Scale the PV to a normalized real number: //1. Convert the integer value to a double integer. //2. Convert the double integer to a real number. //3. Normalize the value. //4.
  • Page 167: Interrupt Instructions

    S7-200 Instruction Set Chapter 6 Interrupt Instructions Enable Interrupt and Disable Interrupt The Enable Interrupt instruction (ENI) globally enables processing of all attached interrupt events. The Disable Interrupt instruction (DISI) globally disables processing of all interrupt events. When you make the transition to RUN mode, interrupts are initially disabled.
  • Page 168 S7-200 Programmable Controller System Manual You can disable individual interrupt events by breaking the association between the interrupt event and the interrupt routine with the Detach Interrupt instruction. The Detach Interrupt instruction returns the interrupt to an inactive or ignored state. Table 6-44 lists the different types of interrupt events. Table 6-44 Interrupt Events CPU 221...
  • Page 169 S7-200 Instruction Set Chapter 6 Understanding How the S7-200 Processes Interrupt Routines The interrupt routine is executed in response to an associated internal or external event. Once the last instruction of the interrupt routine has been executed, control is returned to the main program. You can exit the routine by executing a Conditional Return from Interrupt instruction (CRETI).
  • Page 170 S7-200 Programmable Controller System Manual Calling Subroutines from Interrupt Routines You can call one nesting level of subroutines from an interrupt routine. The accumulators and the logic stack are shared between an interrupt routine and a subroutine that is called. Types of Interrupts Supported by the S7-200 The S7-200 supports the following types of interrupt routines: Communications port interrupts: The S7-200 generates events that allow your program to control...
  • Page 171 S7-200 Instruction Set Chapter 6 After being enabled, the timed interrupt runs continuously, executing the attached interrupt routine on each expiration of the specified time interval. If you exit RUN mode or detach the timed interrupt, the timed interrupt is disabled. If the global disable interrupt instruction is executed, timed interrupts continue to occur.
  • Page 172 S7-200 Programmable Controller System Manual Table 6-48 Priority Order for Interrupt Events Event Description Priority Group Priority in Group Port 0 Receive character Communications Highest Priority Port 0 Transmit complete Port 0 Receive message complete Port 1 Receive message complete Port 1 Receive character Port 1...
  • Page 173 S7-200 Instruction Set Chapter 6 Example: Interrupt Instructions Network 1 //On the first scan: //1. Define interrupt routine INT_0 to be a falling-edge interrupt for I0.0 //2. Globally enable interrupts. SM0.1 ATCH INT_0, 1 Network 2 //If an I/O error is detected, //disable the falling-edge interrupt for I0.0.
  • Page 174: Logical Operations Instructions

    S7-200 Programmable Controller System Manual Logical Operations Instructions Invert Instructions Invert Byte, Word, and Double Word The Invert Byte (INVB), Invert Word (INVW), and Invert Double Word (INVD) instructions form the one’s complement of the input IN and load the result into the memory location OUT. Error conditions that set ENO = 0 H 0006 (indirect address) SM bits affected:...
  • Page 175: And, Or, And Exclusive Or Instructions

    S7-200 Instruction Set Chapter 6 AND, OR, and Exclusive OR Instructions AND Byte, AND Word, and AND Double Word The AND Byte (ANDB), AND Word (ANDW), and AND Double Word (ANDD) instructions AND the corresponding bits of two input values IN1 and IN2 and load the result in a memory location OUT.
  • Page 176 S7-200 Programmable Controller System Manual Example: AND, OR, and Exclusive OR Instructions Network 1 I4.0 ANDW AC1, AC0 AC1, VW100 XORW AC1, AC0 AND Word OR Word 0001 1111 0110 1101 0001 1111 0110 1101 1101 0011 1110 0110 VW100 1101 0011 1010 0000 equals equals...
  • Page 177: Move Instructions

    S7-200 Instruction Set Chapter 6 Move Instructions Move Byte, Word, Double Word, or Real The Move Byte (MOVB), Move Word (MOVW), Move Double Word (MOVD), and Move Real (MOVR) instructions move a value from a memory location IN to a new memory location OUT without changing the original value.
  • Page 178: Move Byte Immediate (Read And Write)

    S7-200 Programmable Controller System Manual Move Byte Immediate (Read and Write) The Move Byte Immediate instructions allow you to immediately move a byte between the physical I/O and a memory location. The Move Byte Immediate Read (BIR) instruction reads physical input (IN) and writes the result to the memory address (OUT), but the process-image register is not updated.
  • Page 179: Block Move Instructions

    S7-200 Instruction Set Chapter 6 Block Move Instructions Block Move Byte, Word, or Double Word The Block Move Byte (BMB), Block Move Word (BMW), and Block Move Double Word (BMD) instructions move a specified amount of data to a new memory location by moving the number of bytes, words, or double words N starting at the input address IN to a new block starting at the output address OUT.
  • Page 180: Program Control Instructions

    S7-200 Programmable Controller System Manual Program Control Instructions Conditional End The Conditional End instruction (END) 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 181 S7-200 Instruction Set Chapter 6 Example: Stop, End, and Watchdog Reset Instructions Network 1 //When an I/O error is detected: //Force the transition to STOP mode. SM5.0 STOP Network 2 //When M5.6 is on, allow the scan to be extended: //1.
  • Page 182: For-Next Loop Instructions

    S7-200 Programmable Controller System Manual For–Next Loop Instructions Use the For (FOR) and Next (NEXT) instructions to delineate a loop that is repeated for the specified count. Each For instruction requires a Next instruction. You can nest For–Next loops (place a For–Next loop within a For–Next loop) to a depth of eight.
  • Page 183 S7-200 Instruction Set Chapter 6 Example: For–Next Loop Instructions Network 1 //When I2.0 comes on, the outside loop //(arrow 1) is executed 100 times I2.0 VW100, +1, +100 Network 2 //The inside loop (arrow 2) is executed twice //for each execution of the outside loop //when I2.1 is on.
  • Page 184: Jump Instructions

    S7-200 Programmable Controller System Manual Jump Instructions The Jump to Label instruction (JMP) performs a branch to the specified label N within the program. The Label instruction (LBL) marks the location of the jump destination N. You can use the Jump instruction in the main program, in subroutines, or in interrupt routines.
  • Page 185: Sequence Control Relay (Scr) Instructions

    S7-200 Instruction Set Chapter 6 Sequence Control Relay (SCR) Instructions SCR instructions provide you with a simple yet powerful state control programming technique that fits naturally into a LAD, FBD, or STL program. Whenever your application consists of a sequence of operations that must be performed repetitively, SCRs can be used to structure your program so that it corresponds directly to your application.
  • Page 186 S7-200 Programmable Controller System Manual Figure 6-31 shows the S stack and the logic stack and the effect of executing the Load SCR instruction. The following is true of Sequence Control Relay instructions: The Load SCR instruction (LSCR) marks the beginning of an SCR segment, and the SCR End instruction (SCRE) marks the end of an SCR segment.
  • Page 187 S7-200 Instruction Set Chapter 6 Example: Sequence Control Relay Instruction Network 1 //On the first scan enable State 1. SM0.1 S0.1, 1 Network 2 //Beginning of State 1 control region. LSCR S0.1 Network 3 //Control the signals for Street 1: //1.
  • Page 188 S7-200 Programmable Controller System Manual Divergence Control In many applications, a single stream of sequential states must be split into two or more different streams. When a control stream diverges into multiple streams, all outgoing streams must be activated simultaneously. This is shown in Figure 6-32. State L Transition Condition State M...
  • Page 189 S7-200 Instruction Set Chapter 6 State L State M Transition Condition State N Figure 6-33 Convergence of a Control Stream Example: Convergence of Control Streams Network 1 //Beginning of State L control region LSCR S3.4 Network 2 //Transition to State L’ V100.5 SCRT S3.5...
  • Page 190 S7-200 Programmable Controller System Manual In other situations, a control stream might be directed into one of several possible control streams, depending upon which transition condition comes true first. Such a situation is depicted in Figure 6-34, which shows an equivalent SCR program. State L Transition Condition Transition Condition...
  • Page 191: Shift And Rotate Instructions

    S7-200 Instruction Set Chapter 6 Shift and Rotate Instructions Shift Right and Shift Left Instructions The Shift instructions shift the input value IN right or left by the shift count N and load the result in the output OUT. The Shift instructions fill with zeros as each bit is shifted out If the shift count (N) is greater than or equal to the maximum allowed (8 for byte operations, 16 for word operations, and 32 for double word...
  • Page 192 S7-200 Programmable Controller System Manual Example: Shift and Rotate Instructions Network 1 I4.0 AC0, 2 VW200, 3 Rotate Shift Before rotate Overflow Before shift Overflow 0100 0000 0000 0001 VW200 1110 0010 1010 1101 After first rotate Overflow After first shift Overflow 1010 0000 0000 0000 VW200...
  • Page 193: Shift Register Bit Instruction

    S7-200 Instruction Set Chapter 6 Shift Register Bit Instruction The Shift Register Bit instruction shifts a 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.
  • Page 194 S7-200 Programmable Controller System Manual Example: Shift Register Bit Instruction Network 1 I0.2 SHRB I0.3, V100.0, +4 Timing Diagram 7 (MSB) 0 (LSB) S_BIT Before first shift V100 I0.3 I0.2 Overflow (SM1.1) S_BIT Positive After first shift V100 I0.3 transition (P) I0.3 Overflow (SM1.1) S_BIT...
  • Page 195: Swap Bytes Instruction

    S7-200 Instruction Set Chapter 6 Swap Bytes Instruction The Swap Bytes instruction exchanges the most significant byte with the least significant byte of the word IN. Error conditions that set ENO = 0 H 0006 (indirect address) Table 6-60 Valid Operands for the Swap Bytes Instruction Inputs/Outputs Data Types Operands WORD...
  • Page 196: String Instructions

    S7-200 Programmable Controller System Manual String Instructions String Length The String Length instruction (SLEN) returns the length of the string specified by IN. Copy String The Copy String instruction (SCPY) copies the string specified by IN to the string specified by OUT. Concatenate String The Concatenate String instruction (SCAT) appends the string specified by IN to the end of the string specified by OUT.
  • Page 197 S7-200 Instruction Set Chapter 6 Example: Concatenate String, Copy String, and String Length Instructions Network 1 //1. Append the string at VB20 to the string at VB0 //2. Copy the string at VB0 to a new string at VB100 //3. Get the length of the string that starts at VB100 I0.0 SCAT...
  • Page 198 S7-200 Programmable Controller System Manual Copy Substring from String The Copy Substring from String instruction (SSCPY) copies the specified number of characters N from the string specified by IN, starting at the index INDX, to a new string specified by OUT. Error conditions that set ENO = 0 H 0006 (indirect address) H 0091 (range error)
  • Page 199 S7-200 Instruction Set Chapter 6 Find String Within String The Find String Within String instruction (SFND) searches for the first occurrence of the string IN2 within the string IN1. The search begins at the starting position specified by OUT. If a sequence of characters is found that matches exactly the string IN2, the position of the first character in the sequence for the string is written to OUT.
  • Page 200 S7-200 Programmable Controller System Manual Example: Find String Within String Instruction The following example uses a string stored at VB0 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 201: Add To Table

    S7-200 Instruction Set Chapter 6 Table Instructions Add To Table The Add To Table instruction adds word values (DATA) to a table (TBL). The first value of the table is the maximum table length (TL). The second value is the entry count (EC), which specifies the number of entries in the table.
  • Page 202: First-In-First-Out And Last-In-First-Out

    S7-200 Programmable Controller System Manual First-In-First-Out and Last-In-First-Out A table can have up to 100 data entries. First-In-First-Out The First-In-First-Out instruction (FIFO) moves the oldest (or first) entry in a table to the output memory address by removing the first entry in the table (TBL) and moving the value to the location specified by DATA.
  • Page 203 S7-200 Instruction Set Chapter 6 Example: Last-In-First-Out Instruction Network 1 I0.1 LIFO VW200, VW300 Before execution of LIFO After execution of LIFO VW300 1234 VW200 0006 TL (max. no. of entries) VW200 0006 TL (max. no. of entries) VW202 0003 EC (entry count) VW202 0002...
  • Page 204: Memory Fill

    S7-200 Programmable Controller System Manual Memory Fill The Memory Fill instruction (FILL) writes N consecutive words, beginning at address OUT, with the word value contained in address N has a range of 1 to 255. Error conditions that set ENO = 0 H 0006 (indirect address) H 0091 (operand out of range) Table 6-67...
  • Page 205 S7-200 Instruction Set Chapter 6 Table Find The Table Find instruction (FND) searches a table for data that matches certain criteria. The Table Find instruction searches the table TBL, starting with the table entry INDX, for the data value or pattern PTN that matches the search criteria defined by CMD.
  • Page 206 S7-200 Programmable Controller System Manual Example: Table Find Instruction Network 1 I2.1 FND= VW202, 16#3130, AC1 When I2.1 is on, search the table for AC1 must be set to 0 to search from the top of a value equal to 3130 HEX. table.
  • Page 207 S7-200 Instruction Set Chapter 6 Example: Creating a 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.
  • Page 208: Timer Instructions

    S7-200 Programmable Controller System Manual Timer Instructions SIMATIC Timer Instructions On-Delay Timer Retentive On-Delay Timer The On-Delay Timer (TON) and Retentive On-Delay Timer (TONR) instructions count time when the enabling input is on. The timer number (Txx) determines the resolution of the timer. Off-Delay Timer The Off-Delay Timer (TOF) is used to delay turning an output off for a fixed period of time after the input turns off.
  • Page 209 S7-200 Instruction Set Chapter 6 The TON and TONR instructions count time when the enabling input is on. When the current value is equal to or greater than the preset time, the timer bit is on. The current value of a TON timer is cleared when the enabling input is off, whereas the current value of the TONR timer is maintained when the input is off.
  • Page 210 S7-200 Programmable Controller System Manual Understanding How Resolution Affects the Timer Action For a timer with a resolution of 1 ms, the timer bit and the current value are updated asynchronous to the scan cycle. For scans greater than 1 ms, the timer bit and the current value are updated multiple times throughout the scan.
  • Page 211 S7-200 Instruction Set Chapter 6 To guarantee that the output of a self-resetting timer is turned on for one scan each time the timer reaches the preset value, use a normally closed contact instead of the timer bit as the enabling input to the timer.
  • Page 212 S7-200 Programmable Controller System Manual Example: SIMATIC Retentive On-Delay Timer Network 1 //10 ms TONR timer T1 times out at PT=(100 x 10 ms=1s) I0.0 TONR T1, +100 Network 2 //T1 bit is controlled by timer T1. //Turns Q0.0 on after the timer accumulates a total //of 1 second Q0.0 Network 3...
  • Page 213: Iec Timer Instructions

    S7-200 Instruction Set Chapter 6 IEC Timer Instructions On-Delay Timer The On-Delay Timer (TON) instruction counts time when the enabling input is on. Off-Delay Timer The Off-Delay Timer (TOF) delays turning an output off for a fixed period of time after the input turns off. Pulse Timer The Pulse Timer (TP) generates pulses for a specific duration.
  • Page 214 S7-200 Programmable Controller System Manual Example: IEC On-Delay Timer Instruction Timing Diagram Input VW100 (current) PT = 3 PT = 3 Output (Q) Example: IEC Off-Delay Timer Instruction Timing Diagram Input VW100 (current) PT = 3 PT = 3 Output (Q) Example: IEC Pulse Timer Instruction Timing Diagram Input...
  • Page 215: Subroutine Instructions

    S7-200 Instruction Set Chapter 6 Subroutine Instructions The Call Subroutine instruction (CALL) transfers control to the subroutine SBR_N. You can use a Call Subroutine instruction with or without parameters. After the subroutine completes its execution, control returns to the instruction that follows the Call Subroutine. The Conditional Return from Subroutine instruction (CRET) terminates the subroutine based upon the preceding logic.
  • Page 216 S7-200 Programmable Controller System Manual Table 6-75 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 217 S7-200 Instruction Set Chapter 6 Address parameters such as IN4 (&VB100) are passed into a subroutine as a DWORD (unsigned double word) value. The type of a constant parameter must be specified for the parameter in the calling routine with a constant descriptor in front of the constant value. For example, to pass an unsigned double word constant with a value of 12,345 as a parameter, the constant parameter must be specified as DW#12345.
  • Page 218 S7-200 Programmable Controller System Manual...
  • Page 219: Communicating Over A Network

    Communicating over a Network The S7-200 is designed to solve your communications and networking needs by supporting not only the simplest of networks but also supporting more complex networks. The S7-200 also provides tools that allow you to communicate with other devices, such as printers and weigh scales which use their own communications protocols.
  • Page 220: Understanding The Basics Of S7-200 Network Communications

    S7-200 Programmable Controller System Manual Understanding the Basics of S7-200 Network Communications Using Master and Slave Devices on a Network The S7-200 supports a master-slave network and can function as either a master or a slave in a network, while STEP 7–Micro/WIN is always a master. If you use Windows NT and a PC/PPI cable, no other master can be present on the network.
  • Page 221 Communicating over a Network Chapter 7 Setting the Baud Rate and Network Address for STEP 7–Micro/WIN You must configure the baud rate and network address for STEP 7–Micro/WIN. The baud rate must be the same as the other devices on the network, and the network address must be unique. Typically, you do not change the network address (0) for STEP 7–Micro/WIN.
  • Page 222 S7-200 Programmable Controller System Manual Setting the Remote Address Before you can download the updated settings to the S7-200, you must set both the communications (COM) port of STEP 7–Micro/WIN and the remote address of the S7-200 to match the current setting of the remote S7-200.
  • Page 223: Selecting The Communications Protocol For Your Network

    Communicating over a Network Chapter 7 Selecting the Communications Protocol for Your Network The S7-200 CPUs support one or more of the following communications capabilities that allow you to configure your network for the performance and functionality that your application requires: Point-to-Point Interface (PPI) Multi-Point Interface (MPI) PROFIBUS...
  • Page 224 S7-200 Programmable Controller System Manual MPI Protocol MPI allows both master-master and master-slave STEP 7–Micro/WIN: S7-200: Slave Master communications. See Figure 7-6. To communicate with an S7-200 CPU, STEP 7–Micro/WIN establishes a master–slave connection. MPI protocol does not communicate with an S7-200 CPU operating as a master. S7-300: Master Network devices communicate by means of separate connections (managed by the MPI protocol) between any...
  • Page 225 Communicating over a Network Chapter 7 Sample Network Configurations Using Only S7-200 Devices Single-Master PPI Networks For a simple single-master network, the programming station and the S7-200 CPU are connected by either a PC/PPI cable or by a communications processor (CP) card installed in the programming station.
  • Page 226 S7-200 Programmable Controller System Manual Figure 7-12 shows another example of a complex PPI network that uses multiple masters with peer-to-peer communications. In this example, each HMI monitors one S7-200 CPU. The S7-200 CPUs use the NETR and NETW instructions to read and write to each other (peer-to-peer communications).
  • Page 227 Communicating over a Network Chapter 7 Sample PROFIBUS-DP Network Configurations Networks with S7-315–2 DP as PROFIBUS Master and EM 277 as PROFIBUS Slave Figure 7-15 shows a sample PROFIBUS network that uses S7-315-2 DP an S7-315–2 DP as the PROFIBUS master. An EM 277 module is a PROFIBUS slave.
  • Page 228: Installing And Removing Communications Interfaces

    S7-200 Programmable Controller System Manual Installing and Removing Communications Interfaces From the Set PG/PC Interface dialog box, you use the Installing/Uninstalling Interfaces dialog box to install or remove communications interfaces for your computer In the Set PG/PC Interface dialog box, click Select to access the Installing/Uninstalling Interfaces dialog box.
  • Page 229 Communicating over a Network Chapter 7 Adjusting the Port Settings of Your Computer for PPI Multi-Master If you are using the PC/PPI cable with an operating system that supports the PPI Multi-Master configuration (Windows NT does not support the PPI Multi-Master), you might need to adjust the port settings on your computer: Right-click the My Computer icon on the desktop and select the Properties menu command.
  • Page 230: Building Your Network

    S7-200 Programmable Controller System Manual Building Your Network General Guidelines Always install appropriate surge suppression devices for any wiring that could be subject to lightning surges. Avoid placing low-voltage signal wires and communications cables in the same wire tray with AC wires and high-energy, rapidly switched DC wires.
  • Page 231 Communicating over a Network Chapter 7 Segment Segment Segment RS-485 RS-485 Repeater Repeater 50 m Up to 1000 m 50 m Figure 7-18 Sample Network with Repeaters Selecting the Network Cable S7-200 networks use the RS-485 standard on twisted pair cables. Table 7-5 lists the specifications for the network cable.
  • Page 232 The Siemens PC/PPI cable (order number 6ES7 901–3BF21–0XA0) provides electrical isolation between the RS-485 port on the S7-200 CPU and the RS-232 port that connects to your computer. If you do not use the Siemens PC/PPI cable, you must provide isolation for the RS-232 port of your computer.
  • Page 233 Using HMI Devices on Your Network The S7-200 CPU supports many types of HMI devices from Siemens and also from other manufacturers. While some of these HMI devices (such as the TD 200 or TP070) do not allow you to select the communications protocol used by the device, other devices (such as the OP7 and TP170) allow you to select the communications protocol for that device.
  • Page 234: Creating User-Defined Protocols With Freeport Mode

    S7-200 Programmable Controller System Manual Creating User-Defined Protocols with Freeport Mode Freeport mode allows your program to control the communications port of the S7-200 CPU. You can use Freeport mode to implement user-defined communications protocols to communicate with many types of intelligent devices.
  • Page 235 Communicating over a Network Chapter 7 Using the PC/PPI Cable and Freeport Mode with RS-232 Devices You can use the PC/PPI cable and the Freeport communications functions to connect the S7-200 CPUs to many devices that are compatible with the RS-232 standard. The PC/PPI cable is in Transmit mode when data is transmitted from the RS-232 port to the RS-485 port.
  • Page 236: Using Modems And Step 7-Micro/Win With Your Network

    S7-200 Programmable Controller System Manual Using Modems and STEP 7–Micro/WIN with Your Network STEP 7–Micro/WIN version 3.2 uses the standard Windows Phone and Modem Options for selecting and configuring telephone modems. The Phone and Modem Options are under the Windows Control Panel. Using the Windows setup options for modems allows you to: Use most internal and external modems supported by Windows.
  • Page 237 Communicating over a Network Chapter 7 Figure 7-21 Adding a Modem Connection Connecting to the S7-200 with a Modem After you have added a modem connection, you can connect to an S7-200 CPU. Open the Communications dialog box and double-click on the Connect icon to display the Modem Connection dialog box.
  • Page 238 S7-200 Programmable Controller System Manual Using a Modem with the PC/PPI Cable You can use a PC/PPI cable to connect the RS-232 communications port of a modem to an S7-200 CPU. See Figure 7-24. Switches 1, 2, and 3 on the PC/PPI cable set the baud rate. Switch 4 selects either a 10-bit or 11-bit PPI protocol.
  • Page 239 Communicating over a Network Chapter 7 Table 7-10 shows the pin numbers and functions for the RS-485 and RS-232 ports of the PC/PPI cable in DTE mode. Table 7-11 shows the pin numbers and functions for the RS-485 and RS-232 ports of the PC/PPI cable in DCE mode.
  • Page 240: Advanced Topics

    S7-200 Programmable Controller System Manual Advanced Topics Optimizing the Network Performance The following factors affect network performance (with baud rate and number of masters having the greatest effect): Baud rate: Operating the network at the highest baud rate supported by all devices has the greatest effect on the network.
  • Page 241 Communicating over a Network Chapter 7 CPU 222 CPU 222 CPU 224 CPU 224 TD 200 TD 200 TD 200 TD 200 Station 2 Station 4 Station 6 Station 8 Station 9 Station 7 Station 5 Station 3 Figure 7-26 Example of a Token-Passing Network In order for a master to send a message, it must hold the token.
  • Page 242 S7-200 Programmable Controller System Manual Comparing Token Rotation Times Table 7-12 shows comparisons of the token rotation time versus the number of stations, amount of data, and the baud rate. The times are figured for a case where you use the Network Read and Network Write instructions with the S7-200 CPU or other master devices.
  • Page 243 Communicating over a Network Chapter 7 As shown in Table 7-13, the S7-200 CPU or EM 277 provide a specific number of connections. Each port (Port 0 and Port 1) of an S7-200 CPU supports up to four separate connections. (This allows a maximum of eight connections for the S7-200 CPU.) This is in addition to the shared PPI connection.
  • Page 244 S7-200 Programmable Controller System Manual For some applications, however, reducing the Table 7-14 HSA and Target Token Rotation Time number of masters on the network is not an 9.6 kbaud 19.2 kbaud 187.5 kbaud option. When there are several masters, you HSA=15 0.613 s 0.307 s...
  • Page 245 Communicating over a Network Chapter 7 For example: Consider a network running at 9.6 kbaud with four TD 200s and four S7-200s, with each S7-200 writing 10 bytes of data to another S7-200 every second. Use Table 7-12 to calculate the specific transfer times for the network: 4 TD 200 devices transferring 16 bytes of data = 0.66 s...
  • Page 246 S7-200 Programmable Controller System Manual...
  • Page 247: Hardware Troubleshooting Guide And Software Debugging Tools

    Hardware Troubleshooting Guide and Software Debugging Tools STEP 7–Micro/WIN 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 S7-200, selecting to run the S7-200 for a specified number of scans, and forcing values.
  • Page 248: Features For Debugging Your Program

    S7-200 Programmable Controller System Manual Features for Debugging Your Program STEP 7–Micro/WIN provides several features to help you debug your program: bookmarks, cross reference tables, and run-time edits. Using Bookmarks for Easy Program Access You can set bookmarks in your program to make it easy to move back and forth between designated (bookmarked) lines of a long program.
  • Page 249 Hardware Troubleshooting Guide and Software Debugging Tools Chapter 8 Downloading the Program in RUN Mode RUN-mode editing allows you to download only your program block while the S7-200 is in RUN mode. Before downloading the program block in RUN mode, consider the effect of a RUN-mode modification on the operation of the S7-200 for the following situations: If you deleted the control logic for an output, the S7-200 maintains the last state of the output until the next power cycle or transition to STOP mode.
  • Page 250: Displaying The Program Status

    S7-200 Programmable Controller System Manual Displaying the Program Status STEP 7–Micro/WIN allows you to monitor the status of the user program as it is being executed. When you monitor the program status, the program editor displays the status of instruction operand values. To display the status, click the Program Status button or select the Debug >...
  • Page 251: Using A Status Chart To Monitor And Modify The Data In The S7-200

    Hardware Troubleshooting Guide and Software Debugging Tools Chapter 8 Displaying the Status of the Program in STL You can monitor the execution status of your STL program on an instruction-by-instruction basis. For an STL program, STEP 7–Micro/WIN displays the status of the instructions that are displayed on the screen. STEP 7–Micro/WIN gathers status information from the S7-200, beginning from the first STL statement at the top of the editor window.
  • Page 252: Forcing Specific Values

    S7-200 Programmable Controller System Manual Forcing Specific Values The S7-200 allows you to force any or all of the I/O points (I and Q bits). In addition, you can also force up to 16 memory values (V or M) or analog I/O values (AI or AQ). V memory or M memory values can be forced in bytes, words, or double words.
  • Page 253: Hardware Troubleshooting Guide

    Hardware Troubleshooting Guide and Software Debugging Tools Chapter 8 Hardware Troubleshooting Guide Table 8-1 Troubleshooting Guide for the S7-200 Hardware Symptom Possible Causes Possible Solution Outputs stop working The device being controlled has When connecting to an inductive load (such as a caused an electrical surge that motor or relay), a proper suppression circuit damaged the output...
  • Page 254 S7-200 Programmable Controller System Manual...
  • Page 255: Creating A Program For The Position Module

    Creating a Program for the Position Module The EM 253 Position module is an S7-200 special function module that generates the pulse trains used for open-loop control of the speed and position for either stepper motors or servo motors. It communicates with the S7-200 over the expansion I/O bus and appears in the I/O configuration as an intelligent module with eight digital outputs.
  • Page 256: Features Of The Position Module

    S7-200 Programmable Controller System Manual Features of the Position Module The Position module provides the functionality and performance that you need for single-axis, open-loop position control: Provides high-speed control, with a range from 12 pulses per second up to 200,000 pulses per second Supports both jerk (S curve) or linear acceleration and deceleration...
  • Page 257 Creating a Program for the Position Module Chapter 9 Programming the Position Module STEP 7–Micro/WIN provides easy-to-use tools for configuring and programming the Position module. Simply follow these steps: Configure the Position module. STEP 7–Micro/WIN provides a Position Control wizard for creating the configuration/profile table and the position instructions.
  • Page 258: Configuring The Position Module

    S7-200 Programmable Controller System Manual Configuring the Position Module You must create a configuration/profile table for the Position module in order for the module to control your motion application. The Position Control wizard makes the configuration process quick and easy by leading you step-by-step through the configuration process.
  • Page 259 Creating a Program for the Position Module Chapter 9 Editing the Default Input and Output Configurations The Position Control wizard provides an Advanced Options selection that allows you to view and edit the default input and output configurations for the Position module: The Input Active Levels tab changes the activation level settings.
  • Page 260 S7-200 Programmable Controller System Manual Configuring the Response of the Module to the Physical Inputs You must specify how the Position module responds to each of the LMT+ switch, the LMT– switch, and the STP input: no action (ignore the input condition), decelerate to a stop (default), or immediate stop. Warning Control devices can fail in unsafe conditions, and can result in unpredictable operation of controlled equipment.
  • Page 261 Creating a Program for the Position Module Chapter 9 Entering the Jog Parameters The Jog command is used to manually move the tool to a desired location. Using the Position Control wizard, you specify the following Jog parameters 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 262 S7-200 Programmable Controller System Manual Entering the Jerk Time Jerk compensation provides smoother position control by reducing the jerk (rate of change) in acceleration and deceleration parts of the motion profile. See Figure 9-9. Reducing jerk improves position tracking performance. Jerk compensation is also known as “S curve profiling.” Jerk compensation can only be applied to simple one-step profiles.
  • Page 263 Creating a Program for the Position Module Chapter 9 The Position Control wizard provides advanced reference point options that allow you to specify a RP offset (RP_OFFSET), which is the distance from the RP to the zero position. See Figure 9-10. The RP is identified by a method of locating an exact position with respect to the RPS.
  • Page 264 S7-200 Programmable Controller System Manual Configuring the Motion Profiles for the Position Module A profile is a pre-defined motion description consisting of one or more speeds of movement that effect a movement from a starting point to an ending point. You do not have to define a profile in order to use the module.
  • Page 265 Creating a Program for the Position Module Chapter 9 Creating the Steps for the Profile A step is a fixed distance that a tool moves, including the distance covered during acceleration and deceleration times. Each profile can have up to 4 individual steps. You specify the target speed and ending position for each step.
  • Page 266 S7-200 Programmable Controller System Manual Default configuration : LMT– RPS Active RP Seek Direction: Negative Active RP Approach Direction: Positive Work Zone Positive motion Negative motion RP Seek Direction: Positive RPS Active LMT+ RP Approach Direction: Positive Active Work Zone Positive motion Negative motion Figure 9-14...
  • Page 267 Creating a Program for the Position Module Chapter 9 Default configuration : LMT– RP Seek Direction: Negative Active Active RP Approach Direction: Positive Work Zone Number of ZP pulses Í Í Positive motion Negative motion RP Seek Direction: Positive LMT+ RP Approach Direction: Positive Active Active...
  • Page 268 S7-200 Programmable Controller System Manual Selecting the Location of the Work Zone to Eliminate Backlash Figure 9-18 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. The second part of the illustration places the work zone so that the backlash is not eliminated.
  • Page 269: Position Instructions Created By The Motion Control Wizard

    Creating a Program for the Position Module Chapter 9 Position Instructions Created by the Position Control Wizard The Position Control wizard makes controlling the Position module easier by creating unique instruction subroutines based on the position of the module and configuration options you selected. Each position instruction is prefixed with a ”POSx_”...
  • Page 270 S7-200 Programmable Controller System Manual POSx_CTRL Instruction The POSx_CTRL instruction (Control) enables and initializes the Position module by automatically commanding the Position module to load the configuration/profile table each time the S7-200 changes to RUN mode. Use this instruction only once in your project, and ensure that your program calls this instruction every scan.
  • Page 271 Creating a Program for the Position Module Chapter 9 POSx_MAN Instruction The POSx_MAN instruction (Manual Mode) puts the Position module into manual mode. This allows the motor to be run at different speeds or to be jogged in a positive or negative direction. While the POSx_MAN instruction is enabled, only the POSx_CTRL and POSx_DIS instructions are allowed.
  • Page 272 S7-200 Programmable Controller System Manual POSx_GOTO Instruction The POSx_GOTO instruction commands the Position Module to go to a desired location. Turning on the EN bit enables the instruction. Ensure that the EN bit stays on until the DONE bit signals that the execution of the instruction has completed.
  • Page 273 Creating a Program for the Position Module Chapter 9 POSx_RUN Instruction The POSx_RUN instruction (Run Profile) commands the Position module to execute the motion operation in a specific profile stored in the configuration/profile table. Turning on the EN bit enables the instruction. Ensure that the EN bit stays on until the Done bit signals that the execution of the instruction has completed.
  • Page 274 S7-200 Programmable Controller System Manual POSx_RSEEK Instruction The POSx_RSEEK instruction (Seek Reference Point Position) initiates a reference point seek operation, using the search method in the configuration/profile table. When the Position module locates the reference point and motion has stopped, the Position module loads the RP_OFFSET parameter value into the current position and generates a 50-millisecond pulse on the CLR output.
  • Page 275 Creating a Program for the Position Module Chapter 9 POSx_LDOFF Instruction The POSx_LDOFF instruction (Load Reference Point Offset) establishes a new zero position that is at a different location from the reference point position. Before executing this instruction, you must first determine the position of the reference point.
  • Page 276 S7-200 Programmable Controller System Manual POSx_LDPOS Instruction The POSx_LDPOS instruction (Load Position) changes the current position value in the Position module to a new value. You can also use this instruction to establish a new zero position for any absolute move command.
  • Page 277 Creating a Program for the Position Module Chapter 9 POSx_SRATE Instruction The POSx_SRATE instruction (Set Rate) commands the Position module to change the acceleration, deceleration, and jerk times. Turning on the EN bit enables the instruction. Ensure that the EN bit stays on until the Done bit signals that the execution of the instruction has completed.
  • Page 278 S7-200 Programmable Controller System Manual POSx_DIS Instruction The POSx_DIS instruction turns the DIS output of the Position module on or off. This allows you to use the DIS output for disabling or enabling a motor controller. If you use the DIS output on the Position module, then this instruction can be called every scan or only when you need to change the value of the DIS output.
  • Page 279 Creating a Program for the Position Module Chapter 9 POSx_CLR Instruction The POSx_CLR instruction (Pulse the CLR Output) commands the Position module to generate a 50-ms pulse on the CLR output. Turning on the EN bit enables the instruction. Ensure that the EN bit stays on until the Done bit signals that the execution of the instruction has completed.
  • Page 280 S7-200 Programmable Controller System Manual POSx_CFG Instruction The POSx_CFG instruction (Reload Configuration) commands the Position module to read the configuration block from the location specified by the configuration/profile table pointer. The Position module then compares the new configuration with the existing configuration and performs any required setup changes or recalculations.
  • Page 281: Sample Programs For The Position Module

    Creating a Program for the Position Module Chapter 9 Sample Programs for the Position Module The first sample program shows a simple relative move that uses the POSx_CTRL and POSx_GOTO instructions 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 282 S7-200 Programmable Controller System Manual Sample Program 1: Simple Relative Move (Cut to Length application) , continued Network 6 //When the cut is finished then restart //unless the Stop is active. Q0.2 I0.1 M0.1 I0.1 Q0.2, 1 Sample Program 2: Program with POSx_CTRL, POSx_RUN, POSx_SEEK, and POSx_MAN Network 1 //Enable the Position module SM0.0...
  • Page 283 Creating a Program for the Position Module Chapter 9 Sample Program 2: Program with POSx_CTRL, POSx_RUN, POSx_SEEK, and POSx_MAN, continued Network 4 //Emergency Stop //Disable the module and auto mode I0.1 M0.0, 1 S0.1, 9 Q0.3, 3 Network 5 //When in auto mode: //Turn on the Running light M0.0 Q0.1...
  • Page 284 S7-200 Programmable Controller System Manual Sample Program 2: Program with POSx_CTRL, POSx_RUN, POSx_SEEK, and POSx_MAN, continued Network 11 //Use profile 1 to move into position. S0.2 L60.0 S0.2 L63.7 L60.0 CALL POS0_RUN, L63.7, VB228, I0.1, M1.2, VB940, VB941, VB942, VD944, VD948 Network 12 //When positioned, turn on the cutter //and go to the next step.
  • Page 285 Creating a Program for the Position Module Chapter 9 Sample Program 2: Program with POSx_CTRL, POSx_RUN, POSx_SEEK, and POSx_MAN, continued Network 16 //Unless STOP is on, restart //when the cut is finished. Q0.3, 1 Q0.4, 1 I0.2 SCRT S0.1 I0.2 M0.0, 4 Network 17 SCRE...
  • Page 286: Monitoring The Position Module With The Em 253 Control Panel

    S7-200 Programmable Controller System Manual Monitoring the Position Module with the EM 253 Control Panel To aid you in the development of your Position Control solution, STEP 7–Micro/WIN provides the EM 253 Control Panel. The Operation, Configuration and Diagnostics tabs make it easy for you to monitor and control the operation of the Position module during the startup and test phases of your development process.
  • Page 287 Creating a Program for the Position Module Chapter 9 Displaying and Modifying the Configuration of the Position Module The Configuration tab of the control panel allows you to view and modify the configuration settings for the Position module that are stored in the data block of the S7-200.
  • Page 288: Error Codes For The Position Module And The Position Instructions

    S7-200 Programmable Controller System Manual Error Codes for the Position Module and the Position Instructions Table 9-13 Instruction Error Codes Error Code Description No error Aborted by user Configuration error Use the EM 253 Control Panel Diagnostics tab to view error codes Illegal command Aborted due to no valid configuration Use the EM 253 Control Panel Diagnostics tab to view error codes...
  • Page 289 Creating a Program for the Position Module Chapter 9 Table 9-14 Module Error Codes Error Code Description No error No user power Configuration block not present Configuration block pointer error Size of configuration block exceeds available V memory Illegal configuration block format Too many profiles specified Illegal STP_RSP specification Illegal LMT–_RPS specification...
  • Page 290: Advanced Topics

    S7-200 Programmable Controller System Manual Advanced Topics Understanding the Configuration/Profile Table The Position Control 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 position control system.
  • Page 291 Creating a Program for the Position Module Chapter 9 Table 9-15 Configuration/Profile Table, continued Offset Name Function Description Type STP_RSP Specifies the response of the drive to the STP input (1 byte) –– No action. Ignore the input condition. Decelerate to a stop and indicate that the STP input is active. Terminate the pulses and indicate STP input 3 to 255 Reserved (error if specified) LMT–_RSP...
  • Page 292 S7-200 Programmable Controller System Manual Table 9-15 Configuration/Profile Table, continued Offset Name Function Description Type RP_FAST Fast speed for the RP seek operation: MAX_SPD or less (4 bytes) DINT REAL RP_SLOW Slow speed for the RP seek operation: maximum speed from which the motor can DINT instantly go to a stop or less (4 bytes) REAL...
  • Page 293 Creating a Program for the Position Module Chapter 9 Table 9-15 Configuration/Profile Table, continued Offset Name Function Description Type Position to go to in move step 0 (4 bytes) DINT (+2) REAL SPEED Target speed for move step 0 (4 bytes) DINT (+6) REAL...
  • Page 294 S7-200 Programmable Controller System Manual Table 9-17 Special Memory Area Definition for the EM 253 Position Module SM Address Description SMB200 to Module name (16 ASCII characters). SMB200 is the first character: “EM253 Position” SMB215 SMB216 to Software revision number (4 ASCII characters). SMB216 is the first character. SMB219 SMW220 Error code for the module.
  • Page 295 Creating a Program for the Position Module Chapter 9 Understanding the Command Byte for the Position Module The Position module provides one byte of discrete outputs which is used as the command byte. Figure 9-22 shows the command byte definition. Table 9-18 shows the Command_code definitions. A write to the command byte where the R bit changes from 0 to 1 is interpreted by the module as a new command.
  • Page 296 S7-200 Programmable Controller System Manual Table 9-19 Motion Commands Command Description Commands 0 to 24: When this command is executed, the Position module performs the motion operation specified in the MODE field of the profile block indicated by the Command_code portion of Executes the motion specified in the command.
  • Page 297 Creating a Program for the Position Module Chapter 9 Table 9-19 Motion Commands, continued Command Description Command 123 When this command is executed, the Position module establishes a zero position that is at a different location from the reference point position. Capture the Reference Point offset Before issuing this command, you must have determined the position of the reference point...
  • Page 298 S7-200 Programmable Controller System Manual Creating Your Own Position Control Instructions The Position Control wizard creates the position instructions for controlling the operation of the Position module; however, you can also create your own instructions. The following STL code segment provides an example of how you might create your own control instructions for the Position module.
  • Page 299: Creating A Program For The Modem Module

    Creating a Program for the Modem Module The EM 241 Modem module allows you to connect your S7-200 directly to an analog telephone line, and supports communications between your S7-200 and STEP 7–Micro/WIN. The Modem module also supports the Modbus slave RTU protocol. Communications between the Modem module and the S7-200 are made over the Expansion I/O bus.
  • Page 300: Features Of The Modem Module

    S7-200 Programmable Controller System Manual Features of the Modem Module The Modem module allows you to connect your S7-200 directly to an analog telephone line and provides the following features: Provides international telephone line interface Provides a modem interface to STEP 7–Micro/WIN for programming and troubleshooting (teleservice) Supports the Modbus RTU protocol...
  • Page 301 Creating a Program for the Modem Module Chapter 10 STEP 7–Micro/WIN Interface The Modem module allows you to communicate with STEP 7–Micro/WIN over a telephone line (teleservice). You do not need to configure or program the S7-200 CPU to use the Modem module as the remote modem when used with STEP 7–Micro/WIN.
  • Page 302 S7-200 Programmable Controller System Manual Table 10-3 shows the Modbus addresses Table 10-3 Mapping Modbus Addresses to the S7-200 CPU supported by the Modem module, and the Modbus Address S7-200 CPU Address mapping of Modbus addresses to the S7-200 000001 Q0.0 CPU addresses.
  • Page 303 Creating a Program for the Modem Module Chapter 10 Embedded Variables in Text and SMS Messages The Modem module can embed data values from the CPU in the text messages and format the data values based on a specification in the message. You can specify the number of digits to the left and right of the decimal point, and whether the decimal point is a period or a comma.
  • Page 304 S7-200 Programmable Controller System Manual Security Callback The callback function of the Modem module is optional and is configured with the Modem Expansion wizard. The callback function provides additional security for the attached CPU by allowing access to the CPU only from predefined telephone numbers. When the callback function is enabled, the Modem module answers any incoming calls, verifies the caller, and then disconnects the line.
  • Page 305 Creating a Program for the Modem Module Chapter 10 Configuration Table for the Modem Module All of the text messages, telephone numbers, data transfer information, callback numbers and other options are stored in a Modem module configuration table which must loaded into the V memory of the S7-200 CPU.
  • Page 306: Using The Modem Expansion Wizard To Configure The Modem Module

    S7-200 Programmable Controller System Manual Status LEDs of the Modem Module The Modem module has 8 status LEDs on the front panel. Table 10-5 describes the status LEDs. Table 10-5 EM 241 Status LEDs Description Module Fail – This LED is on when the module detects a fault condition such as: No 24 VDC external power Timeout of the I/O watchdog Modem failure...
  • Page 307 Creating a Program for the Modem Module Chapter 10 You can configure the module to send numeric and text messages to pagers, or Short Message Service (SMS) messages to cellular telephones. Check the Enable messaging checkbox and click the Configure Messaging... button to define messages and the recipient’s telephone numbers. When setting up a message to be sent to a pager or cellular phone, you must define the message and the telephone number.
  • Page 308 S7-200 Programmable Controller System Manual – The Phone Number field is the telephone number of the messaging service provider. For text messages this is the telephone number of the modem line the service provider uses to accept text messages. For numeric paging this is the telephone number of the pager itself. The Modem module allows the telephone number field to be a maximum of 40 characters.
  • Page 309 Creating a Program for the Modem Module Chapter 10 10. The Phone Numbers tab on the Configure CPU Data Transfers screen allows you to define the telephone numbers for CPU-to-CPU or a CPU-to-Modbus data transfers. Click the New Phone Number... button to add a new telephone number. Once a telephone number has been configured it must be added to the project.
  • Page 310: Overview Of Modem Instructions And Restrictions

    S7-200 Programmable Controller System Manual Overview of Modem Instructions and Restrictions The Modem Expansion wizard makes controlling the Modem module easier by creating unique instruction subroutines based on the position of the module and configuration options you selected. Each instruction is prefixed with a “MODx_”...
  • Page 311: Instructions For The Modem Module

    Creating a Program for the Modem Module Chapter 10 Instructions for the Modem Module MODx_CTRL Instruction The MODx_CTRL (Control) instruction is used to enable and initialize the Modem module. This instruction should be called every scan and should only be used once in the project. MODx_XFR Instruction The MODx_XFR (Data Transfer) instruction is used to command the Modem module to read and write data to another S7-200 CPU or a...
  • Page 312 S7-200 Programmable Controller System Manual MODx_MSG Instruction The MODx_MSG (Send Message) instruction is used to send a paging or SMS message from Modem module. This instruction requires 20 to 30 seconds from the time the START input is triggered until the Done bit is set. The EN bit must be on to enable a command to the module, and should remain on until the Done bit is set, signaling completion of the process.
  • Page 313 Creating a Program for the Modem Module Chapter 10 Table 10-8 Error Values Returned by MODx_MSG and MODx_XFR Instructions Error Description No error Telephone line errors No dial tone present Busy line Dialing error No answer Connect timeout (no connection within 1 minute) Connection aborted or an unknown response Errors in the command Numeric paging message contains illegal digits...
  • Page 314 S7-200 Programmable Controller System Manual Table 10-8 Error Values Returned by MODx_MSG and MODx_XFR Instructions, continued Error Description UCP – SMS message errors returned by service provider (continued) Deferred delivery not allowed New AC not valid New legitimization code not allowed Standard text not valid Time period not valid Message type not supported by system...
  • Page 315: Sample Program For The Modem Module

    Creating a Program for the Modem Module Chapter 10 Sample Program for the Modem Module Example: Modem Module Network 1 // Call the MOD0_CTRL subroutine // on every scan. SM0.0 CALL MOD0_CTRL, M0.0, VB10 Network 2 // Send a text message to a cell phone. I0.0 L63.7 I0.0...
  • Page 316: Special Memory Location For The Modem Module

    S7-200 Programmable Controller System Manual Special Memory Location for the Modem Module Fifty bytes of special memory (SM) are allocated to each intelligent module based on its physical position in the I/O expansion bus. When an error condition or a change in status is detected, the module indicates this by updating the SM locations corresponding to the module’s position.
  • Page 317 Creating a Program for the Modem Module Chapter 10 Table 10-11 SM Locations for the EM 241 Modem Module, continued SM Address Description SMB226 Result of the user command ERROR D – Done bit; 0 – operation in progress 1 – operation complete ERROR : Error Code Description, see Table 10-8 SMB227 Telephone number selector –...
  • Page 318: Advanced Topics

    S7-200 Programmable Controller System Manual Advanced Topics Understanding the ConfigurationTable The Modem Expansion wizard has been developed to make modem applications easy by automatically generating the configuration table based upon the answers you give about your system. Configuration table information is provided for advanced users who want to create their own Modem module control routines and format their own messages.
  • Page 319 Creating a Program for the Modem Module Chapter 10 Table 10-12 Configuration Table for the Modem Module, continued Callback Telephone Number Block (optional) Byte Offset Description Callback Telephone Number 1 – A string representing the first telephone number that is authorized for callback access from the EM 241 Modem module.
  • Page 320: Messaging Telephone Number Format

    S7-200 Programmable Controller System Manual Messaging Telephone Number Format The Messaging Telephone Number is a structure which contains the information needed by the Modem module to send a message. The Messaging Telephone Number is an ASCII string with a leading length byte followed by ASCII characters.
  • Page 321: Text Message Format

    Creating a Program for the Modem Module Chapter 10 Text Message Format The Text Message Format defines the format of text paging or SMS messages. These types of messages can contain text and embedded variables. The text message is an ASCII string with a leading length byte followed by ASCII characters.
  • Page 322: Cpu Data Transfer Message Format

    S7-200 Programmable Controller System Manual CPU Data Transfer Message Format A CPU data transfer, either a CPU-to-CPU or a CPU-to-Modbus data transfer, is specified using the CPU Data Transfer Message Format. A CPU Data Transfer Message is an ASCII string which can specify any number of data transfers between devices, up to the number of specifications that fit in the maximum message length of 120 bytes (119 characters plus a length byte).
  • Page 323: Using The Uss Protocol Library To Control A Micromaster Drive

    Using the USS Protocol Library to Control a MicroMaster Drive STEP 7–Micro/WIN Instruction Libraries makes controlling MicroMaster drives easier by including preconfigured subroutines and interrupt routines that are specifically designed for using the USS protocol to communicate with the drive. With the USS instructions, you can control the physical drive and the read/write drive parameters.
  • Page 324: Requirements For Using The Uss Protocol

    S7-200 Programmable Controller System Manual Requirements for Using the USS Protocol The STEP 7–Micro/WIN Instruction Libraries provides 14 subroutines, 3 interrupt routines, and 8 instructions to support the USS protocol. The USS instructions use the following resources in the S7-200: Initializing the USS protocol dedicates Port 0 for the USS communications.
  • Page 325: Calculating The Time Required For Communicating With The Drive

    Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 Calculating the Time Required for Communicating with the Drive Communications with the drive are asynchronous to the S7-200 scan. The S7-200 typically completes several scans before one drive communications transaction is completed. The following factors help determine the amount of time required: the number of drives present, the baud rate, and the scan time of the S7-200.
  • Page 326: Using The Uss Instructions

    S7-200 Programmable Controller System Manual Using the USS Instructions To use the USS protocol instructions in your S7-200 controller program, follow these steps: Insert the USS_INIT instruction in your program and execute the USS_INIT instruction for one scan only. You can use the USS_INIT instruction either to initiate or to change the USS communications parameters.
  • Page 327: Instructions For The Uss Protocol

    Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 Instructions for the USS Protocol USS_INIT Instruction The USS_INIT instruction is used to enable and initialize, or to disable MicroMaster Drive communications. Before any other USS instruction can be used, the USS_INIT instruction must be executed without errors.
  • Page 328 S7-200 Programmable Controller System Manual USS_CTRL Instruction The USS_CTRL instruction is used to control an active MicroMaster drive. The USS_CTRL instruction places the selected commands in a communications buffer, which is then sent to the addressed drive (Drive parameter), if that drive has been selected in the Active parameter of the USS_INIT instruction.
  • Page 329 Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 Speed_SP (speed setpoint) is drive speed as a percentage of full speed. Negative values of Speed_SP cause the drive to reverse its direction of rotation. Range: –200.0% to 200.0% Error is an error byte that contains the result of the latest communications request to the drive.
  • Page 330 S7-200 Programmable Controller System Manual High byte Low byte 15 14 13 12 1 = Ready to start 1 = Ready to operate 1 = Operation enabled 1 = Drive fault present 0 = OFF2 (Coast stop command present) 0 = OFF3 (Quick stop command present) 1 = Switch-on inhibit 1 = Drive warning present 1 = Not used (always 1)
  • Page 331 Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 USS_RPM_x Instruction There are three read instructions for the USS protocol: USS_RPM_W instruction reads an unsigned word parameter. USS_RPM_D instruction reads an unsigned double word parameter. USS_RPM_R instruction reads a floating-point parameter. Only one read (USS_RPM_x) or write (USS_WPM_x) instruction can be active at a time.
  • Page 332 S7-200 Programmable Controller System Manual USS_WPM_x Instruction There are three write instructions for the USS protocol: USS_WPM_W instruction writes an unsigned word parameter. USS_WPM_D instruction writes an unsigned double word parameter. USS_WPM_R instruction writes a floating-point parameter. Only one read (USS_RPM_x) or write (USS_WPM_x) instruction can be active at a time.
  • Page 333 Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 Caution When you use an USS_WPM_x instruction to update the parameter set stored in drive EEPROM, you must ensure that the maximum number of write cycles (approximately 50,000) to the EEPROM is not exceeded.
  • Page 334: Sample Programs For The Uss Protocol

    S7-200 Programmable Controller System Manual Sample Programs for the USS Protocol Example: USS Instructions Sample Program that Correctly Displays in STL Network 1 //Initialize USS Protocol: //On the first scan, enable USS protocol //for port 0 at 19200 with drive address //”0”...
  • Page 335: Uss Execution Error Codes

    Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 USS Execution Error Codes Table 11-6 Execution Error Codes for the USS Instructions Error Codes Description No error Drive did not respond A checksum error in the response from the drive was detected A parity error in the response from the drive was detected An error was caused by interference from the user program An illegal command was attempted...
  • Page 336: Connecting And Setting Up The Micromaster Series 3 Drive

    S7-200 Programmable Controller System Manual Connecting and Setting Up the MicroMaster Series 3 Drive Connecting the MicroMaster 3 Drive You can use the standard PROFIBUS cable and connectors to connect the S7-200 to the MicroMaster Series 3 (MM3) drive. See Figure 11-5 for the proper cable bias and termination of the interconnecting cable.
  • Page 337 Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 Setting Up the MicroMaster 3 Drive Before you connect a drive to the S7-200, you must ensure that the drive has the following system parameters. Use the keypad on the drive to set the parameters: Reset the drive to factory settings (optional).
  • Page 338 S7-200 Programmable Controller System Manual Serial Link Time-out. This is the maximum permissible period between two incoming data telegrams. This feature is used to turn off the inverter in the event of a communications failure. Timing starts after a valid data telegram has been received. If a further data telegram is not received within the specified time period, the inverter will trip and display fault code F008.
  • Page 339: Connecting And Setting Up The Micromaster Series 4 Drive

    Using the USS Protocol Library to Control a MicroMaster Drive Chapter 11 Connecting and Setting Up the MicroMaster Series 4 Drive Connecting the MicroMaster 4 Drive To make the connection to the MicroMaster Series 4 (MM4) drive, insert the ends of the RS-485 cable into the two caged clamp, screwless terminals provided for USS operation.
  • Page 340 S7-200 Programmable Controller System Manual Setting Up the MM4 Drive Before you connect a drive to the S7-200, you must ensure that the drive has the following system parameters. Use the keypad on the drive to set the parameters: Reset the drive to factory settings (optional): P0010=30 P0970=1 If you skip this step, ensure that the following parameters are set to these values:...
  • Page 341: Using The Modbus Protocol Library

    Using the Modbus Protocol Library STEP 7–Micro/WIN Instruction Libraries makes communicating to Modbus master devices easier by including pre-configured subroutines and interrupt routines that are specifically designed for Modbus communications. With the Modbus Slave Protocol Instructions, you can configure the S7-200 to act as a Modbus RTU slave device and communicate to Modbus master devices.
  • Page 342: Requirements For Using The Modbus Protocol

    S7-200 Programmable Controller System Manual Requirements for Using the Modbus Protocol The Modbus Slave Protocol instructions use the following resources from the S7-200: Initializing the Modbus Slave Protocol dedicates Port 0 for Modbus Slave Protocol communications. When Port 0 is being used for Modbus Slave Protocol communications, it cannot be used for any other purpose, including communications with STEP 7–Micro/WIN.
  • Page 343: Modbus Addressing

    Using the Modbus Protocol Library Chapter 12 Modbus Addressing Modbus addresses are normally written as 5 or 6 character values containing the data type and the offset. The first one or two characters determine the data type, and the last four characters select the proper value within the data type.
  • Page 344: Using The Modbus Slave Protocol Instructions

    S7-200 Programmable Controller System Manual Using the Modbus Slave Protocol Instructions To use the Modbus Slave Protocol instructions in your S7-200 program, follow these steps: Insert the MBUS_INIT instruction in your program and execute the MBUS_INIT instruction for one scan only. You can use the MBUS_INIT instruction either to initiate or to change the Modbus communications parameters.
  • Page 345: Instructions For The Modbus Slave Protocol

    Using the Modbus Protocol Library Chapter 12 Instructions for the Modbus Slave Protocol MBUS_INIT Instruction The MBUS_INIT instruction is used to enable and initialize, or to disable Modbus communications. Before the MBUS_SLAVE instruction can be used, the MBUS_INIT instruction must be executed without errors.
  • Page 346 S7-200 Programmable Controller System Manual The parameter MaxAI sets the number of word input (AI) registers available to Modbus address 03xxx at values of 0 to 32. A value of 0 disables reads of the analog inputs. The suggested value for MaxAI to allow access to all of the S7-200 analog inputs, is as follows: 0 for CPU 221 16 for CPU 222...
  • Page 347 Using the Modbus Protocol Library Chapter 12 MBUS_SLAVE Instruction The MBUS_SLAVE instruction is used to service a request from the Modbus master and must be executed every scan to allow it to check for and respond to Modbus requests. The instruction is executed on each scan when the EN input is on. The MBUS_SLAVE instruction has no input parameters.
  • Page 348 S7-200 Programmable Controller System Manual Example of Programming the Modbus Slave Protocol Network 1 //Initialize the Modbus Slave Protocol on the //first scan. Set the slave address to 1, set // port 0 to 9600 baud with even parity, all //access to all I, Q and AI values, allow //access to 1000 holding registers (2000 // bytes) starting at VB0.
  • Page 349: Technical Specifications

    Technical Specifications In This Chapter General Technical Specifications ............CPU Specifications .
  • Page 350: General Technical Specifications

    Germanischer Lloyd (GL) 12 045 – 98 HH For the latest product approvals, contact your Det Norske Veritas (DNV) A–8071 local Siemens distributor or sales office. Bureau Veritas (BV) 09051 / A2 BV Nippon Kaiji Kyokai (NK) A–534 Technical Specifications All S7-200 CPUs and expansion modules conform to the technical specifications listed in Table A-1.
  • Page 351 Technical Specifications Appendix A Table A-1 Technical Specifications Environmental Conditions — Transport and Storage IEC 68–2–2, Test Bb, Dry heat and –40° C to +70° C IEC 68–2–1, Test Ab, Cold IEC 68–2–30, Test Db, Damp heat 25° C to 55° C, 95% humidity IEC 68–2–31, Toppling 100 mm, 4 drops, unpacked IEC 68–2–32, Free fall...
  • Page 352: Cpu Specifications

    S7-200 Programmable Controller System Manual CPU Specifications Table A-2 CPU Order Numbers CPU Power Supply Removable Order Number CPU Model CPU Inputs CPU Outputs (Nominal) Connector 6ES7 211–0AA22–0XB0 CPU 221 24 VDC 6 x 24 VDC 4 x 24 VDC 6ES7 211–0BA22–0XB0 CPU 221 120 to 240 VAC...
  • Page 353 Technical Specifications Appendix A CPU 221 CPU 222 CPU 224 CPU 226 CPU 226XM General Timers 256 total timers; 4 timers (1 ms); 16 timers (10 ms); 236 timers (100 ms) Counters 256 (backed by super capacitor or battery) Internal memory bits 256 (backed by super capacitor or battery) Stored on power down 112 (stored to EEPROM)
  • Page 354 S7-200 Programmable Controller System Manual Table A-6 CPU Input Specifications, continued General 24 VDC Input Connection of 2 wire proximity sensor (Bero) Permissible leakage 1 mA current (max.) Isolation (field to logic) Optical (galvanic) 500 VAC for 1 minute Isolation groups See wiring diagram High speed input rate (max.) Single phase...
  • Page 355 Technical Specifications Appendix A Wiring Diagrams 24 VDC Input 24 VDC Input Used as Sourcing Inputs Used as Sinking Inputs 1M .0 1M .0 Relay Output 24 VDC Output N(–) L(+) 1M 1L+ .0 Figure A-2 CPU Inputs and Outputs CPU 221 DC/DC/DC CPU 221 AC/DC/Relay (6ES7 211–0AA22–0XB0)
  • Page 356 S7-200 Programmable Controller System Manual CPU 222 DC/DC/DC CPU 222 AC/DC/Relay (6ES7 212–1AB22–0XB0) 24 VDC Power (6ES7 212–1BB22–0XB0) 120/240 VAC Power N(–) N(–) L(+) L(+) L+ 0.0 0.1 0.2 0.3 0.4 0.5 L+ DC 1L 0.0 0.1 0.2 2L 0.3 0.4 0.0 0.1 0.2 0.3 2M 0.4 0.5 0.6 0.7 M L+...
  • Page 357 Technical Specifications Appendix A CPU 226 DC/DC/DC (6ES7 216–2AD22–0XB0) CPU 226XM DC/DC/DC (6ES7 216–2AF22–0XB0) 24 VDC Power M 1L+ 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 2M 2L+ 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 1.0 1.2 1.2 1.3 1.4 1.5 1.6 1.7 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7...
  • Page 358: Digital Expansion Modules Specifications

    S7-200 Programmable Controller System Manual Digital Expansion Modules Specifications Table A-9 Digital Expansion Modules Order Numbers Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6ES7 221–1BF22–0XA0 EM 221 Digital Input 8 x 24 VDC 8 x 24 VDC –...
  • Page 359 Technical Specifications Appendix A Table A-11 Digital Expansion Modules Input Specifications, continued General 24 VDC Input 120/230 VAC Input (47 to 63 HZ) Inputs on simultaneously All at 55° C All at 55° C Cable length (max.) Shielded 500 m 500 m Unshielded 300 m...
  • Page 360 S7-200 Programmable Controller System Manual 24 VDC Input 24 VDC Output Relay Output Used as Sinking Inputs N(–) L(+) 1M .0 1M 1L+ .0 24 VDC Input 120/230 AC Input 120/230 AC Output Used as Sourcing Inputs 1M .0 0N .0 Figure A-6 S7-200 Digital Expansion Modules Inputs and Outputs...
  • Page 361 Technical Specifications Appendix A Wiring Diagrams EM 222 Digital Output 8 x 24 VDC EM 222 Digital Output 8 x Relay EM 221 Digital Input 8 x 24 VDC (6ES7 222–1BF22–0XA0) (6ES7 222 1HF22–0XA0) (6ES7 221–1BF22–0XA0) N(–) L(+) 1M 1L+ .0 2M .4 2L+ .4 24 VDC Coil...
  • Page 362 S7-200 Programmable Controller System Manual EM 223 24 VDC Digital Combination 8 Inputs/8 Outputs EM 223 24 VDC Digital Combination 8 Inputs/8 Relay Outputs (6ES7 223–1BH22–0XA0) (6ES7 223–1PH22–0XA0) N(–) N(–) L(+) L(+) 1M 1L+ .0 2M 2L+ .4 1M .0 2M .4 1M .0 2M .4...
  • Page 363: Analog Expansion Modules Specifications

    Technical Specifications Appendix A Analog Expansion Modules Specifications Table A-13 Analog Expansion Modules Order Numbers Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6ES7 231–0HC22–0XA0 EM 231 Analog Input, 4 Inputs – 6ES7 232–0HB22–0XA0 EM 232 Analog Output, 2 Outputs –...
  • Page 364 S7-200 Programmable Controller System Manual Table A-16 Analog Expansion Modules Output Specifications General 6ES7 232–0HB22–0XA0 6ES7 235–0KD22–0XA0 Isolation (field to logic) None None Signal range ± 10 V ± 10 V Voltage output Current output 0 to 20 mA 0 to 20 mA Resolution, full-scale Voltage 12 bits...
  • Page 365 Technical Specifications Appendix A Analog LED Indicators The LED indicators for the analog modules are shown in Table A-17. Table A-17 Analog LED Indicators LED Indicator 24 VDC Power Supply Good No faults No 24 VDC power Input Calibration The calibration adjustments affect the instrumentation amplifier stage that follows the analog multiplexer (see the Input Block Diagram for the EM 231 in Figure A-12 and EM 235 in Figure A-13).
  • Page 366 S7-200 Programmable Controller System Manual EM 231 EM 235 ↑On ↑On ↓Off ↓Off Fixed Terminal Block Gain Offset Configuration Fixed Terminal Block Gain Configuration Figure A-10 Calibration Potentiometer and Configuration DIP Switch Location for the EM 231 and EM 235 Configuration for EM 231 Table A-18 shows how to configure the EM 231 module using the configuration DIP switches.
  • Page 367 Technical Specifications Appendix A Configuration for EM 235 Table A-19 shows how to configure the EM 235 module using the configuration DIP switches. Switches 1 through 6 select the analog input range and resolution. All inputs are set to the same analog input range and format.
  • Page 368 S7-200 Programmable Controller System Manual Input Data Word Format for EM 231 and EM 235 Figure A-11 shows where the 12-bit data value is placed within the analog input word of the CPU. Data value 12 Bits AIW XX Unipolar data AIW XX Data value 12 Bits Bipolar data...
  • Page 369 Technical Specifications Appendix A EM 235 Rloop A– GAIN ADJUST Instrumentation BUFFER Rloop – A/D Converter B– DATA REF_VOLT Rloop Buffer C– – Offset Adjust Rloop D– Input filter MUX 4 to 1 Figure A-13 Input Block Diagram for the EM 235 Output Data Word Format for EM 232 and EM 235 Figure A-14 shows where the 12-bit data value is placed within the analog output word of the CPU.
  • Page 370 S7-200 Programmable Controller System Manual Output Block Diagram for EM 232 and EM 235 +24 Volt – – Voltage-to-current converter Iout 0..20 mA Vref D/A converter +/– 2V Vout – –10.. +10 Volts DATA Digital-to-analog converter Voltage output buffer Figure A-15 Output Block Diagram for the EM 232 and EM 235 Installation Guidelines Use the following guidelines to ensure accuracy and repeatability:...
  • Page 371 Technical Specifications Appendix A Understanding the Analog Input Module: Accuracy and Repeatability The EM 231 and EM 235 analog input modules are low-cost, high-speed 12 bit analog input modules. The modules can convert an analog signal input to its corresponding digital value in 149 µsec. The analog signal input is converted each time your program accesses the analog point.
  • Page 372 S7-200 Programmable Controller System Manual Definitions of the Analog Specifications Accuracy: deviation from the expected value on a given point Resolution: the effect of an LSB change reflected on the output. Table A-21 EM 231 and EM 235 Specifications 1,2,3,4 Repeatability Mean (average) Accuracy Full Scale Input Range...
  • Page 373: Thermocouple And Rtd Expansion Modules Specifications

    Technical Specifications Appendix A Thermocouple and RTD Expansion Modules Specifications Table A-22 Thermocouple and RTD Modules Order Numbers Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6ES7 231–7PD22–0XA0 EM 231 Analog Input Thermocouple, 4 Inputs 4 Thermocouple – 6ES7 231–7PB22–0XA0 EM 231 Analog Input RTD, 2 Inputs 2 RTD...
  • Page 374 If the ambient temperature is changing rapidly in the area where the EM 231 Thermocouple module is installed, additional errors are introduced. To achieve maximum accuracy and repeatability, Siemens recommends that the S7-200 RTD and thermocouple modules be mounted in locations that have stable ambient temperature.
  • Page 375 Technical Specifications Appendix A EM 231 Thermocouple Module The EM 231 Thermocouple module provides a convenient, isolated interface for the S7-200 family to seven thermocouple types: J, K, E, N, S, T, and R. It allows the S7-200 to connect to low level analog signals, ±80mV range.
  • Page 376 S7-200 Programmable Controller System Manual Table A-25 Configuring the Thermocouple Module DIP Switches Switches 1,2,3 Thermocouple Type Setting Description J (Default) Switches 1 to 3 select the thermocouple type SW1, 2, 3 SW1, 2, 3 (or mV operation) for all channels on the module.
  • Page 377 Technical Specifications Appendix A H The open wire current source could interfere with signals from some low level sources such as thermocouple simulators. H Input voltages exceeding approximately ±200mV will trigger open wire detection even when the open wire current source is disabled. H Module error could exceed specifications while the ambient temperature is changing.
  • Page 378 S7-200 Programmable Controller System Manual Table A-27 Temperature Ranges (°C) and Accuracy for Thermocouple Types Data Word (1 digit = 0.1_C) 80mV Type J Type K Type T Type E Type R, S Type N >1200.0 _C >1372.0 _C >400.0 _C 32767 7FFF >1000.0_C...
  • Page 379 Technical Specifications Appendix A Table A-28 Temperature Ranges (°F) for Thermocouple Types Data Word 80 mV 80 mV (1 digit = 0.1°F) Type J Type J Type K Type K Type T Type T Type E Type E Type R, S Type R, S Type N Type N...
  • Page 380 S7-200 Programmable Controller System Manual EM 231 RTD Module The EM 231 RTD module provides a convenient interface for the S7-200 family to several different RTDs. It also allows the S7-200 to measure three different resistance ranges. Both RTDs attached to the module must be of the same type.
  • Page 381 Technical Specifications Appendix A Table A-30 Setting RTD DIP Switches Switch 6 Open Wire Detect Setting Description Upscale Indicates positive on open wire (+3276.7 degrees) Configuration Configuration ↑ ↑1 – On Downscale Indicates negative on open wire ↓0 – Off 1 2 3 4 5 6 7 8 (–3276.8 degrees) Switch 7...
  • Page 382 S7-200 Programmable Controller System Manual EM 231 RTD Status Indicators The RTD module provides the PLC with data words that indicate temperatures or error conditions. Status bits indicate range error and user supply/module failure. LEDs indicate the status of the module. Your program should have logic to detect error conditions and respond appropriately for the application.
  • Page 383 Technical Specifications Appendix A EM 231 RTD Module Ranges EM 231 RTD temperature ranges and accuracy for each type of RTD module ar shown in Tables A-32 and A-33. Table A-32 Temperature Ranges (°C) and Accuracy for RTD Types System Word (1 digit = 0.1 _C) Pt100, Pt200, Ni100, Ni120,...
  • Page 384 S7-200 Programmable Controller System Manual Table A-33 Temperature Ranges ( ° F) for RTD Types System Word (1 digit = 0.1 _F) PT100, Pt200, PT100, Pt200, Ni100, Ni120, Ni100, Ni120, PT1000 Cu 9.035 Pt500, Pt1000 Ni1000 Decimal Hexadecimal 32767 7FF. 32766 7PHAGE ↑...
  • Page 385: Em 277 Profibus-Dp Module Specifications

    Technical Specifications Appendix A EM 277 PROFIBUS–DP Module Specifications Table A-34 EM 277 PROFIBUS–DP Module Order Number Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6ES7 277–0AA22–0XA0 EM 277 PROFIBUS–DP – – Table A-35 EM 277 PROFIBUS–DP Module General Specifications Dimensions (mm) VDC Requirements Order Number...
  • Page 386 S7-200 Programmable Controller System Manual S7-200 CPUs that Support Intelligent Modules The EM 277 PROFIBUS–DP slave module is an intelligent expansion module designed to work with the S7-200 CPUs shown in Table A-37. Table A-37 EM 277 PROFIBUS–DP Module Compatibility with S7-200 CPUs Description CPU 222 DC/DC/DC CPU 222 Rel.
  • Page 387 Technical Specifications Appendix A The EM 277 PROFIBUS–DP module has implemented the DP Standard protocol as defined for slave devices in the following communications protocol standards: EN 50 170 (PROFIBUS) describes the bus access and transfer protocol and specifies the properties of the data transfer medium.
  • Page 388 S7-200 Programmable Controller System Manual Configuration CPU 224 CPU 315-2 DP V memory I/O address areas P000 EM 277 To use the EM 277 PROFIBUS–DP as a DP Ï Ï Ï Ï PROFIBUS–DP slave, you must set the station address of the DP Module Offset: Ï...
  • Page 389 Technical Specifications Appendix A Table A-38 lists the configurations that are supported by the EM 277 PROFIBUS–DP module. The default configuration for the EM 277 module is two words of input and two words of output. Table A-38 EM 277 Configuration Options Configuration Inputs to Master Outputs from Master...
  • Page 390 S7-200 Programmable Controller System Manual Data Consistency PROFIBUS supports three types of data consistency: Byte consistency ensures that bytes are Master Slave Byte 0 Byte 0 transferred as whole units. Byte 1 Byte 1 Byte consistency Word consistency ensures that word Byte 2 Byte 2 Byte 3...
  • Page 391 Technical Specifications Appendix A Notice The manner of assigning SM locations for Intelligent modules changed for Version 2.2 and later. If you are using a CPU prior to version 2.2, you should place all intelligent modules in slots adjacent to the CPU and before all non-intelligent modules to ensure compatibility.
  • Page 392 S7-200 Programmable Controller System Manual LED Status Indicators for the EM 277 PROFIBUS–DP The EM 277 PROFIBUS–DP module has four status LEDs on the front panel to indicate the operational state of the DP port: After the S7-200 CPU is turned on, the DX MODE LED remains off as long as DP communications are not attempted.
  • Page 393 PROFIBUS–DP Module. If your version of software does not include a configuration file for the EM 277, you can access the latest GSD file (SIEM089D.GSD) at website www.profibus.com. 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 394 ;================================================ #Profibus_DP ; Module Definition List ;General parameters Module = ”2 Bytes Out/ 2 Bytes In –” 0x31 GSD_Revision Vendor_Name = ”Siemens” EndModule Module = ”8 Bytes Out/ 8 Bytes In –” 0x37 Model_Name = ”EM 277 PROFIBUS–DP” EndModule Revision = ”V1.02”...
  • Page 395 Technical Specifications Appendix A Sample Program for DP Communications to a CPU A sample program in Statement List for the PROFIBUS–DP module in slot 0 for a CPU that uses the DP port information in SM memory is shown below. The program determines the location of the DP buffers from SMW226 and the sizes of the buffers from SMB228 and SMB229.
  • Page 396 S7-200 Programmable Controller System Manual Example of DP Communications to a CPU Network 1 //Calculate the Output data pointer. If in data exchange //mode: //1. Output buffer is an offset from VB0 //2. Convert Vmem offset to double integer //3. Add to VB0 address to get output data pointer. LDB= SMB224, 2 MOVD...
  • Page 397: Em 241 Modem Module Specifications

    Technical Specifications Appendix A EM 241 Modem Module Specifications Table A-42 EM 241 Modem Module Order Number Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6ES7 241–1AA22–0XA0 EM 241 Modem Module – 1 Eight Q outputs are used as logical controls of the modem function and do not directly control any external signals. Table A-43 EM 241 Modem Module General Specifications Dimensions (mm)
  • Page 398 S7-200 Programmable Controller System Manual S7-200 CPUs that Support Intelligent Modules The EM 241 Modem module is an intelligent expansion module designed to work with the S7-200 CPUs shown in Table A-45. Table A-45 EM 241 Modem Module Compatibility with S7-200 CPUs Description CPU 222 Rel.
  • Page 399: Em 253 Position Module Specifications

    Technical Specifications Appendix A EM 253 Position Module Specifications Table A-47 EM 253 Position Module Order Number Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6ES7 253–1AA22–0XA0 EM 253 Position Module – Eight Q outputs are used as logical controls of the motion function and do not directly control any external signals. Table A-48 EM 253 Position Module General Specifications Dimensions (mm)
  • Page 400 S7-200 Programmable Controller System Manual Table A-49 EM 253 Position Module Specifications, continued General 6ES7 253–1AA22–0XA0 Output Features Number of integrated outputs 6 points (4 signals) Output type P0+, P0–, P1+, P1– RS422/485 driver P0, P1, DIS, CLR Open drain Output voltage P0, P1, RS–422 drivers, differential output voltage Open circuit...
  • Page 401 Technical Specifications Appendix A S7-200 CPUs that Support Intelligent Modules The EM 253 Position module is an intelligent expansion module designed to work with the S7-200 CPUs shown in Table A-50. Table A-50 EM 253 Position Module Compatibility with S7-200 CPUs Description CPU 222 Rel.
  • Page 402 S7-200 Programmable Controller System Manual Wiring Diagrams In the following schematic figures, the terminals are not in order. See Figure A-28 for terminal arrangement. +5VDC 3.3K 5.6K STOP 3.3K 5.6K 3.3K 3.3K 5.6K LMT+ P0– 5.6K P1– LMT– Figure A-29 Internal Schematic for the Inputs and Outputs of the EM 253 Position Module EM253 Motion Module FM Step Drive...
  • Page 403 Technical Specifications Appendix A EM253 Motion Module Industrial Devices Corp. (Next Step) +24V +5VDC 3.3K 24V_RTN STOP 3.3K Terminals are not in order. See Figure A-28 for terminal 3.3K arrangement. 3.3K LMT+ P0– LMT– P1– Figure A-31 Connecting an EM 253 Position Module to a Industrial Devices Corp. (Next Step) EM253 Motion Module Oriental Motor UPK Standard +24V...
  • Page 404 S7-200 Programmable Controller System Manual EM253 Motion Module Parker/Compumotor OEM 750 +24V +5VDC 3.3K 24V_RTN STOP 3.3K 3.3K Terminals are not in order. See Figure A-28 for terminal arrangement. 3.3K LMT+ Step P0– LMT– P1– Figure A-33 Connecting an EM 253 Position Module to a Parker/Compumotor OEM 750...
  • Page 405: As-Interface (Cp 243-2) Module Specifications

    Technical Specifications Appendix A AS–Interface (CP 243–2) Module Specifications Table A-52 AS-Interface (CP 243–2) Module Order Number Removable Order Number Expansion Model EM Inputs EM Outputs Connector 6GK7 243–2AX01–0XA0 AS–Interface (CP 243–2) Module 8 Digital and 8 Digital and 8 Analog 8 Analog Table A-53 AS-Interface (CP 243–2) Module General Specifications...
  • Page 406 S7-200 Programmable Controller System Manual Operation In the process image of the S7-200, the AS–Interface Module occupies a digital input byte (status byte), a digital output byte (control byte), 8 analog input and 8 analog output words. The AS–Interface Module uses two logical module positions.
  • Page 407: Optional Cartridges

    Technical Specifications Appendix A Optional Cartridges Cartridge Description Order Number Memory cartridge Memory cartridge storage: Program, Data, and Configuration 6ES7 291–8GE20–0XA0 Real-Time Clock with battery Clock cartridge accuracy: 6ES7 297–1AA20–0XA0 2 minutes/month at 25°C, 7 minutes/month at 0°C to 55°C Battery cartridge Battery cartridge (data retention time): 200 days, typical 6ES7 291–8BA20–0XA0...
  • Page 408: Pc/Ppi Cable

    S7-200 Programmable Controller System Manual PC/PPI Cable PC/PPI Cable (6ES7 901–3BF21–0XA0) General Characteristics Supply voltage 14.4 to 28.8 VDC Supply current at 24 V nominal supply 50 mA RMS max. 1.2 µS max. Direction change delay: RS–232 start bit edge received to RS–485 start bit edge transmitted Direction change delay: RS–232 stop bit edge received to RS–485 1.4 character times max.
  • Page 409 Technical Specifications Appendix A Table A-55 Switch Selections on the PC/PPI Cable Baud Rate Switches 1,2,3* Modem Operation Switch 4* DCE/DTE Selection Switch 5* RTS Selection for DTE Switch 6* 115200 – 38400 11-bit modem RTS always active 19200 10-bit modem RTS active when PLC transmits 1 9600 4800...
  • Page 410: Input Simulators

    S7-200 Programmable Controller System Manual Input Simulators 8 Position Simulator 14 Position Simulator 24 Position Simulator Order Number 6ES7 274–1XF00–0XA0 6ES7 274–1XH00–0XA0 6ES7 274–1XK00–0XA0 Size (L x W x D) 61 x 36 x 22 mm 91 x 36 x 22 mm 147 x 36 x 25 mm Weight 0.02 Kg...
  • Page 411: Calculating A Power Budget

    Calculating a Power Budget The S7-200 CPU has an internal power supply that provides power for the CPU itself, for any expansion modules, and for other 24 VDC user power requirements. Use the following information as a guide for determining how much power (or current) the S7-200 CPU can provide for your configuration. Power Requirements Each S7-200 CPU supplies both 5 VDC and 24 VDC power: Each CPU has a 24 VDC sensor supply that can supply 24 VDC for local input points or for relay...
  • Page 412 S7-200 Programmable Controller System Manual Calculating a Sample Power Requirement Table B-1 shows a sample calculation of the power requirements for an S7-200 that includes the following: S7-200 CPU 224 AC/DC/Relay 3 each EM 223 8 DC In/8 Relay Out 1 each EM 221 8 DC In This installation has a total of 46 inputs and 34 outputs.
  • Page 413 Calculating a Power Budget Appendix B Calculating Your Power Requirement Use the table below to determine how much power (or current) the S7-200 CPU can provide for your configuration. Refer to Appendix A for the power budgets of your CPU model and the power requirements of your expansion modules.
  • Page 414 S7-200 Programmable Controller System Manual...
  • Page 415: Error Codes

    Error Codes The information about error codes is provided to help you identify problems with your S7-200 CPU. In This Chapter Fatal Error Codes and Messages ............Run-Time Programming Problems .
  • Page 416: Fatal Error Codes And Messages

    S7-200 Programmable Controller System Manual Fatal Error Codes and Messages Fatal errors cause the S7-200 to stop the execution of your program. Depending on the severity of the error, a fatal error can render the S7-200 incapable of performing any or all functions. The objective for handling fatal errors is to bring the S7-200 to a safe state from which the S7-200 can respond to interrogations about the existing error conditions.
  • Page 417: Run-Time Programming Problems

    Error Codes Appendix C Run-Time Programming Problems Your program can create non-fatal error conditions (such as addressing errors) during the normal execution of the program. In this case, the S7-200 generates a non-fatal run-time error code. Table C-2 lists the descriptions of the non-fatal error codes. Table C-2 Run-Time Programming Problems Error Code...
  • Page 418: Compile Rule Violations

    S7-200 Programmable Controller System Manual Compile Rule Violations When you download a program, the S7-200 compiles the program. If the S7-200 detects that the program violates a compile rule (such as an illegal instruction), the S7-200 aborts the download and generates a non-fatal, compile-rule error code.
  • Page 419: Special Memory (Sm) Bits

    Special Memory (SM) Bits Special memory bits provide a variety of status and control functions, and also serve as a means of communicating information between the S7-200 and your program. Special memory bits can be used as bits, bytes, words, or double words. In This Chapter SMB0: Status Bits .
  • Page 420: Smb0: Status Bits

    S7-200 Programmable Controller System Manual SMB0: Status Bits As described in Table D-1, SMB0 contains eight status bits that are updated by the S7-200 at the end of each scan cycle. Table D-1 Special Memory Byte SMB0 (SM0.0 to SM0.7) SM Bits Description (Read Only) SM0.0...
  • Page 421: Smb2: Freeport Receive Character

    Special Memory (SM) Bits Appendix D SMB2: Freeport Receive Character SMB2 is the Freeport receive character buffer. As described in Table D-3, each character received while in Freeport mode is placed in this location for easy access from the ladder logic program. SMB2 and SMB3 are shared between Port 0 and Port 1.
  • Page 422: Smb5: I/O Status

    S7-200 Programmable Controller System Manual SMB5: I/O Status As described in Table D-6, SMB5 contains status bits about error conditions that were detected in the I/O system. These bits provide an overview of the I/O errors detected. Table D-6 Special Memory Byte SMB5 (SM5.0 to SM5.7) SM Bits Description (Read Only) SM5.0...
  • Page 423: Smb8 To Smb21: I/O Module Id And Error Registers

    Special Memory (SM) Bits Appendix D SMB8 to SMB21: I/O Module ID and Error Registers SMB8 through SMB21 are organized in byte pairs for expansion modules 0 to 6. As described in Table D-8, 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.
  • Page 424: Smw22 To Smw26: Scan Times

    S7-200 Programmable Controller System Manual SMW22 to SMW26: Scan Times As described in Table D-9, SMW22, SMW24, and SMW26 provide scan time information: minimum scan time, maximum scan time, and last scan time in milliseconds. Table D-9 Special Memory Words SMW22 to SMW26 SM Word Description (Read Only) SMW22...
  • Page 425: Smb31 And Smw32: Permanent Memory (Eeprom) Write Control

    Special Memory (SM) Bits Appendix D SMB31 and SMW32: Permanent Memory (EEPROM) Write Control You can save a value stored in V memory to permanent memory (EEPROM) under the control of your program. To do this, load the address of the location to be saved in SMW32. Then, load SMB31 with the command to save the value.
  • Page 426 S7-200 Programmable Controller System Manual Table D-14 Special Memory Bytes SMB36 to SMD62 SM Byte Description SM36.0 to SM36.4 Reserved SM36.5 HSC0 current counting direction status bit: 1 = counting up SM36.6 HSC0 current value equals preset value status bit: 1 = equal SM36.7 HSC0 current value is greater than preset value status bit: 1 = greater than SM37.0...
  • Page 427: Smb66 To Smb85: Pto/Pwm Registers

    Special Memory (SM) Bits Appendix D SMB66 to SMB85: PTO/PWM Registers As described in Table D-15, SMB66 through SMB85 are used to monitor and control the pulse train output and pulse width modulation functions. See the information on pulse output high-speed output instructions in Chapter 6 for a complete description of these bits.
  • Page 428: Smb86 To Smb94, And Smb186 To Smb194: Receive Message Control

    S7-200 Programmable Controller System Manual SMB86 to SMB94, and SMB186 to SMB194: Receive Message Control As described in Table D-16, SMB86 through SMB94 and SMB186 through SMB194 are used to control and read the status of the Receive Message instruction. Table D-16 Special Memory Bytes SMB86 to SMB94, and SMB186 to SMB194 Port 0...
  • Page 429: Smw98: Errors On The Expansion I/O Bus

    Special Memory (SM) Bits Appendix D SMW98: Errors on the Expansion I/O Bus As described in Table D-17, SMW98 gives you information about the number of errors on the expansion I/O bus. Table D-17 Special Memory Bytes SMW98 SM Byte Description SMW98 This location is incremented each time a parity error is detected on the expansion I/O bus.
  • Page 430: Smb166 To Smb185: Pto0, Pto1 Profile Definition Table

    S7-200 Programmable Controller System Manual Table D-18 Special Memory Bytes SMB131 to SMB165, continued SM Byte Description SM156.0 to SM156.4 Reserved SM156.5 HSC5 current counting direction status bit: 1 = counting up SM156.6 HSC5 current value equals preset value status bit: 1 = equal SM156.7 HSC5 current value is greater than preset value status bit: 1 = greater than SM157.0 to SM157.2...
  • Page 431: Smb200 To Smb549: Intelligent Module Status

    Special Memory (SM) Bits Appendix D SMB200 to SMB549: Intelligent Module Status As shown in Table D-20, SMB200 through SMB549 are reserved for information provided by intelligent expansion modules, such as the EM 277 PROFIBUS–DP module. For information about how your module uses SMB200 through SMB549, refer to Appendix A for the specifications of your specific module.
  • Page 432 S7-200 Programmable Controller System Manual...
  • Page 433: S7-200 Order Numbers

    S7-200 Order Numbers CPUs Order Number CPU 221 DC/DC/DC 6 Inputs/4 Outputs 6ES7 211–0AA22–0XB0 CPU 221 AC/DC/Relay 6 Inputs/4 Relays 6ES7 211–0BA22–0XB0 CPU 222 DC/DC/DC 8 Inputs/6 Outputs 6ES7 212–1AB22–0XB0 CPU 222 AC/DC/Relay 8 Inputs/6 Relays 6ES7 212–1BB22–0XB0 CPU 224 DC/DC/DC 14 Inputs/10 Outputs 6ES7 214–1AD22–0XB0 CPU 224 AC/DC/Relay 14 Inputs/10 Relays 6ES7 214–1BD22–0XB0...
  • Page 434 S7-200 Programmable Controller System Manual Cartridges and Cables Order Number MC 291, 32K x 8 EEPROM Memory Cartridge 6ES7 291–8GE20–0XA0 CC 292, CPU 22x Real-Time Clock with Battery Cartridge 6ES7 297–1AA20–0XA0 BC 293, CPU 22x Battery Cartridge 6ES7 291–8BA20–0XA0 Cable, I/O Expansion, .8 meters, CPU 22x/EM 6ES7 290–6AA20–0XA0 Cable, PC/PPI, Isolated, 90 deg connector, RTS switch 6ES7 901–3BF21–0XA0...
  • Page 435 S7-200 Order Numbers Appendix E Operator Interfaces Order Number TD 200 Operator Interface 6ES7 272–0AA20–0YA0 OP3 Operator Interface 6AV3 503–1DB10T OP7 Operator Interface 6AV3 607–1JC20–0AX1 OP17 Operator Interface 6AV3 617–1JC20–0AX1 TP070 Touch Panel 6AV6 545–0AA15–2AX0 TP170A Touch Panel 6AV6 545–0BA15–2AX0 Miscellaneous Order Number DIN Rail Stops...
  • Page 436 S7-200 Programmable Controller System Manual...
  • Page 437: Execution Times For Stl Instructions

    Execution Times for STL Instructions Instruction execution times are very important if your application has time-critical functions. The instruction execution times are shown in Table F-3. When you use the execution times in Table F-3, you should consider the effect of power flow to the instruction, the effect of indirect addressing, and the use of certain memory areas on these execution times.
  • Page 438 S7-200 Programmable Controller System Manual Table F-3 Instruction Execution Times µs µs Instruction Instruction Using: 0.37 SM, T, C, V, S, Q, M AW < =, =, >=, >, <, <> 19.2 BCDI Using: Local inputs –D Expansion inputs Using: Local outputs Expansion outputs Time = Base + (length<LM)
  • Page 439 Execution Times for STL Instructions Appendix F µs µs Instruction Instruction DECW DISI 0.37 Using: I, SM0.0 0.37 SM, T, C, V, S, Q, M 10.9 DTCH LDB <=, =, >=, >, <, <> LDD <=, =, >=, >, <, <> 70 Max Using: Local inputs...
  • Page 440 S7-200 Programmable Controller System Manual µs µs Instruction Instruction Using: Local inputs ROUND Expansion inputs 183 Max 0.37 Total = Base + (length<LM) Base Using: 0.37 Length multiplier (LM) SM, T, C, V, S, Q, M 10.8 Total = Base + (length<LM) Base Using: Local inputs...
  • Page 441 Execution Times for STL Instructions Appendix F µs µs Instruction Instruction Total = Base + (length<LM) Time = Base + (LM*N) Base Base (for 1st source character) LM using local output Length multiplier (LM) LM using expansion output N is the number of additional source characters If length is stored as a variable, add to Base...
  • Page 442 S7-200 Programmable Controller System Manual...
  • Page 443: S7-200 Quick Reference Information

    S7-200 Quick Reference Information To help you find information more easily, this section summarizes the following information: Special Memory Bits Descriptions of Interrupt Events Summary of S7-200 CPU Memory Ranges and Features High-Speed Counters HSC0, HSC1, HSC2, HSC3, HSC4, HSC5 S7-200 Instructions Table G-1 Special Memory Bits...
  • Page 444 S7-200 Programmable Controller System Manual Table G-2 Interrupt Events in Priority Order Event Number Interrupt Description Priority Group Priority in Group Port 0: Receive character Port 0: Transmit complete Port 0: Receive message complete Communications Communications (highest) Port 1: Receive message complete Port 1: Receive character Port 1: Transmit complete PTO 0 complete interrupt...
  • Page 445 S7-200 Quick Reference Information Appendix G Table G-3 Summary of S7-200 CPU Memory Ranges and Features Description CPU 221 CPU 222 CPU 224 CPU 226 CPU 226XM Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ...
  • Page 446 S7-200 Programmable Controller System Manual Table G-4 High-Speed Counters HSC0, HSC3, HSC4, and HSC5 HSC0 HSC3 HSC4 HSC5 Mode I0.0 I0.1 I0.2 I0.1 I0.3 I0.4 I0.5 I0.4 Reset Reset Direction Direction Direction Reset Direction Reset Clk Up Clk Down Clk Up Clk Down Clk Up Clk Down...
  • Page 447 S7-200 Quick Reference Information Appendix G Boolean Instructions Math, Increment, and Decrement instructions Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Load IN1, OUT Add Integer, Double Integer or Real...
  • Page 448 S7-200 Programmable Controller System Manual Move, Shift, and Rotate Instructions Table, Find, and Conversion Instructions Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ MOVB IN, OUT DATA, TBL Add data to table...
  • Page 449: Index

    Index Symbols Analog input (AI) addressing, 29 &, 32 filtering, 42 *, 32 Analog modules, 3 EM 231 analog input, 354 EM 231 RTD, 361 EM 231 thermocouple, 361 AC installation guidelines, 19 EM 232 analog output, 358 AC outputs and relays, 20 EM 235 analog input/output, 355 ACCEL_TIME (Acceleration Time), EM 253 Position Analog output (AQ), addressing, 29...
  • Page 450 S7-200 Programmable Controller System Manual Block move word instruction, 167 Coil instructions Bookmarks, 236 no operation, 68 Boolean instructions output, 68 coils, 68 output immediate, 68 contacts, 66 reset, 68 logic stack, 70 reset immediate, 68 set/reset bistable, 72 set, 68 Break detection, 83 set immediate, 68 Buffer consistency, PROFIBUS, 378...
  • Page 451 Index Compare real instruction, 89 Connector terminals (continued) Compare string instruction, 91 EM 221 DI 8 x AC, 349 Comparing, token rotation times, 230 EM 221 DI 8x24 VDC, 349 Compatibility EM 222 DO 8 x Relay, 349 EM 231 RTD, 362 EM 223 DI 16/DO 16 x 24 VDC Relay, 350 EM 231 thermocouple, 362 EM 222 DO 8x24 VDC, 349...
  • Page 452 S7-200 Programmable Controller System Manual Counter instructions Creating high--speed counter (HSC), 111 configuration drawings, 49 high--speed counter definition (HDEF), 111 program, 8 program with Micro/WIN, 51 down counter, 109 symbolic name list, 49 up counter, 109 user--defined protocols, 222 up/down counter, 109 Cross reference table, 236 SIMATIC Current value...
  • Page 453 Index DIP switches EM 231 thermocouple module RTD, 368–369 basics, 363 thermocouple, 364 configuring, 363 Direction, changing in HSC, 123 connector terminals, 362 Disable interrupt instruction, 155 CPU compatibility, 362 Disabling, high--speed counters, 123 selecting DIP switches, 364 Discrete modules, 3 specifications, 361 Display panels status indicators, 365...
  • Page 454 S7-200 Programmable Controller System Manual EM 253 Position Module EM 277 PROFIBUS--DP module ACCEL_TIME, 249 additional features, 380 command byte, 283 address switches, 374 configuration, 275 as DP slave, 375 Configuration/Profile table, 278 configuration file, 381–382 configuring, 246 configuration options, 377 creating instructions, 286 configuring, 376–377 DECEL_TIME, 249...
  • Page 455 Index Examples SIMATIC timers, 198, 199, 200 add to table instruction, 189 single--segment PTO, 136 AND instruction, 164 standard conversion instructions, 94 ASCII to hex instruction, 99 stop instruction, 169 block move instruction, 167 subroutine, 49 calculating power requirements, 399 subroutine call, 204 compare instructions, 89 subroutine instructions, 205...
  • Page 456 S7-200 Programmable Controller System Manual Fill instruction, 192 Filtering Handling analog inputs, 42 complex communications, 231 digital inputs, 41 errors, 56 Find first character within string instruction, 187 Hardware, troubleshooting, 241 Find instruction, 193 Hex to ASCII instruction, 96 Find string within string instruction, 187 High potential isolation test, 339 First--in--first--out instruction, 190 High--speed counter (HSC) instruction, 111...
  • Page 457 Index IEC 1131--3 instruction set, 53 heat--generating devices, 14 IEC counter instructions high voltage devices, 14 down counter, 109 I/O expansion cable, 395 example, 109 memory cartridge, 36 up counter, 109 mounting requirements, 16 up/down counter, 109 power supply, 15 IEC timer instructions, 201 S7--200, 15 example, 201...
  • Page 458 S7-200 Programmable Controller System Manual Instructions (continued) off--delay timer (TOF), 196, 201 double integer to real, 93 on--delay timer (TON), 196, 201 down counter, 109 OR, 163 EM 241 Modem module, 298 OR load, 70 EM 253 Position Module, 257 output, 68 enable interrupt, 155 output immediate, 68...
  • Page 459 Index Instructions (continued) Isolation swap bytes, 183 network, 218 table, 190–195 wiring guidelines, 18 table find, 193 tangent, 143 transmit, 79 truncate, 94 Jerk Time, EM 253 Position Module, 250 up counter, 109 Jog parameters up/down counter, 109 EM 253 Position Module, 249 USS protocol, 314 jog operation, 249 watchdog reset, 168...
  • Page 460 S7-200 Programmable Controller System Manual Logical operations instructions Memory fill instruction, 192 AND, OR, XOR, 163 example, 192 invert, 162 Memory functions Loop control block move instructions, 167 (PID) instructions, 145–156 move instructions, 165 adjusting bias, 150 rotate instructions, 179 converting inputs, 149 shift instructions, 179 converting outputs, 150...
  • Page 461 Index Modem module, 385 Multiply integer to double integer instruction (MUL), 142 configuration table, 293 example, 142 CPU Data Transfer Message Format, 310 data transfers, 291 errors from instructions, 301 example, 303 National standards, 338 features, 288 Natural exponential instruction, 143 instructions, 298 Natural logarithm instruction, 143 International telephone line interface, 288...
  • Page 462 S7-200 Programmable Controller System Manual Number, representation, 29 Outputs and relays, 20 Numbers, representation, 24, 30 Numeric instructions cosine, 143 natural exponential, 143 Paging, Modem module, 290 natural logarithm, 143 Panel mounting, 16 sine, 143 Parameters square root, 143 in subroutines, 203 tangent, 143 types for subroutines, 204 Numeric paging, EM 241 Modem module, 290...
  • Page 463 Index Position module POSx_CLR, 267 ACCEL_TIME, 249 POSx_CTRL, 258 configuration, 275 POSx_DIS, 266 Configuration/Profile table, 278 POSx_GOTO, 260 configuring, 246 POSx_LDOFF, 263 creating instructions, 286 POSx_LDPOS, 264 DECEL_TIME, 249 POSx_MAN, 259 diagnostics information, 275 POSx_RSEEK, 262 displaying and controlling operation, 274 POSx_RUN, 261 eliminating backlash, 256 POSx_SRATE, 265...
  • Page 464 S7-200 Programmable Controller System Manual Program Pulse catch, 41 analog inputs, 22 Pulse catch feature, 42 basic elements, 49 Pulse output instruction (PLS), 125 compile errors, 56 Pulse outputs copying to memory cartridge, 36 high--speed, 46 creating, 8 pulse output instruction (PLS), 125 creating with STEP 7--Micro/WIN, 51 pulse train output instruction (PTO), 125 debugging features, 236...
  • Page 465 Index Real--time clock instructions, 73 Rotate instructions, 179 Receive instruction, 79 example, 180 break detection, 83 types, 179 end character detection, 84 Rotate left byte instruction, 179 end conditions, 82 Rotate left double word instruction, 179 example, 86 Rotate left word instruction, 179 Freeport mode, 79 Rotate right byte instruction, 179 idle line detection, 82...
  • Page 466 S7-200 Programmable Controller System Manual S7--200 (continued) Selecting memory cartridge, 36 communication protocol, 211 memory ranges, 64, 461 CP card, 220 modem, 226 instruction sets, 53 network address, 209–211 PC/PPI cable, 220 password protection, 44 program editor, 51 power supply, 6 RTD DIP switches, 368–369 process image register, 39 S7--200 operating mode, 37...
  • Page 467 Index Single--master PPI network, 213 SS_SPEED, EM 253 Position Module, 248 Single--segment operation Standard contact instruction, 66 changing PTO cycle time, 134 Standard conversion instructions, 92 changing PTO cycle time and pulse count, 135 Standard DIN rail, 15 changing PTO pulse count, 135 Standards, national and international, 338 initializing PTO, 134 Start, high--speed counter, 116...
  • Page 468 S7-200 Programmable Controller System Manual String instructions Terminating, network cable, 220 concatenate string, 184 Text Message Format, EM 241 Modem module, 309 copy string, 184 Text paging, EM 241 Modem module, 290 copy substring from string, 186 Thermocouple module (EM 231) find first character within string, 187 basics, 363 find string within string, 187...
  • Page 469 Index USS protocol, requirements, 312 USS protocol instructions Watchdog reset instruction, 168 execution errror codes, 323 example, 169 guidelines for using, 314 Wiring, 18, 19 sample program, 322 Wiring diagrams USS4_DRV_CTRL, 316 analog expansion modules, 352 USS4_INIT, 315 CPU inputs and outputs, 343 USS4_RPM_x and USS4_WPM_x, 319, 320 CPU modules, 343–345 USS Protocol Library, controlling MicroMaster drives, 311...
  • Page 470 S7-200 Programmable Controller System Manual...
  • Page 471 SIEMENS ENERGY & AUTOMATION INC ATTN: TECHNICAL COMMUNICATIONS M/S 519 3000 BILL GARLAND ROAD PO BOX 1255 JOHNSON CITY TN USA 37605--1255 From Name: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _...
  • Page 472 Your comments and recommendations will help us to improve the quality and usefulness of our publications. Please take the first available opportunity to fill out this questionnaire and return it to Siemens. Please give each of the following questions your own personal mark within a range from 1 (very good) to 5 (very poor).
  • Page 473 S7-200 Memory Ranges and Features Description CPU 221 CPU 222 CPU 224 CPU 226 CPU 226XM User program size 2 Kwords 2 Kwords 4 Kwords 4 Kwords 8 Kwords User data size 1 Kwords 1 Kwords 2.5 Kwords 2.5 Kwords 5 Kwords Process-image input register I0.0 to I15.7...
  • Page 474 Page Page Page Page Page IBCD AW > INCB LSCR AW > = INCD MOVB AW <> INCW MOVD BCDI INVB MOVR INVD MOVW ROUND INVW NEXT NETR NETW CALL CFND OB = SCAT OB > = SCPY CRET LDB <= OB >...

Table of Contents