Siemens S7-1200 System Manual
Hide thumbs Also See for S7-1200:
Table of Contents

Quick Links

S7-1200 Programmable controller
SIMATIC
S7
S7-1200 Programmable controller
System Manual
03/2014
A5E02486680-AG
___________________
Preface
___________________
Product overview
STEP 7 programming
___________________
software
___________________
Installation
___________________
PLC concepts
___________________
Device configuration
___________________
Programming concepts
___________________
Basic instructions
___________________
Extended instructions
___________________
Technology instructions
___________________
Communication
___________________
Web server
Communication processor
___________________
and Modbus TCP
Teleservice communication
___________________
(SMTP email)
___________________
Online and diagnostic tools
___________________
SM 1278 4xIO-Link Master
___________________
Technical specifications
___________________
Calculating a power budget
___________________
Order numbers
Exchanging a V3.0 CPU for
___________________
a V4.0 CPU
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
A
B
C
D
Table of Contents
loading

Summary of Contents for Siemens S7-1200

  • Page 1 ___________________ S7-1200 Programmable controller Preface ___________________ Product overview STEP 7 programming ___________________ software ___________________ Installation SIMATIC ___________________ PLC concepts ___________________ Device configuration S7-1200 Programmable controller ___________________ Programming concepts ___________________ Basic instructions System Manual ___________________ Extended instructions ___________________ Technology instructions ___________________...
  • Page 2 Note the following: WARNING Siemens products may only be used for the applications described in the catalog and in the relevant technical documentation. If products and components from other manufacturers are used, these must be recommended or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and maintenance are required to ensure that the products operate safely and without any problems.
  • Page 3: Preface

    ● STEP 7 V13 Basic and Professional (Page 35) ● S7-1200 CPU firmware release V4.0 For a complete list of the S7-1200 products described in this manual, refer to the technical specifications (Page 829). Certification, CE label, C-Tick, and other standards Refer to the technical specifications (Page 829) for more information.
  • Page 4 Preface Documentation and information S7-1200 and STEP 7 provide a variety of documentation and other resources for finding the technical information that you require. ● The S7-1200 system manual provides specific information about the operation, programming, and the specifications for the complete S7-1200 product family. In addition to the system manual, the S7-1200 Easy Book provides a more general overview to the capabilities of the S7-1200 family.
  • Page 5 Siemens recommends strongly that you regularly check for product updates. For the secure operation of Siemens products and solutions, it is necessary to take suitable preventive action (e.g. cell protection concept) and integrate each component into a holistic, state-of-the-art industrial security concept.
  • Page 6 Preface S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 7: Table Of Contents

    Installing and removing an SM ..................... 60 3.3.5 Installing and removing a CM or CP .................... 62 3.3.6 Removing and reinstalling the S7-1200 terminal block connector ..........63 3.3.7 Installing and removing the expansion cable ................64 3.3.8 TS (TeleService) adapter ......................66 3.3.8.1...
  • Page 8 4.1.8 Configuring the outputs on a RUN-to-STOP transition ............. 104 Data storage, memory areas, I/O and addressing ..............105 4.2.1 Accessing the data of the S7-1200 ................... 105 Processing of analog values ..................... 110 Data types ..........................110 4.4.1 Bool, Byte, Word, and DWord data types ................. 111 4.4.2...
  • Page 9 Function Block Diagram (FBD) ....................181 6.5.3 SCL ............................181 6.5.4 EN and ENO for LAD, FBD and SCL ..................188 Protection ........................... 190 6.6.1 Access protection for the CPU ....................190 6.6.2 Know-how protection ......................... 193 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 10 SCALE_X (Scale) and NORM_X (Normalize) instructions ............251 Program control operations ....................... 254 7.8.1 JMP (Jump if RLO = 1), JMPN (Jump if RLO = 0), and Label (Jump label) instructions ..254 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 11 8.2.4.5 DELETE (Delete characters in a character string) instruction ........... 310 8.2.4.6 INSERT (Insert characters in a character string) instruction ............. 311 8.2.4.7 REPLACE (Replace characters in a character string) instruction ..........312 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 12 Limit to the size of data log files ....................393 8.7.2.5 Data log example program ......................396 Data block control ........................401 8.8.1 READ_DBL and WRIT_DBL (Read/write a data block in load memory) instructions ....401 Address handling ........................404 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 13 9.3.5.12 MC_WriteParam (write parameters of a technology object) instruction ........478 9.3.5.13 MC_ReadParam instruction (read parameters of a technology object) instruction ....480 9.3.6 Operation of motion control for S7-1200 ..................481 9.3.6.1 CPU outputs used for motion control ..................481 9.3.6.2...
  • Page 14 10.3.6 Diagnostic events for distributed ....................576 10.4 AS-i ............................576 10.4.1 Configuring an AS-i master and slave device ................577 10.4.1.1 Adding the AS-i master CM 1243-2 and AS-i slave ..............577 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 15 User-defined Web pages ......................625 11.6.1 Creating HTML pages ........................ 626 11.6.2 AWP commands supported by the S7-1200 Web server ............627 11.6.2.1 Reading variables ........................629 11.6.2.2 Writing variables......................... 630 11.6.2.3 Reading special variables ......................631 11.6.2.4 Writing special variables ......................633 11.6.2.5 Using an alias for a variable reference ..................
  • Page 16 11.7.2 Feature restrictions when the Internet options do not allow cookies ........666 11.7.3 Importing the Siemens security certificate ................666 11.7.4 Importing CSV format data logs to non-USA/UK versions of Microsoft Excel ......667 Communication processor and Modbus TCP ..................669 12.1...
  • Page 17 Comparing offline and online CPUs ................... 794 14.11 Monitoring and modifying values in the CPU ................795 14.11.1 Going online to monitor the values in the CPU ................796 14.11.2 Displaying status in the program editor ..................797 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 18 Sample time for the built-in analog ports of the CPU ..............843 A.2.4.3 Measurement ranges of the analog inputs for voltage (CPUs) ..........843 A.2.5 CPU 1211 wiring diagrams ....................... 844 CPU 1212C ..........................847 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 19 SM 1232 analog output module specifications ................910 A.8.3 SM 1234 analog input/output module specifications ..............913 A.8.4 Step response of the analog inputs ................... 916 A.8.5 Sample time and update times for the analog inputs..............916 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 20 A.14.4.2 CM 1241 RS232 specifications ....................975 A.14.4.3 CM 1241 RS422/485 specifications ..................976 A.15 TeleService (TS Adapter and TS Adapter modular) ..............978 A.16 SIMATIC memory cards ......................978 A.17 Input simulators ......................... 978 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 21 Table of contents A.18 S7-1200 Potentiometer module ....................980 A.19 I/O expansion cable ........................981 A.20 Companion products ........................982 A.20.1 PM 1207 power module ......................982 A.20.2 CSM 1277 compact switch module.................... 982 A.20.3 CM CANopen module ........................ 983 Calculating a power budget .........................
  • Page 22 Table of contents S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 23: Product Overview

    Product overview Introducing the S7-1200 PLC The S7-1200 controller provides the flexibility and power to control a wide variety of devices in support of your automation needs. The compact design, flexible configuration, and powerful instruction set combine to make the S7-1200 a perfect solution for controlling a wide variety of applications.
  • Page 24 Product overview 1.1 Introducing the S7-1200 PLC Table 1- 1 Comparing the CPU models Feature CPU 1211C CPU 1212C CPU 1214C CPU 1215C CPU 1217C Physical size (mm) 90 x 100 x 75 90 x 100 x 75 110 x 100 x 75...
  • Page 25 Product overview 1.1 Introducing the S7-1200 PLC Table 1- 2 Blocks, timers, and counters supported by S7-1200 Element Description Blocks Type OB, FB, FC, DB Size 30 Kbytes (CPU 1211C) 50 Kbytes (CPU 1212C) 64 Kbytes (CPU 1214C, CPU 1215C, and CPU 1217C)
  • Page 26: Expansion Capability Of The Cpu

    1.2 Expansion capability of the CPU Expansion capability of the CPU The S7-1200 family provides a variety of modules and plug-in boards for expanding the capabilities of the CPU with additional I/O or other communication protocols. For detailed information about a specific module, see the technical specifications (Page 829).
  • Page 27 Ethernet cable. You can install up to 3 TS adapter modules onto the TS Adapter IE Basic. Table 1- 6 Technology modules Module Type Description ④ SM 1278 4xIO-Link Master Supports 4 IO link slaves IO Link S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 28 Product overview 1.2 Expansion capability of the CPU Table 1- 7 Other boards Module Description ③ Plugs into expansion board interface on front of CPU. Provides long term Battery board backup of realtime clock S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 29: S7-1200 Modules

    Product overview 1.3 S7-1200 modules S7-1200 modules Table 1- 8 S7-1200 expansion modules Type of module Description ① The CPU supports one plug-in Status LEDs on expansion board: the SB ② Removable user A signal board (SB) provides • wiring connector additional I/O for your CPU.
  • Page 30: New Features

    ● STEP 7 includes a trace and logic analyzer function (Page 813) that you can use with the V4.0 S7-1200 CPUs. With this feature, you can configure specific data that you want to trace and record when the CPU meets a trigger condition that you define. The CPU stores the recorded data, and STEP 7 provides tools for retrieving and analyzing the recorded data.
  • Page 31 ● New S7-1200 Potentiometer module (Page 980) (6ES7 274-1XA30-0XA0) ● New CM CANopen for S7-1200 (Page 983) is a plug-in module that allows you to connect CANopen devices to the S7-1200 PLC. It can be configured to be both master or slave.
  • Page 32: Basic Hmi Panels

    211.2 mm x 158.4 mm (10.4") • 200 alarms • Resolution: 640 x 480 • 25 curves • 40 KB recipe memory • 5 recipes, 20 data records, 20 entries • KTP 1000 Basic PN S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 33 • Resolution: 1024 x 768 • 25 curves • 40 KB recipe memory (integrated • flash) 5 recipes, 20 data records, 20 entries • TP 1500 Basic PN See also Customer support (http://www.siemens.com/automation/) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 34 Product overview 1.5 Basic HMI panels S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 35: Step 7 Programming Software

    STEP 7 is the programming and configuration software component of the TIA Portal. The TIA Portal, in addition to STEP 7, also includes WinCC for designing and executing runtime process visualization, and includes online help for WinCC as well as STEP 7. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 36: System Requirements

    STEP 7 Professional) Windows 7 or higher (Professional, Enterprise, Ultimate) • Graphics card 32 MB RAM 24-bit color depth Screen resolution 1024 x 768 Network 20 Mbit/s Ethernet or faster Optical drive DVD-ROM S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 37: Different Views To Make The Work Easier

    To toggle between the open editors, simply click the different editor. You can also arrange two editors to appear together, arranged either vertically or horizontally. This feature allows you to drag and drop between editors. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 38: Easy-To-Use Tools

    (For the "Favorites" in the instruction tree, double- click the icon.) You can easily customize the "Favorites" by adding new instructions. Simply drag and drop an instruction to the "Favorites". The instruction is now just a click away! S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 39: Creating A Complex Equation With A Simple Instruction

    - In )) * (In - In ) + Out value high high value = ((in4 - in5) / (in2 - in3)) * (in1 - in3) + in5 Where: (Out) Scaled output value value S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 40 OUT = ((in4 - in5) / (in2 - in3)) * (in1 - in3) + in5 When you click "OK", the Calculate instruction creates the inputs required for the instruction. Enter the tag names for the values that correspond to the parameters. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 41: Adding Inputs Or Outputs To A Lad Or Fbd Instruction

    ● To remove an input or output, right-click on the stub for one of the existing IN or OUT parameters (when there are more than the original two inputs) and select the "Delete" command. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 42: Expandable Instructions

    Click the icon on the instruction tree task card to enable the headers and columns of the instruction tree. To change the version of the instruction, select the appropriate version from the drop-down list. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 43: Modifying The Appearance And Configuration Of Step 7

    You must zoom in at least 200% to select the inputs or outputs of the CPU. Notice that the tag names are displayed not only in the PLC tag table, but also are displayed on the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 44: Changing The Operating Mode Of The Cpu

    The color of the RUN/STOP indicator shows the current operating mode of the CPU. Yellow indicates STOP mode, and green indicates RUN mode. Refer to Operating Modes of the CPU in the S7-1200 System Manual (Page 81) for configuring the default operating mode on power up.
  • Page 45: Changing The Call Type For A Db

    "Block call" command from the "Options" menu. The "Call options" dialog allows you to select a single-instance or multi-instance DB. You can also select specific DBs from a drop-down list of available DBs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 46: Temporarily Disconnecting Devices From A Network

    While the network connection is deleted, the interface addresses are not changed. When you download the new network connections, the CPU must be set to STOP mode. To reconnect the device, simply create a new network connection to the port of the device. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 47: Virtual Unplugging Of Devices From The Configuration

    You could drag the configured module from the rack to the "Unplugged modules" and then insert the temporary module. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 48 STEP 7 programming software 2.3 Easy-to-use tools S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 49: Installation

    The S7-1200 equipment is designed to be easy to install. You can install an S7-1200 either on a panel or on a standard rail, and you can orient the S7-1200 either horizontally or vertically. The small size of the S7-1200 allows you to make efficient use of space.
  • Page 50 C. Orient a vertically mounted S7-1200 system as shown in the following figure. Ensure that the S7-1200 system is mounted correctly. When planning your layout for the S7-1200 system, allow enough clearance for the wiring and communications cable connections. ①...
  • Page 51: Power Budget

    PLC system. Unpredictable operation could result in death, severe personal injury and/or property damage. The DC sensor supply and any external power supply should provide power to different points. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 52 Installation 3.2 Power budget Some of the 24 VDC power input ports in the S7-1200 system are interconnected, with a common logic circuit connecting multiple M terminals. For example, the following circuits are interconnected when designated as "not isolated" in the data sheets: the 24 VDC power supply of the CPU, the power input for the relay coil of an SM, or the power supply for a non- isolated analog input.
  • Page 53: Installation And Removal Procedures

    Installation 3.3 Installation and removal procedures Installation and removal procedures 3.3.1 Mounting dimensions for the S7-1200 devices S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 54 The interior dimension of the hole for the DIN clips on the device is 4.3 mm. A 25 mm thermal zone must be provided above and below the unit for free air circulation. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 55 Failure to replace an S7-1200 device with the same model, orientation, or order could result in death, severe personal injury and/or property damage due to unexpected equipment operation. Replace an S7-1200 device with the same model, and be sure to orient and position it correctly. S7-1200 Programmable controller...
  • Page 56: Installing And Removing The Cpu

    ● After installing the devices on the DIN rail, move the lower DIN rail clips to the latched position to lock the devices on the DIN rail. ● For panel mounting, make sure the DIN rail clips are pushed to the extended position. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 57 1. Locate, drill, and tap the mounting holes (M4), using the dimensions shown in table, Mounting dimensions (mm) (Page 53). 2. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 3. Extend the mounting clips from the module. Make sure the DIN rail clips on the top and bottom of the CPU are in the extended position.
  • Page 58: Installing And Removing An Sb, Cb, Or Bb

    Installing an SB, CB, or BB 1297 Task Procedure 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Remove the top and bottom terminal block covers from the CPU. 3. Place a screwdriver into the slot on top of the CPU at the rear of the cover.
  • Page 59 Removing an SB, CB or BB 1297 Task Procedure 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Remove the top and bottom terminal block covers from the CPU. 3. Place a screwdriver into the slot on top of the module.
  • Page 60: Installing And Removing An Sm

    Installing an SM Task Procedure Install your SM after installing the CPU. 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Remove the cover for the connector from the right side of the CPU: –...
  • Page 61 Procedure You can remove any SM without removing the CPU or other SMs in place. 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Remove the I/O connectors and wiring from the SM (Page 63).
  • Page 62: Installing And Removing A Cm Or Cp

    Procedure Remove the CPU and CM as a unit from the DIN rail or panel. 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Remove the I/O connectors and all wiring and cables from the CPU and CMs.
  • Page 63: Removing And Reinstalling The S7-1200 Terminal Block Connector

    Prepare the system for terminal block connector removal by removing the power from the CPU and opening the cover above the connector. 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Inspect the top of the connector and locate the slot for the tip of the screwdriver.
  • Page 64: Installing And Removing The Expansion Cable

    Prepare the components for terminal block installation by removing power from the CPU and opening the cover for connector. 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Align the connector with the pins on the unit.
  • Page 65 Table 3- 14 Removing the female connector of the expansion cable Task Procedure 1. Ensure that the CPU and all S7-1200 equipment are disconnected from electrical power. 2. Unlock the connector: – Place a screwdriver beside the tab on the top of the signal module.
  • Page 66: Ts (Teleservice) Adapter

    TS module. Follow ESD guidelines in order to avoid damaging the TS module through electrostatic discharge. Before connecting a TS module and TS Adapter, make sure that both are in an idle state. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 67: Installing The Sim Card

    Only connect a TS module into the TS adapter. Do not force a connection of the TS adapter to a different device, such as an S7-1200 CPU. Do not change the mechanical construction of the connector, and do not remove or damage the guide elements.
  • Page 68 Ensure that the SIM card tray is correctly oriented in the card tray. Otherwise, the SIM card will not make connection with the module, and the eject button may not remove the card tray. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 69: Installing The Ts Adapter Unit On A Din Rail

    TS Adapter and TS module in the direction of the arrow until it engages. ② 2. Screw the TS Adapter and TS module to the position marked with to the designated assembly wall. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 70: Wiring Guidelines

    Proper grounding and wiring of all electrical equipment is important to help ensure the optimum operation of your system and to provide additional electrical noise protection for your application and the S7-1200. Refer to the technical specifications (Page 829) for the S7-1200 wiring diagrams.
  • Page 71 Installation 3.4 Wiring guidelines Ensure that you follow all applicable electrical codes when wiring the S7-1200 and related equipment. Install and operate all equipment according to all applicable national and local standards. Contact your local authorities to determine which codes and standards apply to your specific case.
  • Page 72 When wiring input circuits that are powered by an external power supply, include an overcurrent protection device in that circuit. External protection is not necessary for circuits that are powered by the 24 VDC sensor supply from the S7-1200 because the sensor supply is already current-limited.
  • Page 73 S7-1200 DC outputs include internal suppressor circuits that are adequate for inductive loads in most applications. Since S7-1200 relay output contacts can be used to switch either a DC or an AC load, internal protection is not provided. A good suppressor solution is to use contactors and other inductive loads for which the manufacturer provides suppressor circuits integrated in the load device, or as an optional accessory.
  • Page 74 AC loads. These values are based on calculations with ideal component parameters. I rms in the table refers to the steady-state current of the load when fully ON. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 75 Determining whether a differential input or output is on or off requires that you measure the voltage difference between these two pins. See the detailed specifications for the CPU 1217C in Appendix A (Page 879). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 76 Installation 3.4 Wiring guidelines S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 77: Plc Concepts

    FC, FB and DB block. However, the total number of blocks is limited to 1024. Each cycle includes writing the outputs, reading the inputs, executing the user program instructions, and performing background processing. The cycle is referred to as a scan cycle or scan. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 78 PLC concepts 4.1 Execution of the user program Your S7-1200 automation solution can consist of a central rack with the S7-1200 CPU and additional modules. The term "central rack" refers to either the rail or panel installation of the CPU and associated modules. The modules (SM, SB, BB, CB, CM or CP) are detected and logged in only upon powerup.
  • Page 79 For controlling whether your process updates I/O points automatically on every scan cycle, or upon the triggering of events, the S7-1200 provides five process image partitions. The first process image partition, PIP0, is designated for I/O that is to be automatically updated every scan cycle, and is the default assignment.
  • Page 80 I/O with an immediate write instruction. The CPU does not update the process image. The CPU supports distributed I/O for both PROFINET and PROFIBUS networks (Page 509). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 81: Operating Modes Of The Cpu

    Certain detected errors prevent the CPU from entering the RUN mode. The CPU supports the following configuration choices: ● No restart (stay in STOP mode) ● Warm restart - RUN ● Warm restart - mode prior to POWER OFF S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 82 (Page 792) from the online tools of the programming software. You can also include a STP instruction (Page 263) in your program to change the CPU to STOP mode. This allows you to stop the execution of your program based on the program logic. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 83 Stores any interrupt events into the Processes interrupts and communications queue to be processed after entering during any part of the scan cycle RUN mode Enables the writing of Q memory to the physical outputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 84 ● Actual operation of HSC, PWM and point-to-point communication modules only occurs in After the execution of the startup OBs finishes, the CPU goes to RUN mode and processes the control tasks in a continuous scan cycle. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 85: Processing The Scan Cycle In Run Mode

    OB. The CPU handles OBs according to their respective priority classes, with higher priority OBs executing before lower priority OBs. The lowest priority class is 1 (for the main program cycle), and the highest priority class is 24. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 86: Program Cycle Ob

    OBs execute in numerical order. Table 4- 3 Start information for a startup OB Input Data type Description LostRetentive Bool True if retentive data are lost LostRTC Bool True if date and time are lost S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 87: Time Delay Interrupt Ob

    4.1.3.5 Hardware interrupt OB Hardware interrupt OBs execute when the relevant hardware event occurs. A hardware interrupt OB interrupts normal cyclic program execution in reaction to a signal from a hardware event. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 88: Time Error Interrupt Ob

    See the section on "Monitoring the cycle time in the S7-1200 System Manual" (Page 97) for more information regarding the maximum cycle time condition, how to configure the maximum scan cycle time in the properties of the CPU, and how to reset the cycle timer.
  • Page 89: Diagnostic Error Interrupt Ob

    STOP, regardless of whether the time error interrupt OB exists. See the section on "Monitoring the cycle time in the S7-1200 System Manual" (Page 97). Time error interrupt OB includes start information that helps you determine which event and OB generated the time error.
  • Page 90 For example, if a wire break triggers a diagnostic error event on channel 2, the fault is then corrected, and the diagnostic error event is cleared, the Start information will not reference channel 2, but the submodule (16#8000). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 91: Pull Or Plug Of Modules Ob

    ● A compatible module for a configured module is in an expansion rack, but the configuration does not allow substitutes ● A module or submodule has parameterization errors If you have not programmed this OB, the CPU changes to STOP mode when any of these conditions occur. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 92: Rack Or Station Failure Ob

    16#38: outgoing event 16#39: incoming event Fault_ID Byte Fault identifier 4.1.3.10 Time of day OB Time of day OBs execute based on configured clock time conditions. The CPU supports two time of day OBs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 93: Status Ob

    Start information for status OB Input Data type Description LADDR HW_IO Hardware identifier Slot UInt Slot number Specifier Word Alarm specifier 4.1.3.12 Update OB Update OBs execute if a DPV1 or PNIO slave triggers an update interrupt. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 94: Profile Ob

    The CPU processes events in order of priority where 1 is the lowest priority and 26 is the highest priority. Prior to V4.0 of the S7-1200 CPU, each type of OB belonged to a fixed priority class (1 to 26). With V4.0, you can assign a priority class to each OB that you configure.
  • Page 95 If you configure the OB execution mode to be non-interruptible, then a time error OB cannot interrupt OBs other than program cycle OBs. Prior to V4.0 of the S7-1200 CPU, a time error OB could interrupt any executing OB. With V4.0, you must configure OB execution to be interruptible if you want a time error OB (or any other higher priority OB) to be able to interrupt executing OBs that are not program cycle OBs.
  • Page 96 V3.0. In either case, the priority field is editable and you can set the priority to any value in the range 22 to 26. Refer to the topic "Exchanging a V3.0 CPU for a V4.0 CPU (Page 995)" for more details. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 97: Monitoring And Configuring The Cycle Time

    RE_TRIGR instruction retriggers the cycle time monitoring and returns with ENO = TRUE. If not, the RE_TRIGR instruction does not retrigger the cycle time monitoring. It returns ENO = FALSE. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 98 ● Communication load: You can configure a percentage of the time to be dedicated for communication tasks. For more information about the scan cycle, see "Monitoring the cycle time". (Page 97) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 99: Cpu Memory

    The Compiliation properties display the load memory and work memory for the compiled block. To display the memory usage for the online CPU, double-click "Online and diagnostics" in STEP 7, expand "Diagnostics", and select "Memory". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 100 – If you select "Standard - compatible with S7-300/400" when you create the DB, the retentive-state setting applies to all tags of the DB; either all tags are retentive or no tag is retentive. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 101: System And Clock Memory

    0.5 Hz (slow) to 10 Hz (fast). You can use these bits as control bits, especially when combined with edge instructions, to trigger actions in the user program on a cyclic basis. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 102 Each clock bit generates a square wave pulse on the corresponding M memory bit. These bits can be used as control bits, especially when combined with edge instructions, to trigger actions in the user code on a cyclic basis. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 103: Diagnostics Buffer

    ● Each state change of the CPU (each power up, each transition to STOP, each transition to RUN) To access the diagnostics buffer (Page 793), you must be online. From the "Online & diagnostics" view, locate the diagnostics buffer under "Diagnostics > Diagnostics buffer". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 104: Time Of Day Clock

    "Properties" tab to configure the outputs for each device. When the CPU changes from RUN to STOP, the CPU retains the process image and writes the appropriate values for both the digital and analog outputs, based upon the configuration. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 105: Data Storage, Memory Areas, I/O And Addressing

    Data storage, memory areas, I/O and addressing 4.2.1 Accessing the data of the S7-1200 STEP 7 facilitates symbolic programming. You create symbolic names or "tags" for the addresses of the data, whether as PLC tags relating to memory addresses and I/O points or as local variables used within a code block.
  • Page 106 The % character is inserted automatically in front of the absolute operand by the program editor. You can toggle the view in the program editor to one of these: symbolic, symbolic and absolute, or absolute. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 107 Because the physical output points directly control field devices that are connected to these points, reading from these points is prohibited. That is, Q_:P accesses are write-only, as opposed to Q accesses which can be read or write. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 108 You can access data block memory in bits, bytes, words, or double words. Both read and write access is permitted for read/write data blocks. Only read access is permitted for read-only data blocks. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 109 The figure shows an example of a CPU 1214C with two SMs and one SB. In this example, you could change the address of the DI8 module to 2 instead of 8. The tool assists you by changing address ranges that are the wrong size or conflict with other addresses. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 110: Processing Of Analog Values

    Word (16-bit value), DWord (32-bit double-word value) ● Integer (Page 112) – USInt (unsigned 8-bit integer), SInt (signed 8-bit integer), – UInt (unsigned 16-bit integer), Int (signed 16-bit integer) – UDInt (unsigned 32-bit integer), DInt (signed 32-bit integer) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 111: Bool, Byte, Word, And Dword Data Types

    61680 Tag_name Octal 8#0 to 8#177777 8#170360 Hexadecimal W#16#0 to W#16#FFFF, W#16#F0F0, 16#F0F0 16#0 to 16#FFFF DWord Binary 2#0 to 2#111100001111111100 MD10 2#111111111111111111111111 001111 DB1.DBD8 11111111 Tag_name Unsigned integer 0 to 4294967295 15793935 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 112: Integer Data Types

    +1.175 495e-38 to +3.402823e+38 LReal -1.7976931348623158e+308 to 12345.123456789e40, DB_name.var_name -2.2250738585072014e-308, 1.2E+40 Rules: ±0, No direct addressing • +2.2250738585072014e-308 to support +1.7976931348623158e+308 Can be assigned in an OB, • FB, or FC block interface table S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 113: Time And Date Data Types

    TOD (TIME_OF_DAY) data is stored as an unsigned double integer which is interpreted as the number of milliseconds since midnight for the specified time of day (Midnight = 0 ms). The hour (24hr/day), minute, and second must be specified. The fractional second specification is optional. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 114: Character And String Data Types

    Character and String data types Data type Size Range Constant Entry Examples Char 8 bits ASCII character codes: 16#00 to 16#FF 'A', 't', '@' String n+ 2 bytes n = (0 to 254 character bytes) 'ABC' S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 115 'T' (16#54) Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 11 ASCII control characters can be used in Char and String data. The following table shows examples of control character syntax. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 116: Array Data Type

    Array index rules Constant or USInt, SInt, UInt, Int, UDInt, Value limits: -32768 to +32767 • variable DInt Valid: Mixed constants and variables • Valid: Constant expressions • Not valid: Variable expressions • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 117: Data Structure Data Type

    For example, a PLC data type could be a recipe for mixing colors. You can then assign this PLC data type to multiple data blocks. Each data block can then have the variables adjusted to create a specific color. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 118: Pointer Data Types

    Area-internal pointer P#Byte.Bit P#20.0 Area-crossing pointer P#Memory_area_Byte.Bit P#M20.0 DB-pointer P#Data_block.Data_element P#DB10.DBX20.0 You can enter a parameter of type Pointer without the prefix (P #). Your entry will be automatically converted to the pointer format. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 119: Any" Pointer Data Type

    10 words in global DB 11 Data_address Type Number starting from DBB 20.0 P#Memory_area Data_address P#M 20.0 BYTE 10 10 bytes starting from MB 20.0 Type Number P#I 1.0 BOOL 1 Input I1.0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 120: Variant" Pointer Data Type

    Table 4- 41 Properties of the Variant pointer Length Representation Format Example entry (Byte) Symbolic Operand MyTag DB_name.Struct_name.element_name MyDB.Struct1.pressure1 Absolute Operand %MW10 DB_number.Operand Type Length P#DB10.DBX10.0 INT 12 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 121: Accessing A "Slice" Of A Tagged Data Type

    Hw_SubModule, Int, OB_Any, OB_Att, OB_Cyclic, OB_Delay, OB_WHINT, OB_PCYCLE, OB_STARTUP, OB_TIMEERROR, OB_Tod, Port, Rtm, SInt, Time, Time_Of_Day, UDInt, UInt, USInt, and Word. PLC Tags of type Real can be accessed by slice, but data block tags of type Real cannot. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 122: Accessing A Tag With An At Overlay

    Example This example shows the input parameters of a standard-access FB. The byte tag B1 is overlaid with an array of Booleans: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 123 ● The size of the overlaying parameter must be less than or equal to the size of the overlaid parameter. ● The overlaying variable must be declared immediately after the variable that it overlays and identified with the keyword "AT". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 124: Using A Memory Card

    If a program card is inserted in the CPU, STEP 7 then applies the force values only to the external load memory on the program card. You also use a memory card when downloading firmware updates (Page 133). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 125: Inserting A Memory Card In The Cpu

    Note Do not insert V3.0 program transfer cards into S7-1200 V4.0 CPUs. Version 3.0 program transfer cards are not compatible with version S7-1200 V4.0 CPUs. Inserting a memory card that contains a V3.0 program causes a CPU error. If you do insert an invalid version program transfer card (Page 127), you should remove the card, and perform a STOP to RUN transition, a memory reset (MRES), or cycle power.
  • Page 126 To insert a memory card, open the top CPU door and insert the memory card in the slot. A push-push type connector allows for easy insertion and removal. The memory card is keyed for proper installation. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 127: Configuring The Startup Parameter Of The Cpu Before Copying The Project To The Memory Card

    Electrostatic discharge can damage the memory card or the receptacle on the CPU. Make contact with a grounded conductive pad and/or wear a grounded wrist strap whenever you handle the memory card. Store the memory card in a conductive container. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 128 Project tree and dragging the CPU device to the memory card. (Another method is to copy the CPU device and paste it to the memory card.) Copying the CPU device to the memory card opens the "Load preview" dialog. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 129 Note Do not insert V3.0 program transfer cards into S7-1200 V4.0 CPUs. Version 3.0 program transfer cards are not compatible with version S7-1200 V4.0 CPUs. Inserting a memory card that contains a V3.0 program causes a CPU error. If you do insert an invalid version program transfer card, then remove the card, perform a STOP to RUN transition, a memory reset (MRES), or cycle power.
  • Page 130: Program Card

    (The memory card is now a program card.) After the copy has been completed, the program in internal load memory of the CPU is then erased. The CPU then goes to the configured startup mode (RUN or STOP). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 131 6. In the "Load preview" dialog, click the "Load" button to copy the CPU device to the memory card. 7. When the dialog displays a message that the CPU device (program) has been loaded without errors, click the "Finish" button. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 132 Such unexpected operations could result in death or serious injury to personnel, and/or damage to equipment. Do not remove the program card without understanding that you are removing the program from CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 133: Firmware Update

    Alternatively, you can access the S7-1200 downloads Web page (http://support.automation.siemens.com/WW/view/en/34612486/133100) directly. Note You cannot update an S7-1200 CPU V3.0 or earlier to S7-1200 V4.0 by firmware update. NOTICE Do not use the Windows formatter utility or any other formatting utility to reformat the memory card.
  • Page 134 Unexpected operation of a process or machine could result in death or injury to personnel and/or property damage. Before inserting the memory card, always ensure that the CPU is offline and in a safe state. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 135 Device Configuration in STEP 7. If you have downloaded multiple firmware updates to the memory card for multiple modules, the CPU applies the updates in the order in which you downloaded them to the memory card. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 136: Recovery From A Lost Password

    Before inserting a transfer card, always ensure that the CPU is in STOP mode and your process is in a safe state. You must remove the transfer card before setting the CPU to RUN mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 137: Device Configuration

    Signal module (SM) for digital or analog I/O: up to 8, inserted in slots 2 through 9 (CPU 1214C, CPU 1215C and CPU 1217C allow 8, CPU 1212C allows 2, CPU 1211C does not allow any) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 138: Inserting A Cpu

    You create your device configuration by inserting a CPU into your project. Be sure you insert the correct model and firmware version from the list. Selecting the CPU from the "Add new device" dialog creates the rack and CPU. "Add new device" dialog S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 139 The CPU does not have a pre-configured IP address. You must manually assign an IP address for the CPU during the device configuration. If your CPU is connected to a router on the network, you also enter the IP address for a router. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 140: Detecting The Configuration For An Unspecified Cpu

    After you select the CPU from the online dialog and click the Load button, STEP 7 uploads the hardware configuration from the CPU, including any modules (SM, SB, or CM). You can then configure the parameters for the CPU and the modules. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 141: Adding Modules To The Configuration

    CPU for the modules to be functional. Table 5- 1 Adding a module to the device configuration Module Select the module Insert the module Result SB, BB or CM or CP S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 142: Changing A Device

    Configuring the operation of the CPU 5.5.1 Overview To configure the operational parameters for the CPU, select the CPU in the Device view (blue outline around whole CPU), and use the "Properties" tab of the inspector window. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 143 Provides a summary of the communication connection resources that are available for the (Page 511) CPU and the number of connection resources that have been configured. Overview of addresses Provides a summary of the I/O addresses that have been configured for the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 144: Configuring Digital Input Filter Times

    "1’s" than "0’s", the image register will eventually change to "1". Each input point has a single filter configuration that applies to all uses: process inputs, interrupts, pulse catch, and HSC inputs. To configure input filter times, select "Digital Inputs". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 145 This changing of filter times can result in unexpected machine or process operation, which may cause death or serious injury to personnel, and/or damage to equipment. To ensure that a new filter time goes immediately into effect, a power cycle of the CPU must be applied. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 146: Pulse Catch

    5.5.3 Pulse catch The S7-1200 CPU provides a pulse catch feature for digital input points. The pulse catch feature allows you to capture high-going pulses or low-going pulses that are of such a short duration that they would not always be seen when the CPU reads the digital inputs at the beginning of the scan cycle.
  • Page 147: Configuring The Parameters Of The Modules

    PIP1, PIP2, PIP3, PIP4) or to automatically update, or to use no process image partition. See "Execution of the user program" (Page 77) for an explanation of the process image and process image partitions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 148 Device configuration 5.6 Configuring the parameters of the modules Configuring a communication interface (CM, CP or CB) Depending on the type of communication interface, you configure the parameters for the network. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 149: Configuring The Cpu For Communication

    Select "Network view" to display the devices to be connected. Select the port on one device and drag the connection to the port on the second device. Release the mouse button to create the network connection. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 150: Configuring The Local/Partner Connection Path

    You must still insert a TSEND_C, TRCV_C or TCON instruction into the user program of the partner CPU. When you insert the instruction, select the connection DB that was created by the configuration. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 151 • Refer to "Protocols" (Page 517) in the "PROFINET" section or to "Creating an S7 connection" (Page 591) in the "S7 communication" section for more information and a list of available communication instructions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 152 ISO on TCP (RFC 1006) and S7 communication: Local and partner CPU TSAPs in ASCII and hexadecimal formats When configuring a connection with an S7-1200 CPU for ISO-on-TCP, use only ASCII characters in the TSAP extension for the passive communication partners.
  • Page 153: Parameters For The Profinet Connection

    USInt Length of parameter rem_tsap_id used, in bytes; possible values: TCP: 0 (passive) or 2 (active, default) • ISO-on-TCP: 2 to 16 • UDP: 0 • next_staddr_len USInt This parameter is not used. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 154 – rem_tsap_id[3-16] = TSAP extension, optional UDP: This parameter is not used. • 56 … 61 next_staddr Array [1..6] of This parameter is not used. Byte 62 … 63 spare Word Reserved: W#16#0000 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 155: Assigning Internet Protocol (Ip) Addresses

    Enabling the Web server allows authorized users to perform operating mode changes, writes to PLC data, and firmware updates, Siemens recommends that you observe the following security practices: • Enable access to the Web server only with the HTTPS protocol.
  • Page 156 The Network ID is the first part of the IP address (first three octets) (for example, 211.154.184.16) that determines what IP network you are on.) The subnet mask, when combined with the device IP address in a mathematical AND operation, defines the boundaries of an IP subnet. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 157: Checking The Ip Address Of Your Programming Device

    1. In the "Project tree", expand "Online access". 2. Right-click the required network, and select "Properties". 3. In the network dialog, expand "Configurations", and select "Industrial Ethernet". The MAC and IP addresses of the programming device are displayed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 158: Assigning An Ip Address To A Cpu Online

    IP address has been assigned. 2. Under the required accessible device, double-click "Online & diagnostics". 3. In the "Online & diagnostics" dialog, make the following menu selections: • "Functions" • "Assign IP address" S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 159: Configuring An Ip Address For A Cpu In Your Project

    Configuring the PROFINET interface To configure parameters for the PROFINET interface, select the green PROFINET box on the CPU. The "Properties" tab in the inspector window displays the PROFINET port. ① PROFINET port S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 160 Properties window, select the "Ethernet addresses" configuration entry. STEP 7 displays the Ethernet address configuration dialog, which associates the software project with the IP address of the CPU that will receive that project. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 161 Ensure that your CPU IP address(es) are set before using the CPU in an actual automation environment. This can be done by using your STEP 7 programming package, the S7-1200 Tool, or an attached HMI device in conjunction with the T_CONFIG instruction.
  • Page 162: Testing The Profinet Network

    Assigning an IP address to a device online The S7-1200 CPU does not have a pre-configured IP address. You must manually assign an IP address for the CPU: ● To assign an IP address to a device online, refer to "Device configuration: Assigning an IP address to a CPU online"...
  • Page 163: Locating The Ethernet (Mac) Address On The Cpu

    Using the "Extended download to device" dialog to test for connected network devices The S7-1200 CPU "Download to device" function and its "Extended download to device" dialog can show all accessible network devices and whether or not unique IP addresses have been assigned to all devices.
  • Page 164 This dialog displays all accessible and available devices with their assigned MAC or IP addresses. MAC addresses are all-important in identifying devices that are missing the required unique IP address. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 165: Configuring Network Time Protocol Synchronization

    CPU system time. The NTP client feature of the S7-1200 CPU is disabled by default, and, when enabled, only allows configured IP addresses to act as an NTP server. The CPU disables this feature by default, and you must configure this feature to allow remotely-controlled CPU system time corrections.
  • Page 166: Profinet Device Start-Up Time, Naming, And Address Assignment

    PROFINET IO can extend the start-up time for your system (configurable time-out). More devices and slow devices impact the amount of time it takes to switch to RUN. In V4.0, you can have a maximum of 16 PROFINET IO devices on your S7-1200 PROFINET network.
  • Page 167 ● If there is a problem with this process, a station error occurs and no start-up takes place. This situation causes the configurable time-out value to be exceeded. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 168 Device configuration 5.7 Configuring the CPU for communication S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 169: Programming Concepts

    Identify any other safety-related requirements for safe operation of the process. • Plan system security Determine what level of protection (Page 190) you require for access to your process. You can password-protect CPUs and program blocks from unauthorized access. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 170: Structuring Your User Program

    FB, or FC). The FC does not have an associated instance DB. The calling block passes parameters to the FC. The output values from the FC must be written to a memory address or to a global DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 171 ● Creating modular components that relate to specific technological functions can help to simplify and reduce the time involved with commissioning the completed application. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 172: Using Blocks To Structure Your Program

    OBs are event driven. An event, such as a diagnostic interrupt or a time interval, causes the CPU to execute an OB. Some OBs have predefined start events and behavior. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 173 The CPU determines the order for handling interrupt events by priority. You can assign multiple interrupt events to the same priority class. For more information, refer to the topics on organization blocks (Page 85) and execution of the user program (Page 77). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 174: Function (Fc)

    The temporary data is not saved. To store data permanently, assign the output value to a global memory location, such as M memory or to a global DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 175: Function Block (Fb)

    DB. If you do not assign a new start value for a parameter in the FB interface, the default value from instance DB is copied to start value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 176: Data Block (Db)

    Although the instance DB reflects the data for a specific FB, any code block can access the data in an instance DB. You can also modify and download data blocks in RUN mode (Page 808). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 177: Creating Reusable Code Blocks

    You do not select a language for a DB because it only stores data. Selecting the "Add new and open" check box (default) opens the code block in the Project view. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 178: Understanding Data Consistency

    CPU will all be updated at the same time by the HMI. For example, the values displayed on a given HMI screen could be from different scan cycles of the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 179: Programming Language

    OB is executed) of your user program. Programming language STEP 7 provides the following standard programming languages for S7-1200: ● LAD (ladder logic) is a graphical programming language. The representation is based on circuit diagrams (Page 180).
  • Page 180: Ladder Logic (Lad)

    Consider the following rules when creating a LAD network: ● You cannot create a branch that could result in a power flow in the reverse direction. ● You cannot create a branch that would cause a short circuit. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 181: Function Block Diagram (Fbd)

    SCL instructions from the instruction tree and drop them into your program. You can also use any text editor to create an SCL program and then import that file into STEP 7. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 182 In this example, the tags for "Start" and "On" (from the project tag table) correspond to "StartStopSwitch" and "RunYesNo" in the declaration table of the SCL program. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 183 ● Mathematical functions: +, -, *, and / ● Addressing of global variables (tags): "" (Tag name or data block name enclosed in double quotes) ● Addressing of local variables: # (Variable name preceded by "#" symbol) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 184 A control statement can also be provided with a label. A label is set off by a colon at the beginning of the statement: Label: ; The STEP 7 online help provides a complete SCL programming language reference. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 185 To use the PEEK and POKE instructions with data blocks, you must use standard (not optimized) data blocks. Also note that the PEEK and POKE instructions merely transfer data. They have no knowledge of data types at the addresses. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 186 Writes the value (Byte, Word, or DWord) to dbNumber:=_in_, the referenced byteOffset of the referenced byteOffset:=_in_, data block, I/O or memory area value:=_in_); Example referencing data block: POKE(area:=16#84, dbNumber:=2, byteOffset:=3, value:="Tag_1"); Example referencing QB3 output: POKE(area:=16#82, dbNumber:=0, byteOffset:=3, value:="Tag_1"); S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 187 (Parameter list) Standard call := (Parameter list) Call in an expression "MyFC"(MyInput:=10, MyInOut:="Tag1"); You can also drag blocks from the navigation tree to the SCL program editor, and complete the parameter assignment. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 188: En And Eno For Lad, Fbd And Scl

    The use of EN is only available for FBs. The use of ENO with the SCL code block is optional. You must configure the SCL compiler to set ENO when the code block finishes. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 189 -1 typically sets ENO = 0 (or FALSE). To evaluate Ret_Val, change the representation to hexadecimal. ● Status: A value from 16#0000 16#7FFF typically sets ENO = 1 (or TRUE). A value from 16#8000 to 16#FFFF typically sets ENO = 0 (or FALSE). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 190: Protection

    Allows full access without password protection. protection) Read access Allows HMI access and all forms of PLC-to-PLC communications without password protection. Password is required for modifying (writing to) the CPU and for changing the CPU mode (RUN/STOP). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 191 Passwords are case-sensitive. To configure the protection level and passwords, follow these steps: 1. In the "Device configuration", select the CPU. 2. In the inspector window, select the "Properties" tab. 3. Select the "Protection" property to select the protection level and to enter passwords. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 192 Authorized users can perform operating mode changes, writes to PLC data, and firmware updates. Siemens recommends that you observe the following security practices: • Password protect CPU access levels and Web server user IDs (Page 604) with strong passwords.
  • Page 193: Know-How Protection

    ● Global tags in the cross references (without information on the point of use), but local tags are hidden When you configure a block for "know-how" protection, the code within the block cannot be accessed except after entering the password. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 194 1. In the Properties for the code block, click the "Protection" button to display the "Know-how protection" dialog. 2. Click the "Define" button to enter the password. After entering and confirming the password, click "OK". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 195: Copy Protection

    CPU. 3. Select the type of copy protection and enter the serial number for the memory card or CPU. Note The serial number is case-sensitive. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 196: Downloading The Elements Of Your Program

    You can also download a panel project for the Basic HMI panels (Page 32) from the TIA Portal to a memory card in the S7-1200 CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 197: Uploading From The Cpu

    5. In the "Upload preview" dialog, select the box for "Continue", and then click the "Upload from device" button. When the upload is complete, all of the program blocks, technology blocks, and tags will be displayed in the offline area. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 198: Using The Compare Function

    Tag table DB editor Monitoring with a watch table Monitoring with the LAD editor Refer to the "Online and diagnostics" chapter for more information about monitoring and modifying data in the CPU (Page 795). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 199: Watch Tables And Force Tables

    To display the cross-references, select the "Show cross-references" command. (In the Project view, find the cross references in the "Tools" menu.) Note You do not have to close the editor to see the cross-reference information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 200 Type of access, whether access to the operand is read access (R) and/or write access (W) Address Address of the operand Type Information on the type and language used to create the object Path Path of object in project tree S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 201: Call Structure To Examine The Calling Hierarchy

    ● If compilation fails to clear up inconsistencies, use the link in the "Details" column to go to the source of the problem in the program editor. You can then manually eliminate any inconsistencies. ● Any blocks marked in red must be recompiled. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 202 Programming concepts 6.9 Debugging and testing the program S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 203: Basic Instructions

    ● The Normally Closed contact is closed (ON) when the assigned bit value is equal to 0. ● Contacts connected in series create AND logic networks. ● Contacts connected in parallel create OR logic networks. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 204 For SCL: You must assign the result of the operation to a variable to be used for another statement. Table 7- 4 Data types for the parameters Parameter Data type Description IN1, IN2 Bool Input bit S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 205 You can specify an immediate write of a physical output expression>; using ":P" following the Q offset (example: "%Q3.4:P"). For an immediate write, the bit data values are written to the process image output and directly to physical output. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 206: Set And Reset Instructions

    Data types for the parameters Parameter Data type Description IN (or connect to contact/gate logic) Bool Bit tag of location to be monitored Bool Bit tag of location to be set or reset S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 207 (R1) signals are both true, the value at address INOUT will be 0. For LAD and FBD: These instructions must be the right-most instruction in a branch. For SCL: You must write code to replicate this function within your application. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 208 Follows state of "INOUT" bit The "INOUT" tag assigns the bit address that is set or reset. The optional output Q follows the signal state of the "INOUT" address. Instruction "INOUT" bit Previous state Previous state S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 209: Positive And Negative Edge Instructions

    The input logic state always passes through the box as the output logic state. The N= box can be located anywhere in the branch. For SCL: You must write code to replicate this function within your application. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 210 (multiple instance) in the block interface. If you create a separate data block, you will find it in the project tree in the "Program resources" folder under "Program blocks > System blocks". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 211 You should also avoid temporary memory and memory that can be affected by other system functions, such as an I/O update. Use only M, global DB, or Static memory (in an instance DB) for M_BIT memory assignments. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 212: Timer Operations

    (No SCL equivalent) The RT (Reset timer) coil resets the specified IEC_Timer. STEP 7 automatically creates the DB when you insert the instruction. In the SCL examples, "IEC_Timer_0_DB" is the name of the instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 213 The negative range of the TIME data type shown above cannot be used with the timer instructions. Negative PT (preset time) values are set to zero when the timer instruction is executed. ET (elapsed time) is always a positive value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 214 This reduces the processing time and data storage necessary for handling the timers. There is no interaction between the timer data structures in the shared multi-instance S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 215 TONR: Time accumulator The TONR timer sets output Q to ON after a preset time delay. Elapsed time is accumulated over multiple timing periods until the R input is used to reset the elapsed time. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 216 ● A timer instruction (TP, TON, TOF, or TONR) is executed ● The "ELAPSED" member of the timer structure in DB is referenced directly by an instruction ● The "Q" member of the timer structure in DB is referenced directly by an instruction S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 217 DB which cannot be made retentive. To make your timer data retentive, you must either use a global DB or a Multi- instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 218 5. When the call options dialog appears, click the cancel button. 6. On the top of the new timer instruction, type the name (do not use the helper to browse) of the global DB and timer structure that you created above (example: "Data_block_3.Static_1"). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 219 8. Open the instance data block created when you placed the FB in the editor. 9. Under Static, locate the timer structure of interest. In the Retain column for this timer structure, check the box to make this structure retentive. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 220: Counter Operations

    If the count value is a signed integer, you can count down to the negative integer limit and count up to the positive integer limit. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 221 PV (preset count value), then the counter output parameter Q = 1. If the value of the reset parameter R changes from 0 to 1, then the • current count value is reset to 0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 222 PV is loaded to the counter as the new CV. If the value of the reset • parameter R is changes from 0 to 1, the current count value is reset to 0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 223 DB and counter structure that you created above (example: "Data_block_3.Static_1"). This causes the corresponding preset and count value type to be filled in (example: UInt for an IEC_UCounter structure). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 224 3. When the Call options dialog appears, click on the multi instance icon. The multi instance option is only available if the instruction is being placed into an FB. 4. In the Call options dialog, rename the counter if desired. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 225 Type shown in counter instruction (for preset Corresponding structure Type shown in FB and count values) interface IEC_Counter SINT IEC_SCounter DINT IEC_DCounter UINT IEC_UCounter USINT IEC_USCounter UDINT IEC_UDCounter S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 226: Comparator Operations

    IN1 is not equal to IN2 >= IN1 is greater than or equal to IN2 <= IN1 is less than or equal to IN2 > IN1 is greater than IN2 < IN1 is less than IN2 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 227: In_Range (Value Within Range) And Out_Range (Value Outside Range) Instructions

    The input parameters MIN, VAL, and MAX must be the same data type. ● The IN_RANGE comparison is true if: MIN <= VAL <= MAX ● The OUT_RANGE comparison is true if: VAL < MIN or VAL > MAX S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 228: Ok (Check Validity) And Not_Ok (Check Invalidity) Instructions

    A Real or LReal value is invalid if it is +/- INF (infinity), NaN (Not a Number), or if it is a denormalized value. A denormalized value is a number very close to zero. The CPU substitutes a zero for a denormalized value in calculations. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 229: Math Functions

    (such as IN1 and IN2) and operations. When you click "OK" to save the function, the dialog automatically creates the inputs for the CALCULATE instruction. An example and a list of possible math operations you can include is shown at the bottom of the editor. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 230: Add, Subtract, Multiply And Divide Instructions

    When enabled (EN = 1), the math instruction performs the specified operation on the input values (IN1 and IN2) and stores the result in the memory address specified by the output parameter (OUT). After the successful completion of the operation, the instruction sets ENO = 1. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 231: Mod (Return Remainder Of Division) Instruction

    SInt, Int, DInt, USInt, UInt, UDInt Modulo output The IN1, IN2, and OUT parameters must be the same data type. Table 7- 43 ENO values Description No error Value IN2 = 0, OUT is assigned the value zero S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 232: Neg (Create Twos Complement) Instruction

    := in_out - 1; Decrements a signed or unsigned integer number value: IN_OUT value - 1 = IN_OUT value For LAD and FBD: Click the "???" and select a data type from the drop-down menu. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 233: Abs (Form Absolute Value) Instruction

    Description No error The math operation result value is outside the valid number range of the selected data type. Example for SInt: ABS (-128) results in +128 which exceeds the data type maximum. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 234: Min (Get Minimum) And Max (Get Maximum) Instructions

    "Delete" command. Table 7- 55 ENO status Description No error For Real data type only: At least one input is not a real number (NaN). • The resulting OUT is +/- INF (infinity). • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 235: Limit (Set Limit Value) Instruction

    If MIN is greater than MAX, the value IN is assigned to OUT. SCL examples: ● MyVal := LIMIT(MN:=10,IN:=53, MX:=40); //Result: MyVal = 40 ● MyVal := LIMIT(MN:=10,IN:=37, MX:=40); //Result: MyVal = 37 ● MyVal := LIMIT(MN:=10,IN:=8, MX:=40); //Result: MyVal = 10 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 236: Exponent, Logarithm, And Trigonometry Instructions

    For LAD and FBD: Click the "???" (by the instruction name) and select a data type from the drop-down menu. For SCL: You can also use the basic SCL math operators to create the mathematical expressions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 237 IN1 is +INF and IN2 is not -INF +INF IN1 is negative or -INF +NaN if IN2 is Real/LReal, -INF otherwise IN1 or IN2 is +/- NaN +NaN IN1 is 0.0 and IN2 is Real/LReal (only) +NaN S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 238: Move Operations

    SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Byte, Word, Source address DWord, Char, Array, Struct, DTL, Time SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Byte, Word, Destination address DWord, Char, Array, Struct, DTL, Time S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 239 Use the UMOVE_BLK instruction when the move operation must be completed and the destination data consistent, before the execution of an interrupt OB subprogram. For more information, see the section on data consistency (Page 178). ENO is always true following execution of the MOVE instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 240: Fieldread (Read Field) And Fieldwrite (Write Field) Instructions

    MEMBER parameter. The value is transferred to the array element whose array index is specified by the INDEX parameter. For LAD and FBD: Click the "???" and select a data type from the drop-down menu. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 241 Booleans in "Data_block_1" referenced by the PLC tag "Index". The logic with the variable array index is equivalent to the former method using the FieldRead instruction: FieldWrite and FieldRead instructions can be replaced with variable array indexing logic. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 242: Fill_Blk (Fill Block) And Ufill_Blk (Fill Block Uninterruptible) Instructions

    • To fill an array with an elementary data type, use FILL_BLK or UFILL_BLK • To fill a single character in a string, use MOVE • The FILL_BLK and UFILL_BLK instructions cannot be used to fill arrays in the I, Q, or M memory areas. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 243: Swap (Swap Bytes) Instruction

    ENO is always TRUE following execution of the SWAP instruction. For LAD and FBD: Click the "???" and select a data type from the drop-down menu. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 244: Conversion Operations

    For LAD and FBD: Click the "???" and select the data types from the drop-down menu. For SCL: Construct the conversion instruction by identifying the data type for the input parameter (in) and output parameter (out). For example, DWORD_TO_REAL converts a DWord value to a Real value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 245: Conversion Instructions For Scl

    WORD_TO_BYTE The least significant byte of the source value is transferred to the target data type WORD_TO_DWORD The value is transferred to the least significant word of the target data type. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 246 The value is transferred to the target data type USINT_TO_WORD, USINT_TO_DWORD, The value is transferred to the least significant byte of the USINT_TO_INT, USINT_TO_UINT, target data type. USINT_TO_DINT, USINT_TO_UDINT USINT_TO_SINT, USINT_TO_REAL, The value is converted. USINT_TO_LREAL, USINT_TO_CHAR, USINT_TO_STRING S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 247 The least significant bit is transferred into the destination data type. UDINT_TO_BYTE, UDINT_TO_WORD, UDINT_TO_SINT, The value is converted. UDINT_TO_USINT, UDINT_TO_INT, UDINT_TO_UINT, UDINT_TO_DINT, UDINT_TO_REAL, UDINT_TO_LREAL, UDINT_TO_CHAR, UDINT_TO_STRING UDINT_TO_DWORD, UDINT_TO_TOD The value is transferred to the target data type. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 248 The value is transferred to the first character of the string. STRING_TO_SINT, STRING_TO_USINT, String The value is converted. STRING_TO_INT, STRING_TO_UINT, STRING_TO_DINT, STRING_TO_UDINT, STRING_TO_REAL, STRING_TO_LREAL STRING_TO_CHAR The first character of the string is copied to the Char. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 249: Round (Round Numerical Value) And Trunc (Truncate Numerical Value) Instructions

    SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal Rounded or truncated output Table 7- 85 ENO status Description Result OUT No error Valid result IN is +/- INF or +/- NaN +/- INF or +/- NaN S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 250: Ceil And Floor (Generate Next Higher And Lower Integer From Floating-Point Number) Instructions

    SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal Converted output Table 7- 88 ENO status Description Result OUT No error Valid result IN is +/- INF or +/- NaN +/- INF or +/- NaN S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 251: Scale_X (Scale) And Norm_X (Normalize) Instructions

    Scaled or normalized output value NORM_X: Real, LReal For SCALE_X: Parameters MIN, MAX, and OUT must be the same data type. For NORM_X: Parameters MIN, VALUE, and MAX must be the same data type. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 252 VALUE to fill up the OUT size. NORM_X: VALUE in VALUE data type extended to fill a double word size. Parameter VALUE = +/- INF or +/- NaN VALUE is written to OUT S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 253 MIN value for the SCALE_X instruction would be -27648 instead of 0. Additional information on analog input representations (Page 916) and analog output representations (Page 917) in both voltage and current can be found in the Technical Specifications. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 254: Program Control Operations

    ● You can jump within a code block, but you cannot jump from one code block to another code block. ● You can jump forward or backward. ● You can jump to the same label from more than one place in the same code block. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 255: Jmp_List (Define Jump List) Instruction

    DEST1 output, and so on. If the value of the K input exceeds the (number of labels - 1), then no jump occurs and processing continues with the next program network. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 256: Switch (Jump Distributor) Instruction

    For LAD and FBD: Click below the box name and select a data type from the drop-down menu. For SCL: Use an IF-THEN set of comparisons. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 257 Click the create icon inside the box (to the left of the last DEST parameter) to add new comparison-destination parameters. • Right-click on an input stub and select the "Insert input" command. • Right-click on an input stub and select the "Delete" command. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 258: Ret (Return) Instruction

    Table 7- 100 Data types for the parameters Parameter Data type Description Return_Value Bool The "Return_value" parameter of the RET instruction is assigned to the ENO output of the block call box in the calling block. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 259: Endis_Pw (Enable/Disable Cpu Passwords) Instruction

    Table 7- 101 ENDIS_PW instruction LAD / FBD Description ENDIS_PW( The ENDIS_PW instruction can allow and req:=_bool_in_, disallow client connections to a S7-1200 f_pwd:=_bool_in_, CPU, even when the client can provide the full_pwd:=_bool_in_, correct password. r_pwd:=_bool_in_, This instruction does not disallow Web hmi_pwd:=_bool_in_, server passwords.
  • Page 260 Action Operating mode ENDIS_PW password control After memory reset from STOP Active: Disallowed passwords STEP 7 remain disallowed. After powering on, or changing STOP Off: No passwords are a memory card disallowed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 261 The password for fail-safe is not configured. 80D1 The password for read/write access is not configured. 80D2 The password for read access is not configured. 80D3 The password for HMI access is not configured. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 262: Re_Trigr (Restart Cycle Monitoring Time) Instruction

    RE_TRIGR function. Note Prior to S7-1200 CPU firmware version 2.2, RE_TRIGR was restricted to execution from a program cycle OB and could be used to extend the PLC scan time indefinitely. ENO = FALSE and the watchdog timer is not reset when RE_TRIGR was executed from a start up OB, an interrupt OB, or an error OB.
  • Page 263: Stp (Exit Program) Instruction

    Table 7- 108 Data types for the parameters Parameter Data type Description ERROR ErrorStruct Error data structure: You can rename the structure, but not the members within the structure. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 264 Information about the address of an operand AREA Byte (C) Memory area: L: 16#40 – 4E, 86, 87, 8E, 8F, C0 – CE • I: 16#81 • Q: 16#82 • M: 16#83 • DB: 16#84, 85, 8A, 8B • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 265 9535 Instruction does not exist 2575 9589 Program nesting depth error 2576 9590 Local data allocation error 2942 10562 Physical input point does not exist 2943 10563 Physical output point does not exist S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 266 GET_ERROR and GET_ERROR_ID can be used to send error information from the currently executing block (called block) to a calling block. Place the instruction in the last network of the called block program to report the final execution status of the called block. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 267: Scl Program Control Statements

    Causes the program to jump immediately to a specified label (Page 274) RETURN statement Causes the program to exit the block currently being executed and to (Page 274) return to the calling block S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 268: If-Then Statement

    Using one or more ELSIF branches has the advantage that the logical expressions following a valid expression are no longer evaluated in contrast to a sequence of IF statements. The runtime of a program can therefore be reduced. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 269: Case Statement

    ● If no match is found, the program section following ELSE is executed or no statement is executed if the ELSE branch does not exist. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 270: For Statement

    "control variable". If the "increment" value is not specified, then the value of the run tags will be increased by 1 after each loop. You cannot change "increment" during the execution of the FOR statement. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 271: While-Do Statement

    The WHILE statement evaluates the state of "condition" before executing any of the statements. To execute the statements at least one time regardless of the state of "condition", use the REPEAT statement (Page 272). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 272: Repeat-Until Statement

    END_REPEAT statement Use the CONTINUE statement (Page 273) to skip the subsequent statements of a REPEAT loop and to continue the loop with the examination of whether the condition is met for termination. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 273: Continue Statement

    ● This statement causes the repetition statement immediately surrounding the exit statement to be exited immediately. ● Execution of the program is continued after the end of the loop (for example after END_FOR). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 274: Goto Statement

    The Return instruction exits the code block being executed without conditions. Program execution returns to the calling block or to the operating system (when exiting an OB). Example of a RETURN instruction: IF "Error" <> 0 THEN RETURN; END_IF; S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 275: Word Logic Operations

    The data type selection sets parameters IN1, IN2, and OUT to the same data type. The corresponding bit values of IN1 and IN2 are combined to produce a binary logic result at parameter OUT. ENO is always TRUE following the execution of these instructions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 276: Inv (Create Ones Complement) Instruction

    DECO_WORD to decode a byte or word value, and assign to a byte or word tag or address. For LAD and FBD: Click the "???" and select a data type from the drop-down menu. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 277 DECO OUT value ( Decode single bit position) Byte OUT Min. IN 00000001 8 bits Max. IN 10000000 Word OUT Min. IN 0000000000000001 16 bits Max. IN 1000000000000000 DWord OUT Min. IN 00000000000000000000000000000001 32 bits Max. IN 10000000000000000000000000000000 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 278: Sel (Select), Mux (Multiplex), And Demux (Demultiplex) Instructions

    IN parameters and select the "Insert input" command. To remove an input, right-click on an input stub for one of the existing IN parameters (when there are more than the original two inputs) and select the "Delete" command. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 279 OUT parameters and select the "Insert output" command. To remove an output, right-click on an output stub for one of the existing OUT parameters (when there are more than the original two outputs) and select the "Delete" command. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 280 ELSE provided, ELSE value assigned • to OUT DEMUX: K is greater than the number of outputs -1 No ELSE provided: outputs are • unchanged, ELSE provided, IN value copied to • ELSE S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 281: Shift And Rotate

    OUT value before first shift: 1110 0010 1010 1101 After first shift left: 1100 0101 0101 1010 After second shift left: 1000 1010 1011 0100 After third shift left: 0001 0101 0110 1000 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 282: Ror (Rotate Right) And Rol (Rotate Left) Instructions

    Rotate bits out the right -side into the left -side (N = 1) 0100 0000 0000 0001 OUT value before first rotate: 0100 0000 0000 0001 After first rotate right: 1010 0000 0000 0000 After second rotate right: 0101 0000 0000 0000 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 283: Extended Instructions

    DATE (number of days since Jan. 1 1990) DInt, Int, SInt, UDInt, UInt, USInt, DTL SCL only: Byte, Word, Dword TOD (milliseconds since midnight- 24:00:00.000) DInt, Int, SInt, UDInt, UInt, USInt, TIME, DTL SCL only: Byte, Word, Dword S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 284 DTL or Time sum or difference Select the IN1 data type from the drop-down list available below the instruction name. The IN1 data type selection also sets the data type of parameter OUT. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 285 Data types for the T_COMBINE parameters Parameter and type Data type Description Date Date value to be combined must be between DATE#1990- 01-01 and DATE#2089-12-31 Time_of_Day Time_of_Day values to be combined DTL value S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 286: Clock Functions

    CPU system time. The NTP client feature of the S7-1200 CPU is disabled by default, and, when enabled, only allows configured IP addresses to act as an NTP server. The CPU disables this feature by default, and you must configure this feature to allow remotely-controlled CPU system time corrections.
  • Page 287 WR_LOC_T: Daylight Saving Time only evaluated during the "double hour" when the clocks change to daylight saving time. TRUE = daylight saving time (first hour) • FALSE = standard time (second hour) • RET_VAL Execution condition code S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 288 Illegal nanosecond value (bytes 8 to 11 in DTL format) 8089 Time value does not exist (hour already passed upon changeover to daylight saving time) 80B0 The real-time clock has failed 80B1 The "TimeTransformationRule" structure has not been defined. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 289: Timetransformationrule Data Structure

    Weekday of standard time changeover: 1 = Sunday StandardStartHour USINT Hour of standard time changeover StandardStartMinute USINT Minute of standard time changeover TimeZoneName STRING[80] Name of time zone: "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna" S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 290: Set_Timezone (Set Timezone) Instruction

    Start of job processing. Parameter BUSY = 1, DONE = 0 7002 Intermediate call (REQ irrelevant): Instruction already active; BUSY has the value "1". 808x Error at x-th component: For example 8084 indicates that DaylightStartWeekif is not a value from 1to 5. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 291: Rtm (Runtime Meters) Instruction

    Upon CPU power-up, the stored runtime meter values are reloaded to the timers and the previous runtime hour totals are not lost. The runtime meters must be restarted to accumulate additional runtime. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 292: String And Character

    String format is 2 bytes greater than the maximum length. Initialize your String data String input and output data must be initialized as valid strings in memory, before execution of any string instructions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 293: S_Move (Move Character String) Instruction

    ● S_CONV converts (number string to a number value) or (number value to a number string) ● STRG_VAL converts a number string to a number value with format options ● VAL_STRG converts a number value to a number string with format options S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 294 S_CONV (value to string conversion) Table 8- 20 Data types (value to string) Parameter and type Data type Description String, Char, SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal Input number value String Output character string S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 295 "-2147483648" 13 Real "x-3.402823E+38" "x-1.175495E-38" "x+1.175495E-38" "x+3.402823E+38" LReal "-1.7976931348623E+308" "-2.2250738585072E-308" "+2.2250738585072E-308" "+1.7976931348623E+308" The " " characters represent space characters that fill empty positions in the right-justified field that is allocated for the converted value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 296 Bit 8 Bit 7 Bit 0 f = Notation format 1= Exponential notation 0 = Fixed point notation r = Decimal point format 1 = "," (comma character) 0 = "." (period character) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 297 The precision or size of the fractional portion. This does not include the decimal point. FORMAT Word Output format options UInt, Byte, USInt IN: Index to the first OUT string character to be replaced (first character = 1) String The converted string S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 298 Decimal point representation W#16#0000 "-" only Fixed point "." W#16#0001 "," W#16#0002 Exponential "." W#16#0003 "," W#16#0004 "+" and "-" Fixed Point "." W#16#0005 "," W#16#0006 Exponential "." W#16#0007 "," W#16#0008 to W#16#FFFF Illegal values S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 299 The converted number value is too large for the specified OUT data type. The OUT parameter maximum string size must be large enough to accept the number of characters specified by parameter SIZE, starting at the character position parameter P. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 300 Real -INF "xxxxxxxxxxxINF" FALSE Real +INF "xxxxxxxxxxxINF" FALSE Real "xxxxxxxxxxxNaN" FALSE The " " characters represent space characters that fill empty positions in the right-justified field that is allocated for the converted value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 301 The following examples of VAL_STRG conversions are based on an OUT string initialized as follows: " " Current Temp = xxxxxxxxxx C where the " " character represents space characters allocated for the converted value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 302: Strg_To_Chars And Chars_To_Strg

    Strings of all supported max lengths (1..254) may be used. Chars:=_variant_inout_); An end delimiter is not written; this is your responsibility. To set an end delimiter just after the last written array character, use the next array element number [pChars+Cnt]. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 303 Dint Element number for the first character in the array to copy. Array element [0] is the default value. UInt Count of characters to copy: 0 means all Strg String Target string S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 304: Ath And Hta (Convert To/From Ascii String And Hexadecimal Number) Instructions

    If there are an odd number of ASCII characters, then zeros are put in the right- most nibble of the last converted hexadecimal digit. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 305 Description (W#16#..) 0000 No error TRUE 0007 Invalid ATH input character: A character was found that was not an ASCII character 0- FALSE 9, lowercase a to f, or uppercase A to F S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 306: String Operation Instructions

    LEN instruction to get the current length of a string. Table 8- 48 Data types for the parameters Parameter and type Data type Description String Input string DInt Maximum number of characters allowed for IN string S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 307: Len (Determine The Length Of A Character String) Instruction

    String IN1 is the left part and String IN2 is the right part of the combined string. Table 8- 53 Data types for the parameters Parameter and type Data type Description String Input string 1 String Input string 2 String Combined string (string 1 + string 2) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 308: Left, Right, And Mid (Read Substrings In A Character String) Instructions

    If L is greater than the current length of the IN string, then the entire • IN string is returned in parameter OUT. If an empty string is the input, then an empty string is returned in • OUT. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 309 IN2 exceeds maximum length of IN2 (invalid string) Maximum length of IN1, IN2 or OUT does not fit within allocated memory range Maximum length of IN1, IN2 or OUT is 0 or 255 (illegal length) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 310: Delete (Delete Characters In A Character String) Instruction

    Current length of IN exceeds maximum length of IN, or current length of OUT exceeds maximum length of OUT Maximum length of IN or OUT does not fit within allocated memory Maximum length of IN or OUT is 0 or 255 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 311: Insert (Insert Characters In A Character String) Instruction

    OUT exceeds maximum length of OUT (invalid string) Maximum length of IN1, IN2 or OUT does not fit within allocated memory range Maximum length of IN1 or IN2 is 255, or maximum length of OUT is 0 or 255 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 312: Replace (Replace Characters In A Character String) Instruction

    OUT exceeds maximum length of OUT Maximum length of IN1, IN2 or OUT does not fit within allocated memory range Maximum length of IN1 or IN2 is 255, or maximum length of OUT is 0 or 255 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 313: Find (Find Characters In A Character String) Instruction

    Current length of IN1 exceeds maximum length of IN1, or current length of IN2 exceeds maximum length of IN2 (invalid string) Maximum length of IN1 or IN2 does not fit within allocated memory range Maximum length of IN1 or IN2 is 255 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 314: Distributed I/O (Profinet, Profibus, Or As-I)

    The DPNRM_DG instruction (Page 328) can only be used with PROFIBUS. You can read the current diagnostic data of a DP slave in the format specified by EN 50 170 Volume 2, PROFIBUS. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 315: Rdrec And Wrrec (Read/Write Data Record) Instructions

    LEN record:=_variant_inout_); bytes. STEP 7 automatically creates the DB when you insert the instruction. In the SCL examples, "RDREC_DB" and "WRREC_DB" are the names of the instance DBs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 316 The ERROR bit is TRUE for one scan, after the last request was terminated with an error. The error code value at the STATUS parameter is valid only during the single scan where ERROR = TRUE. STATUS DWord Block status or error information S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 317 If you use "RDREC" or "WRREC" to read or write a data record for PROFINET IO, then negative values in the INDEX, MLEN, and LEN parameters will be interpreted as an unsigned 16-bit integer. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 318: Ralrm (Receive Interrupt) Instruction

    ID=>_word_out_, Call RALRM in an interrupt OB to return information regarding len=>_uint_out_, the event(s) that caused the interrupt. In the S7-1200. The tinfo:=_variant_inout_, following Diagnostic OB interrupts are supported: Status, Update, Profile, Diagnostic error interrupt, Pull or plug of ainfo:=_variant_inout_);...
  • Page 319 DB per OB start event. Note The interface of the "RALRM" instruction is identical to the "RALRM" FB defined in "PROFIBUS Guideline PROFIBUS Communication and Proxy Function Blocks according to IEC 61131-3". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 320 MLEN can limit the amount of AINFO data that is returned. Refer to the AINFO parameters and TINFO parameters of the online information system of STEP 7 for information on how to interpret the TINFO and AINFO data. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 321 Bytes 28 - 31 (manufacturer and instance) are not used with PROFIBUS. Note Refer to the online information system of STEP 7 for more detailed information on TINFO data. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 322: Status Parameter For Rdrec, Wrrec, And Ralrm

    Intermediate call; data record transfer already active Reserved, pass Invalid logical start address Reserved, pass Illegal type for Variant pointer Reserved, pass The DP component addressed via ID or F_ID is not configured. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 323 Actual module type does not match specified module type. Invalid area DP slave or module reports access to an invalid area. Status conflict DP slave or module not ready Access denied DP slave or module denies access. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 324 DP Slave specific. Refer to the description of the DP Slave. 00 to FF Error in the initial call parameter (with "RALRM (Page 318)": MODE) Illegal operating mode 00 to FF Error in the second call parameter S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 325 ● STATUS[4]=MLEN, if the actual data record length < MLEN < the destination area length from RECORD. ● STATUS[4]=0, if STATUS[4] > 255; would have to be set In PROFINET IO, STATUS[4] has the value 0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 326: Dprd_Dat And Dpwr_Dat (Read/Write Consistent Data For Dp Slaves) Instructions

    (DPWR_DAT). This must be exactly as large as you configured for the selected module with STEP 7. RET_VAL If an error occurs while the function is active, the return value contains an error code. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 327 System error with external DP interface module (DPRD_DAT) and (DPWR_DAT) 80Fx System error with external DP interface module (DPRD_DAT) and (DPWR_DAT) 85xy System error with external DP interface module (DPWR_DAT) 87xy System error with external DP interface module (DPRD_DAT) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 328: Dpnrm_Dg (Read Diagnostic Data From A Dp Slave) Instruction

    1022 means LADDR:=W#16#3FE. RET_VAL If an error occurs while the function is active, the return value contains an error code. If no error occurs, the length of the data actually transferred is entered in RET_VAL. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 329 8093 This instruction is not permitted for the module specified by LADDR • (S7-DP modules for S7-1200 are permitted). LADDR specifies the I/O device instead of specifying the station. Select • the station (and not the image of the device) in the "Network" view of the "Device configuration"...
  • Page 330 Data record transfer was stopped due to a priority class abort (restart or Distributed I/Os background) 8xyy General error codes Refer to "Extended instructions, Distributed I/O: Error information for RDREC, WRREC, and RALRM" (Page 322) for more information on general error codes. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 331: Interrupts

    ADD = 0 (default): This event replaces all previous event • (ATTACH only) attachments for this OB. ADD = 1: This event is added to previous event attachments for • this OB. RET_VAL Execution condition code S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 332 ● High-speed counter (HSC) – Enable this high-speed counter for use – Generate interrupt for counter value equals reference value count – Generate interrupt for external reset event – Generate interrupt for direction change event S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 333 OB. If no OB is currently attached (either from a "" selection in device configuration, or as a result of executing a DETACH instruction), the enabled hardware interrupt event is ignored. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 334: Cyclic Interrupts

    Data types for the parameters Parameter and type Data type Description OB_NR OB_CYCLIC OB number (accepts symbolic name) CYCLE UDInt Time interval, in microseconds PHASE UDInt Phase shift, in microseconds RET_VAL Execution condition code S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 335 OBs. Table 8- 90 Condition codes RET_VAL (W#16#..) Description 0000 No error 8090 OB does not exist or is of wrong type 8091 Invalid cycle time S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 336: Qry_Cint (Query Cyclic Interrupt Parameters) Instruction

    The OB identified by OB_NR does not exist. The OB identified by OB_NR exists. Other Bits Always 0 If an error occurs, RET_VAL displays the appropriate error code and the parameter STATUS = 0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 337: Time Of Day Interrupts

    CPU system time. The NTP client feature of the S7-1200 CPU is disabled by default, and, when enabled, only allows configured IP addresses to act as an NTP server. The CPU disables this feature by default, and you must configure this feature to allow remotely-controlled CPU system time corrections.
  • Page 338 The first hour of the day does not exist when changing from summer to winter (daylight saving time). Use a start time within the second hour or use an additional time delay interrupt within the first hour. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 339: Can_Tint (Cancel Time Of Day Interrupt)

    ACT_TINT (Activate time of day interrupt) Table 8- 101 ACT_TINT (Activate date and time of day interrupt) LAD / FBD Description ret_val:=ACT_TINT(_int_in_); Activates the start date and time of day interrupt event for the specified interrupt OB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 340: Qry_Tint (Query Status Of Time Of Day Interrupt)

    Table 8- 105 Data types for the parameters Parameter and type Data type Description OB_NR OB_TOD (INT) OB number (accepts symbolic name) of the interrupt OB to query RET_VAL Execution condition code STATUS Word Status of the specified interrupt OB S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 341 The date and time of day interrupt uses local time. The date and time of day interrupt uses system time. Others Always 0 Table 8- 107 Condition code RET_VAL (W#16#..) Description 0000 No error 8090 Invalid OB_NR parameter S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 342: Time Delay Interrupts

    OBs. DTIME Time Time delay value (1 to 60000 ms) SIGN Word Not used by the S7-1200: Any value is accepted. A value must be assigned to prevent errors. RET_VAL Execution condition code STATUS Word...
  • Page 343 Table 8- 111 Condition codes for SRT_DINT, CAN_DINT, and QRY_DINT RET_VAL 
 ( W#16#...) Description 0000 No error occurred 8090 Incorrect parameter OB_NR 8091 Incorrect parameter DTIME 80A0 Time delay interrupt has not started. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 344: Dis_Airt And En_Airt (Delay/Enable Execution Of Higher Priority Interrupts And Asynchronous Error Events) Instructions

    OB has been executed. Parameter RET_VAL indicates the number of times that interrupt processing was disabled, which is the number of queued DIS_AIRT executions. Interrupt processing is only enabled again when parameter RET_VAL = 0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 345: Diagnostics (Profinet Or Profibus)

    This will allow you to programmatically handle the errors encountered on the device and if desired take the CPU to STOP mode. This method requires you to specify the hardware device from which to read the status information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 346: Led (Read Led Status) Instruction

    Color 1 = green Tx/Rx Color 1 = yellow RET_VAL Status of the LED For example, you can select the CPU (such as "PLC_1") or the PROFINET interface from the drop-down list of the parameter. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 347: Devicestates Instruction

    I/O interface. In the TIA portal, the hardware identifiers for a PLC can be found by looking for "Hw_IoSystem" data types in the system constants tab in the PLC tag table. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 348 Dword), or an array of (Bools, Bytes, Words, or Dwords) 80Bx DeviceStates instruction not supported by the CPU for this LADDR. 8452 The complete state data is too large for the assigned STATE parameter. The STATE buffer contains a partial result. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 349: Devicestates Example Configurations

    The devices are configured in addresses 10 (Bit 10) through 25 (Bit 25). No devices are configured in addresses 1 through 9. MODE 4 (Device exists) data matches MODE 1 (Device configuration active), so the configured devices match the existing devices. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 350 Bit 23 1111-1111 Bit 16 Byte 4 0x03 Bit 31 0000-0011 Bit 24 Device 12 (Bit 12) is marked as not existing. With this exception, devices 10 through 25 still report as existing. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 351 The devices are configured in addresses 1 (Bit 1) through 16 (Bit 16). No devices are configured in addresses 1 through 9. MODE 4 (Device exists) data matches MODE 1 (Device configuration active), so the configured devices match the existing devices. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 352 Byte 3 0x01 Bit 23 0000-0001 Bit 16 Byte 4 0x00 Bit 31 0000-0000 Bit 24 Device 1 (Bit 1) does not exist. Devices 2 (Bit 2) through 16 (Bit 16) do exist. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 353: Modulestates Instruction

    STATE information. The modes are as follows: 1: Module configuration active • 2: Module defective • 3: Module disabled • 4: Module exists • 5: Problem in Module • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 354: Modulestates Example Configurations

    ● The example uses the LADDR parameter of PROFIBUS slave "DPSlave_12" which contains a head module, a power module, and two I/O modules. ● The first four bytes of the returned STATE parameter information is displayed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 355 Bit 15 0000-0000 Bit 8 Byte 3 0x00 Bit 23 0000-0000 Bit 16 Byte 4 0x00 Bit 31 0000-0000 Bit 24 Only module 3 (Bit 3) is marked as defective. All other modules are functional. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 356 1: Module configuration 0xFFFF_1F00 0xFFFF_1F00 0xFFFF_1F00 active 2: Module defective 0x0000_0000 0x0180_0000 0xFFFF_1F00 3: Module disabled 0x0000_0000 0x0000_0000 0x0000_0000 4: Module exists 0xFFFF_1F00 0xFF7F_1F00 0x0000_0000 5: Problem in module 0x0000_0000 0x0180_0000 0xFFFF_1F00 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 357 Bit 31 0000-0000 Bit 24 Module 15 (Bit 15) is shown as missing. Modules 1 through 14 (Bits 1 through 14) and 16 through 20 (Bits 16 through 20) are shown as existing. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 358: Get_Diag (Read Diagnostic Information) Instruction

    Table 8- 140 GET_DIAG instruction LAD / FBD Description ret_val := GET_DIAG( Reads the diagnostic information from an mode:=_uint_in_, assigned hardware device. laddr:=_word_in_, cnt_diag=>_uint_out_, diag:=_variant_inout_, detail:=_variant_inout_); Parameters The following table shows the parameters of the "GET_DIAG" instruction: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 359 Output of diagnostics data subordinate modules of the in accordance with the DNN addressed hardware object. structure. (Note: Refer to the "DNN structure" information below and GET_DIAG instruction example at the end of the section.) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 360 Bit 11 = 1: PNIO - submodule correct Bit 12 = 1: PNIO - replacement module Bit 13 = 1: PNIO - incorrect module Bit 14 = 1: PNIO - module disconnected Reserved (always = 0) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 361 8 to 15 Reserved (always = 0) OperatingState UInt16 Enum In STOP / firmware update In STOP / reset memory
 In STOP / self start
 In STOP Memory reset In START In RUN In HOLD S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 362 Type in the DETAILS parameter is not supported with the selected mode (parameter MODE). 8090 LADDR does not exist. 8091 The selected channel in the CHANNEL parameter does not exist. 80C1 Insufficient resources for parallel execution S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 363 Extended instructions 8.5 Diagnostics (PROFINET or PROFIBUS) Example The following ladder logic network and DB show how to use the three modes with the three structures: ● DIS ● DNN ① ② S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 364: Pulse

    When the EN input is TRUE, the PWM_CTRL instruction starts or stops the identified PWM based on the value at the ENABLE input. Pulse width is specified by the value in the associated Q word output address. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 365: Operation Of The Pulse Outputs

    Four pulse generators are available for controlling high-speed pulse output functions: PWM and Pulse train output (PTO). PTO is used by the motion control instructions. You can assign each pulse generator to either PWM or PTO, but not both at the same time. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 366 Q4.1 PWM1 Built-in outputs Q0.0 SB outputs Q4.0 PTO2 Built-in I/O Q0.2 Q0.3 SB I/O Q4.2 Q4.3 PWM2 Built-in outputs Q0.2 SB outputs Q4.2 PTO3 Built-in I/O Q0.4 Q0.5 SB I/O Q4.0 Q4.1 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 367: Configuring A Pulse Channel For Pwm

    1214C and 1215C Qa.0 to Qa.4 100kHz 100kHz Qa.5 to Qb.1 20 kHz 20 kHz 1217C DQa.0 to DQa.3 1 MHz 1 MHz (.0+, .0- to .3+, .3-) DQa.4 to DQb.1 100 kHz 100 kHz S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 368 Q memory and cannot be used for other purposes in your user program. If your user program writes a value to an output used as a pulse generator, the CPU does not write that value to the physical output. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 369: Recipes And Data Logs

    CPU work memory that is required for recipe data. ● If the active recipe component values are adjusted by an HMI device during a production run, you can write the modified values back to the recipe DB, using the WRIT_DBL instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 370: Recipe Db Example

    Each table row represents one record that stores the recipe name, component data types, and component values. productname water barley wheat hops yeast waterTmp mashTmp mashTime QTest Pils Lager BlackBeer Not_used Not_used S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 371 DB. Enter the component names and data types that are common to all the example recipes. The individual component values are added later in the recipe DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 372 Recipe export (from recipe DB to CSV file) "RecipeExport (Page 374)" execution transfers recipe DB data to a CSV file, as shown in the following text file. Recipe_DB.csv index,productname,water,barley,wheat,hops,yeast,waterTmp, mashTmp,mashTime,QTest 1,”Pils”,10,9,3,280,39,40,30,100,0 2,”Lager”,10,9,3,150,33,50,30,120,0 3,”BlackBeer”,10,9,3,410,47,60,30,90,1 4 ”Not_used”,0,0,0,0,0,0,0,0,0 5 ”Not_used”,0,0,0,0,0,0,0,0,0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 373 The CSV file can be opened in Excel to make reading and editing easier. If the commas are not recognized as decimal separators, use the Excel import function to output the data in structured form S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 374: Program Instructions That Transfer Recipe Data

    The DONE bit is TRUE for one scan, after the last request was completed with no error. (Default value: False) BUSY Bool RecipeExport execution 0: No operation in progress • 1: Operation on progress • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 375 Not enough space in on MC or in internal load memory 80B4 MC is write protected 80B6 Recipe DB attribute "Only store in load memory" is not enabled. 80C0 CSV file is temporarily locked 80C1 DB is temporarily locked S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 376 The ERROR bit is TRUE for one scan, after the last request was terminated with an error. The error code value at the STATUS parameter is valid only during the single scan where ERROR = TRUE. STATUS Word Execution condition code (Default value: 0) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 377 Structure of the recipe data block and the CSV file do not match: Data type in field n does not match (n<=46). 80FF Structure of the recipe data block and the CSV file do not match: Data type in field n does not match (n>46). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 378: Recipe Example Program

    The instance DBs used by instructions RecipeExport ("RecipeExport_DB") and RecipeImport ("RecipeImport_DB") are created automatically when you place the instructions in your program. The instance DBs are used to control instruction execution and are not referenced in the program logic. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 379 CSV file that is located in the CPU memory recipes folder. Network 4 Capture the STATUS output from RecipeImport execution, because it is only valid for one scan. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 380: Data Logs

    You can open, edit, save, rename, and delete data log files from the File Browser page of the Web Server. You must have read privileges to view the file browser and you must have modify privileges to edit, delete, or rename data log files. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 381: Data Log Record Structure

    255 bytes. The HEADER parameter is optional. If the HEADER is not assigned, then no header row is created in the Data log file. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 382: Program Instructions That Control Data Logs

    The time stamp uses the system time (Coordinated Universal Time - UTC) and not the local time. 0 - No time stamp • 1 - Date and time stamp (Default value) • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 383 The error code value at the STATUS parameter is valid only during the single scan where ERROR = TRUE. STATUS Word Execution condition code (Default value: 0) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 384 Call with no REQ edge: BUSY = 0, DONE = 0 7001 First call with REQ edge (working): BUSY = 1, DONE = 0 7002 call (working): BUSY = 1, DONE = 0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 385 STEP 7 automatically creates the associated instance DB when error=>_bool_out_, you insert the instruction. status=>_word_out_, name:=_string_inout_, ID:=_dword_inout_); In the SCL example, "DataLogOpen_DB" is the name of the instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 386 • A maximum of eight data log files may be open at one time. More than eight data log files may exist, but some of them must be closed so no more than eight are open. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 387 The ERROR bit is TRUE for one scan, after the last request was terminated with an error. The error code value at the STATUS parameter is valid only during the single scan where ERROR = TRUE. STATUS Word Execution condition code (Default value: 0) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 388 (working): BUSY = 1, DONE = 0 8070 All internal instance memory is in use. 8092 Data log does not exist. 80B0 Data log file is not open (for explicit open mode only). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 389 Call with no REQ edge: BUSY = 0, DONE = 0 7001 First call with REQ edge (working): BUSY = 1, DONE = 0 7002 call (working): BUSY = 1, DONE = 0 8092 Data log does not exist. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 390 The ERROR bit is TRUE for one scan, after the last request was terminated with an error. The error code value at the STATUS parameter is valid only during the single scan where ERROR = TRUE. STATUS Word Execution condition code (Default value: 0) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 391 Invalid file name 8091 Name parameter is not a String reference. 8092 Data log does not exist. 8093 Data log already exists. 8097 Requested file length exceeds file system maximum. 80B3 Insufficient load memory available. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 392: Working With Data Logs

    5. Open the .csv file with a spreadsheet application like Microsoft Excel. Viewing data logs on a PLC memory card If the S7-1200 CPU has a "Program" type S7-1200 memory card inserted, then you can remove the memory card and insert the card into a standard SD (Secure Digital) or MMC (MultiMediaCard) card slot on a PC or PG.
  • Page 393: Limit To The Size Of Data Log Files

    Excel to open a local copy of a *.csv file and not the original file that is stored on the memory card. NOTICE You can copy, but do not modify or delete data log files on a S7-1200 memory card using a PC card reader The standard Web server File Browser page is the recommended tool for viewing, downloading (copying), and deleting data log files.
  • Page 394 Use the following steps to view the load memory memory size. 1. Establish an online connection between STEP 7 and the target S7-1200 PLC. 2. Download the program that controls your data log operations. 3. Create any optional user-defined Web pages that you need. The standard Web pages that access data logs are stored in PLC firmware and do not use load memory.
  • Page 395 If no size is assigned with square brackets, then 254 bytes is allocated by default. Text characters + automatic padding with blank characters = 254 bytes Opening and closing double quote + comma characters = 3 bytes 254 + 3 = 257 total bytes USInt UInt S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 396: Data Log Example Program

    • A maximum of eight data log files may be open at one time. More than eight data log files may exist, but some of them must be closed so no more than eight are open. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 397 DB locations are transferred to a data log file by executing the DataLogWrite instruction. Network 1 REQ rising edge starts the data log creation process. Network 2 Capture the DONE output from DataLogCreate because it is only valid for one scan. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 398 Network 5 Close the data log once the last record has been written. After executing the DataLogWrite operation that writes the last record, the log file full status is signaled when DataLogWrite STATUS output = 1. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 399 ID value for the new Data log is written back to the ID reference location. The required DONE bit = TRUE capture is not shown, refer to networks 1, 2, and 4 for an example of DONE bit logic. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 400 Extended instructions 8.7 Recipes and Data logs Data log files created by the example program viewed with the S7-1200 CPU Web server ① The "Delete" option is not available if you are not logged in with modify privileges. ② The "Rename" option is not available if you are not logged in with modify privileges.
  • Page 401: Data Block Control

    BUSY = 1 signals that the reading/writing process is not complete. DSTBLK VARIANT READ_DBL: Pointer to the destination data block in work memory WRIT_DBL: Pointer to the destination data block in load memory S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 402 To ensure data consistency, do not modify the destination area during the processing of READ_DBL or the source area during the processing of WRIT_DBL (that is, as long as the BUSY parameter is TRUE). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 403 85C0 The destination DB is being edited by another statement or a communication function. 80C3 More than 50 READ_DBL or 50 WRIT_DBL statements are currently queued for execution. See also Recipes (Page 369) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 404: Address Handling

    CPU or the interface of the hardware configuration. RET_VAL Error code of the instruction GEOADDR IN_OUT Variant Pointer to the GEOADDR system data type S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 405 Number of the submodule. If no submodule can be inserted, this parameter has the value "0". Table 8- 181 Condition codes RET_VAL Description (W#16#...) 0000 No error 8090 The address specified at the LADDR parameter is invalid. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 406: Rd_Addr (Determine The Io Addresses From The Hardware Identifier) Instruction

    Error code of the instruction PIADDR UDInt Start address of the input module PICOUNT UInt Number of bytes of the inputs PQADDR UDInt Start address of the output module PQCOUNT UInt Number of bytes of the outputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 407: Common Error Codes For The "Extended" Instructions

    STOP. Optionally, you can use the GetError or GetErorID instructions within that code block to handle the error locally (CPU remains in RUN), and create a programmed reaction to the error. The "x" represents the parameter number with the error. Parameter numbers start with 1. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 408 Extended instructions 8.10 Common error codes for the "Extended" instructions S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 409: Technology Instructions

    New direction: 1= forward, -1= backward NEW_CV DInt New counter value NEW_RV DInt New reference value NEW_PERIOD New period value in seconds(only for frequency measurement mode): 1= 1 s 2 = .1 s 3 = 0.1 s S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 410 HSC. You can change the I address for the current value by modifying the properties of the CPU in the Device Configuration. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 411: Operation Of The High-Speed Counter

    As each current-count-value-equals-preset-value interrupt event occurs, a new preset is loaded and the next state for the outputs is set. When the reset interrupt event occurs, the first preset and the first output states are set, and the cycle is repeated. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 412 1 or 2 phase mode A/B Quadrature phase mode SB 1221, 200 kHz Ie.0 to Ie.3 200kHz 160 kHz SB 1223, 200 kHz Ie.0, Ie.1 200kHz 160 kHz SB 1223 Ie.0, Ie.1 30 kHz 20 kHz S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 413 Two-phase counter with 2 Clock up Clock down Count or frequency clock inputs Reset Count A/B-phase quadrature Phase A Phase B Count or frequency counter Reset Count For an encoder: Phase Z, Home S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 414 CPU 1211C: HSC default address assignments CPU on-board input Optional SB input (default counter mode (default 0.x) 4.x) HSC 1 1-phase 2-phase AB-phase HSC 2 1-phase 2-phase AB-phase HSC 3 1-phase 2-phase AB-phase HSC4 1-phase 2-phase S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 415 HSC 3 1-phase 2-phase AB-phase HSC 4 1-phase 2-phase AB-phase HSC 5 1-phase 2-phase AB-phase HSC 6 1-phase 2-phase AB-phase An SB with only 2 digital inputs provides only the 4.0 and 4.1 inputs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 416 HSC 1 1-phase 2-phase AB-phase HSC 2 1-phase 2-phase AB-phase HSC 5 1-phase 2-phase AB-phase HSC 6 1-phase 2-phase AB-phase An SB with only 2 digital inputs provides only the 4.0 and 4.1 inputs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 417: Configuration Of The Hsc

    This changing of filter times can result in unexpected machine or process operation, which can cause death or serious injury to personnel, and/or damage to equipment. To ensure that a new filter time goes immediately into effect, power cycle the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 418: Pid Control

    For additional information about configuring the HSC, refer to the section on configuring the CPU (Page 142). PID control STEP 7 provides the following PID instructions for the S7-1200 CPU: ● The PID_Compact instruction is used to control technical processes with continuous input- and output variables.
  • Page 419 Setpoint value Laplace operator Proportional gain Derivative delay coefficient (P component) (D component) Integral action time Proportional action weighting (I component) (P component) Derivative action time Derivative action weighting (D component) (D component) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 420: Inserting The Pid Instruction And Technology Object

    Each PID instruction must have its own unique instance DB to operate properly. After inserting the PID instruction and creating the technology object and instance DB, you configure the parameters for the technology object (Page 437). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 421 Click the "Control" icon and select the technology object for the type of PID controller (PID_Compact or PID_3Step). You can create an optional name for the technology object. Click "OK" to create the technology object. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 422: Pid_Compact Instruction

    An Analog input is used as the source of the process value. (Default value: W#16#0) If you are using the Input_PER parameter, you must set Config.InputPerOn = TRUE. Disturbance Real Disturbance variable or pre-control value S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 423 If SetpointLimit_L = TRUE, the absolute setpoint lower limit is reached (Setpoint ≤ Config.SetpointLowerLimit). The setpoint is limited to Config.SetpointLowerLimit. InputWarning_H Bool If InputWarning_H = TRUE, the process value has reached or exceeded the warning high limit. (Default value: FALSE) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 424 Reset or ErrorAck. Note: In V1.x, the ErrorBits parameter was defined as the Error parameter and did not exist. You can use the outputs of the Output, Output_PER, and Output_PWM parameters in parallel. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 425 Technology instructions 9.2 PID control Operation of the PID_Compact controller Figure 9-1 Operation of the PID_Compact controller Figure 9-2 Operation of the PID_Compact controller as a PIDT1 controller with anti-windup S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 426: Pid_Compact Instruction Errorbit Parameters

    Note: If ActivateRecoverMode = TRUE before the error occurred, PID_Compact uses SubstituteOutput as the output value. As soon as you assign a valid value in the ManualValue parameter, PID_Compact uses it as the output value. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 427 PID_Compact switches back to automatic mode. Note: If ActivateRecoverMode = TRUE before the error occurred, PID_Compact cancels the tuning and switches to the operating mode that is saved in the Mode parameter. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 428: Pid_3Step Instruction

    STEP 7 automatically creates the technology object and instance DB when you insert the instruction. The instance DB contains the parameters of the technology object. In the SCL example, "PID_3Step_1" is the name of the instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 429 Process value for manual operation. (Default value: 0.0) In manual mode, you specify the absolute position of the valve. ManualValue is evaluated only if you are using OutputPer, or if position feedback is available. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 430 ScaledFeedback can only be used for rough estimation of the current position in this case. Output_UP Bool Digital output value for opening the valve. (Default value: FALSE) If Config.OutputPerOn = FALSE, the parameter Output_UP is used. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 431 DW#16#0000 (no error)). ErrorBits is retentive and is reset upon a rising edge at Reset or ErrorAck. Note: In V1.x, the ErrorBits parameter was defined as the Error parameter and did not exist. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 432 Technology instructions 9.2 PID control Figure 9-3 Operation of the PID_3Step controller as a PID T1 controller with anti-windup S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 433 Technology instructions 9.2 PID control Figure 9-4 Operation of the PID_3Step controller without position feedback S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 434 Technology instructions 9.2 PID control Figure 9-5 Operation of the PID_3Step controller with position feedback enabled S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 435: Pid_3Step Instruction Errorbit Parameters

    Manual mode is not possible in this state. In order to move the actuator from this state, you must deactivate the "Actuator end stop" (Config.ActuatorEndStopOn = FALSE) or switch to manual mode without end stop signals (Mode = 10). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 436 The actuator cannot be moved to the substitute output value and remains in its current position. In manual mode, you can change the position of the actuator only with Manual_UP and Manual_DN, and not with ManualValue. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 437: Configuring The Pid Controller

    Scales both the range and the limits for the process value. If the process value goes below the low limit or value above the high limit, the PID loop goes to inactive mode and sets the output value to 0. To use Input_PER, you must scale the analog process value (input value). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 438 Sets the minimum movement time for the valve. (Locate this value on the data sheet or the faceplate of the valve.) Minimum OFF Sets the minimum pause time for the valve. (Locate this value on the data sheet or the time faceplate of the valve.) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 439: Commissioning The Pid Controller

    "PID Parameters" section of the commissioning editor. If an error occurs during tuning, the output value of the PID goes to 0. The PID mode then is set to "inactive" mode. The status indicates the error. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 440 The figure above shows the PID parameter screen with compare icons showing which values are different between online and offline projects. A green icon indicates that the values are the same; a blue/orange icon indicates that the values are different. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 441: Motion Control

    Note Changes that you make to the motion control configuration and download in RUN mode do not take effect until the CPU transitions from STOP to RUN mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 442 Power section for stepper motor ④ Power section for servo motor The DC/DC/DC variants of the CPU S7-1200 have onboard outputs for direct control of drives. The relay variants of the CPU require the signal board with DC outputs for drive control.
  • Page 443 A/B, quadrature, up/down, output and pulse/direction SB 1222, 200 kHz DQe.0 to DQe.3 200kHz 200 kHz SB 1223, 200 kHz DQe.0, DQe.1 200kHz 200 kHz SB 1223 DQe.0, DQe.1 20 kHz 20 kHz S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 444 Ex. 1: PTO1 4 - 1 PTO2 PTO3 PTO4 direction output) Ex. 2: 1 - PTO1 1 MHz; 2 PTO2 - 100 PTO3 and 1 - PTO4 20 KHz (all with direction output) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 445 1212C CPU 1214C CPU 1214C 1214C CPU 1215C CPU 1215C 1215C Ex. 1: PTO1 4 - 100 PTO2 KHz (no PTO3 direction PTO4 output) Ex. 2: PTO1 2 - 100 PTO2 KHz; PTO3 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 446: Phasing

    ● PTO (count up A and count down B): If you select a PTO (count up A and count down B) option, then one output (P0) pulses for positive directions and a different output (P1) pulses for negative directions: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 447 You configure the number of transitions. The phase relationship (A leading B or B leading A) determines the direction of movement. PTO (A/B phase-shifted - fourfold) Phase A leads phase B (positive movement) Phase A lags phase B (negative movement) Number of pulses Number of pulses S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 448: Configuring A Pulse Generator

    – Setting the Enable input to TRUE allows the other motion instructions to function. – Setting the Enable input FALSE cancels the other motion instructions. Note Include only one MC_Power instruction per axis. 3. Insert the other motion instructions to produce the required motion. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 449: Configuring The Axis

    HSC1. If PTO2 is activated, it will be connected to HSC2. You cannot monitor the current value (for example, in ID1000) when pulses are occurring. S7-1200 V3.0 and later CPUs do not have this restriction; all HSCs remain available for program use when pulse outputs are configured in these CPUs.
  • Page 450 Note You may have to adapt the values of the input parameters of motion control instructions to the new dimension unit in the user program. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 451 (both in absolute and relative terms) and can specify the velocity, acceleration and deceleration. You can also test the homing and jogging tasks. The control panel also allows you to acknowledge errors. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 452: Configuring The To_Commandtable_Pto

    Positioning Absolute Positions the axis based upon location. The command moves the axis to the given location, using the velocity specified. Velocity setpoint Moves the axis at the given velocity. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 453 In the figure below, "Command complete" is used as the transition to the next step. This type of transition allows your device to decelerate to the start/stop speed and then accelerate once again at the start of the next step. ① Axis decelerates to the start/stop speed between steps. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 454 ① Axis continues to move and accelerates or decelerates to the next step velocity, saving time and mechanical wear. The operation of your CommandTable is controlled by an MC_CommandTable instruction, as shown below: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 455: Motion Control Instructions

    Axis input. CPU firmware levels If you have an S7-1200 CPU with V4.0 firmware, select the V4.0 version of each motion instruction. If you have an S7-1200 CPU with V3.0 or earlier firmware, select the applicable V3.0, V2.0, or V1.0 version of each motion instruction.
  • Page 456: Mc_Power (Release/Block Axis) Instruction

    2: Emergency stop with jerk control: If a request to disable the axis is • pending, the axis brakes at the configured emergency stop deceleration. If the jerk control is activated, the configured jerk is taken into account. The axis is disabled after reaching standstill. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 457 "Status_1". ② Following an axis enable, an error has occurred that caused the axis to be disabled. The error is eliminated and acknowledged with "MC_Reset". The axis is then enabled again. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 458 2. Set input parameter "Enable" to FALSE after standstill is reached. 3. If output parameters "Busy" and "Status" and technology object tag .StatusBits.Enable indicate the value FALSE, disabling of the axis is complete. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 459: Mc_Reset (Confirm Error) Instruction

    2. Start the acknowledgement of the error with a rising edge at the Execute input parameter. 3. The error has been acknowledged when Done equals TRUE and the technology object tag .StatusBits.Error equals FALSE. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 460: Mc_Home (Home Axis) Instruction

    The traversing motion required for this step must be implemented by the user via other motion control instructions. When the reference point switch is detected, the axis is homed. ● Active homing (Mode = 3): The homing procedure is executed automatically. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 461 • Switchover between automatic control and manual control • Upon start of active homing (After successful completion of the homing operation, axis homing is available again.) • After power-cycling the CPU • After CPU restart (RUN-to-STOP or STOP-to-RUN) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 462: Mc_Halt (Pause Axis) Instruction

    CommandAborted=>_bool_out_, Error=>_bool_out_, ErrorID=>_word_out_, ErrorInfo=>_word_out_); STEP 7 automatically creates the DB when you insert the instruction. In the SCL example, "MC_Halt_DB" is the name of the instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 463 The axis is braked by an MC_Halt task until it comes to a standstill. The axis standstill is signaled via "Done_2". ② While an MC_Halt task is braking the axis, this task is aborted by another motion task. The abort is signaled via "Abort_2". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 464: Mc_Moveabsolute (Position Axis Absolutely) Instruction

    Limit values: Start/stop velocity ≤ Velocity ≤ maximum velocity Done Bool TRUE = Absolute target position reached Busy Bool TRUE = The task is being executed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 465 An active MC_MoveAbsolute task is aborted by another MC_MoveAbsolute task. The abort is signaled via "Abort_1". The axis is then moved at the new velocity to the new target position 1500.0. When the new target position is reached, this is signaled via "Done_2". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 466: Mc_Moverelative (Position Axis Relatively) Instruction

    Limit values: Start/stop velocity ≤ Velocity ≤ maximum velocity Done Bool TRUE = Target position reached Busy Bool TRUE = The task is being executed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 467 An active MC_MoveRelative task is aborted by another MC_MoveRelative task. The abort is signaled via "Abort_1". The axis is then moved at the new velocity by the new distance ("Distance") 500.0. When the new target position is reached, this is signaled via "Done_2". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 468: Mc_Movevelocity (Move Axis At Predefined Velocity) Instruction

    InVelocity=>_bool_out_, Busy=>_bool_out_, CommandAborted=>_bool_out_, Error=>_bool_out_, ErrorID=>_word_out_, ErrorInfo=>_word_out_); STEP 7 automatically creates the DB when you insert the instruction. In the SCL example, "MC_MoveVelocity_DB " is the name of the instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 469 "ErrorID" and "ErrorInfo". ErrorID Word Error ID for parameter "Error" (Default value: 0000) ErrorInfo Word Error info ID for parameter "ErrorID" (Default value: 0000) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 470 • MC_Home Mode = 3 • MC_Home Mode = 3 • MC_Halt • MC_Halt • MC_MoveAbsolute • MC_MoveAbsolute • MC_MoveRelative • MC_MoveRelative • MC_MoveVelocity • MC_MoveVelocity • MC_MoveJog • MC_MoveJog S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 471: Mc_Movejog (Move Axis In Jog Mode) Instruction

    Busy=>_bool_out_, CommandAborted=>_bool_out_, Error=>_bool_out_, ErrorID=>_word_out_, ErrorInfo=>_word_out_); STEP 7 automatically creates the DB when you insert the instruction. In the SCL example, "MC_MoveJog_DB " is the name of the instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 472 The axis is moved in the negative direction in jog mode via "Jog_B". When the target velocity 50.0 is reached, this is signaled via "InVelo_1". The axis brakes to a standstill again after Jog_B is reset. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 473: Mc_Commandtable (Run Axis Commans As Movement Sequence) Instruction

    Start command table processing with this step Limits: 1 ≤ StartIndex ≤ EndIndex EndIndex End command table processing with this step Limits: StartIndex ≤ EndIndex ≤ 32 Done Bool FALSE MC_CommandTable processing completed successfully S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 474 Positions the axis based upon distance. The command moves the axis by the given distance and velocity. Positioning Absolute Positions the axis based upon location. The command moves the axis to the given location, using the velocity specified. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 475 • MC_MoveVelocity • MC_MoveVelocity • MC_MoveJog • MC_MoveJog • MC_CommandTable • MC_CommandTable • The current motion control job with the launch of the first "Positioning Relative", "Positioning Absolute", "Velocity setpoint" or "Halt" command S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 476: Mc_Changedynamic (Change Dynamc Settings For The Axis) Instruction

    The change will influence the tag . Config.DynamicDefaults.Deceleration. The effectiveness of the change is shown in the description of this tag. ChangeEmergency Bool TRUE = Change emergency stop ramp-down time in line with input parameter "EmergencyRampTime" Default value: FALSE S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 477 "RoundingOffTime" can be specified with values that makes the resultant axis parameters "acceleration", "delay", "emergency stop-delay" and "jerk" outside the permissible limits. Make sure you keep the MC_ChangeDynamic parameters within the limits of the dynamic configuration settings for the axis technology object. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 478: Mc_Writeparam (Write Parameters Of A Technology Object) Instruction

    Writeable parameter name Writeable parameter name Actor.InverseDirection DynamicDefaults.Acceleration Actor.DirectionMode DynamicDefaults.Deceleration Actor.DriveParameter.PulsesPerDriveRevolution DynamicDefaults.Jerk Sensor[1].ActiveHoming.Mode DynamicDefaults.EmergencyDeceleration Sensor[1].ActiveHoming.SideInput PositionLimitsHW.Active Sensor[1].ActiveHoming.Offset PositionLimitsHW.MaxSwitchedLevel Sensor[1].ActiveHoming.SwitchedLevel PositionLimitsHW.MinSwitchedLevel Sensor[1].PassiveHoming.Mode PositionLimitsSW.Active Sensor[1].PassiveHoming.SideInput PositionLimitsSW.MinPosition Sensor[1].PassiveHoming.SwitchedLevel PositionLimitsSW.MaxPosition Units.LengthUnit Homing.AutoReversal Mechanics.LeadScrew Homing.ApproachDirection DynamicLimits.MinVelocity Homing.ApproachVelocity DynamicLimits.MaxVelocity Homing.ReferencingVelocity S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 479 Set a valid parameter (public read-only Axis TO-DB parameter) out-of-range Error Error Config Config Set a valid parameter (public Axis TO-DB parameter) out-of-range Error Error [1] Error at MC_WriteParam [2] Error at MC_Power [3] Error at MC_Power and MC_MoveXXX or MC_CommandTable S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 480: Mc_Readparam Instruction (Read Parameters Of A Technology Object) Instruction

    If TRUE, an error occurred. Default value: FALSE ERRORID Word ID of the error. Default value: 0 ERRORINFO Word Related information to the ERRORID. Default value: 0 VALUE INOUT Variant Pointer to the location where the read value is stored S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 481: Operation Of Motion Control For S7-1200

    REAL TargetPosition • 9.3.6 Operation of motion control for S7-1200 9.3.6.1 CPU outputs used for motion control The CPU provides four pulse output generators. Each pulse output generator provides one pulse output and one direction output for controlling a stepper motor drive or a servo motor drive with pulse interface.
  • Page 482 The CPU 1212C does not have outputs Q0.6 or Q0.7. Therefore, these outputs cannot be used in the CPU 1212C. This table applies to the CPU 1211C, CPU 1212C, CPU 1214C, CPU 1215C, and CPU 1217C PTO functions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 483: Hardware And Software Limit Switches For Motion Control

    Lower and upper software limits Distance Hardware and software limit switches must be activated prior to use in the configuration or in the user program. Software limit switches are only active after homing the axis. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 484 The axis brakes to a standstill at the configured emergency deceleration. ② Range in which the hardware limit switches signal the stats "approached". [Velocity] Allowed travel range Distance Mechanical stop Lower hardware limit switch Upper hardware limit switch S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 485 ① The axis brakes to a standstill at the configured deceleration. [Velocity] Working range Distance Lower software limit switch Upper software limit switch S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 486: Homing

    The agreement between the axis coordinates and the real situation is extremely important. This step is necessary to ensure that the absolute target position of the axis is also achieved exactly with the drive. The MC_Home instruction initiates the homing of the axis. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 487 "Axis" technology object as the Reference Point Switch. The reference point can be placed in the work area of the axis or outside of the normal work area but within movement range. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 488 (Active and passive homing) direction. The homing direction specifies the travel direction the axis uses to approach the configured side of the reference point switch to carry out the homing operation. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 489 Negative direction Right Positive "Right (positive) side" Positive direction Right Negative direction Left Negative "Left (negative) side" Positive direction Right Negative direction Left Negative "Right (positive) side" Positive direction Left Negative direction Right S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 490 "Reference point coordinates" at the "reduced velocity". On reaching the "Reference point coordinates", the axis is stopped at the position value that was specified in the Position input parameter of the MC_Home instruction". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 491: Jerk Limit

    Jerk limit Travel without step limiter Travel with step limiter The jerk limit gives a "smoothed" velocity profile of the axis motion. This ensures soft starting and braking of a conveyor belt for example. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 492: Commissioning

    Table 9- 64 Status of the axis motion Status Description Standstill The axis is at a standstill. (Tag of technology object: .StatusBits.StandStill) Accelerating The axis accelerates. (Tag of technology object: .StatusBits.Acceleration) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 493 The "Axis" technology object was incorrectly configured or editable configuration data were modified incorrectly during runtime of the user program. (Tag of technology object: .ErrorBits.ConfigFault) General Error An internal error has occurred. (Tag of technology object: .ErrorBits.SystemFault) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 494 The "Acceleration" field indicates the currently configured acceleration of the axis. (Tag of technology object: .Config.DynamicDefaults.Acceleration) Deceleration The "Deceleration" field indicates the currently configured deceleration of the axis. (Tag of technology object: .Config.DynamicDefaults.Deceleration) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 495 Technology object data block (TO-DB) and to be informed about the values that will be used as current values on the next Stop-to-Start transition of the PLC. In addition, a compare icon gives a visual indication to help easily identify online/offline differences. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 496 Additionally, click the parameter button with the downward arrow to open a small window that shows the project (offline) start value and the PLC (online) start value of each parameter. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 497: Monitoring Active Commands

    TRUE in the output parameter "Error". The signal status of the input parameter "Execute" influences the display duration in the output parameter "Error". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 498 If "Execute" retains the value TRUE until after completion of the task, then "Done" also remains TRUE and changes its value to FALSE together with "Execute". ⑤ If "Execute" has been set to FALSE before the task is complete, "Done" indicates the value TRUE for only one execution cycle. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 499 If "Execute" retains the value TRUE until after the task is aborted, then "CommandAborted" also remains TRUE and changes its value to FALSE together with "Execute". ⑤ If "Execute" has been set to FALSE before the task is aborted, "CommandAborted" indicates the value TRUE for only one execution cycle. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 500 If "Execute" retains the value TRUE until after the error occurs, then "Error" also remains TRUE and only changes its value to FALSE together with "Execute". ⑤ If "Execute" has been set to FALSE before the error occurs, "Error" indicates the value TRUE for only one execution cycle. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 501: Monitoring The Mc_Velocity Instruction

    TRUE in the output parameter "Error". The signal status of the input parameter "Execute" influences the display duration in the output parameter "Error". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 502 If "Execute" has been reset to FALSE before the parameterized velocity is reached, the task is complete when the parameterized velocity is reached. "InVelocity" indicates the value TRUE for one execution cycle and changes to FALSE together with "Busy". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 503 FALSE, and a new motion control task is initiated. • When the parameterized velocity is reached and input parameter "Execute" has the value FALSE, the task is complete. Therefore, the start of a new task is not indicated as an abort. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 504 • When the parameterized velocity is reached and input parameter "Execute" has the value FALSE, the task is complete. After completion of the task, the axis error is only indicated in the motion control instruction "MC_Power". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 505: Monitoring The Mc_Movejog Instruction

    ● The third example shows the behavior of the axis if an error occurs. If an error occurs during execution of the motion control task, this is indicated by the value TRUE in output parameter "Error". The behavior is independent of whether or not the parameterized velocity has been reached. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 506 As a result, the axis no longer moves at constant velocity and the output parameter "InVelocity" changes its status to FALSE. ⑤ If the axis has come to a standstill, the motion control task is complete and the output parameter "Busy" changes its value to FALSE. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 507 The task abort is indicated in the output parameter "CommandAborted" for only one execution cycle, if all conditions below are met: The input parameters "JogForward" and "JogBackward" have the value FALSE (but the axis is still decelerating) and a new motion control task is initiated. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 508 The input parameters "JogForward" and "JogBackward" have the value FALSE (but the axis is still decelerating) and a new error occurs (software limit switch is approached, for example). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 509: Communication

    Communication The S7-1200 offers several types of communication between CPUs and programming devices, HMIs, and other CPUs. WARNING If an attacker can physically access your networks, the attacker can possibly read and write data. The TIA Portal, the CPU, and HMIs (except HMIs using GET/PUT) use secure communication that protects against replay and "man-in-the-middle"...
  • Page 510 PROFINET are separate communications networks that do not limit each other. AS-i The S7-1200 CM 1243-2 AS-i Master allows the attachment of an AS-i network to an S7- 1200 CPU. CPU-to-CPU S7 communication You can create a communication connection to a partner station and use the GET and PUT instructions to communicate with S7 CPUs.
  • Page 511: Number Of Asynchronous Communication Connections Supported

    ● 3 CPU-to-CPU S7 connections for server GET/PUT data ● 8 CPU-to-CPU S7 connections for client GET/PUT data Note S7-1200, S7-300, and S7-400 CPUs use the GET and PUT instructions for CPU-to-CPU S7 communication. An S7-200 CPU uses ETHx_XFER instructions for CPU-to-CPU S7 communication.
  • Page 512: Profinet

    You do not have to execute the communication instruction again. The CPU can communicate with other CPUs, with programming devices, with HMI devices, and with non-Siemens devices using standard TCP communications protocols. Programming device connected to the HMI connected to the CPU...
  • Page 513 The CPU 1215C and the CPU 1217C have a built-in 2-port Ethernet switch. You can have a network with a CPU 1215C and two other S7-1200 CPUs. You can also use the rack- mounted CSM1277 4-port Ethernet switch for connecting multiple CPUs and HMI devices.
  • Page 514: Open User Communication

    CPU. Note Each TSEND_C, TRCV_C or TCON instruction in your user program creates a new connection. It is important to use the correct connection ID for each connection. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 515 ID for that connection (connection ID 2 for CPU_1). ④ TSEND_C on CPU_2 creates a second connection and assigns a different connection ID for that connection (connection ID 2 for CPU_2). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 516 ③ TSEND and TRCV on CPU_1 use the connection ID created by the TCON on CPU_1 (ID=1). TSEND and TRCV on CPU_2 use the connection ID created by the TCON on CPU_2 (ID=1). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 517: Protocols

    10.2.2.2 Protocols The integrated PROFINET port of the CPU supports multiple communications standards over an Ethernet network: ● Transport Control Protocol (TCP) ● ISO on TCP (RFC 1006) ● User Datagram Protocol (UDP) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 518: Ad Hoc Mode

    For example: If you were to receive five 100-byte packets with one call, TCP would deliver these five packets as one 500-byte packet, while ISO-on-TCP would restructure the packets into five 100-byte packets. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 519: Tcp And Iso On Tcp

    Using Transport Service Access Points (TSAPs), TCP protocol allows multiple connections to a single IP address (up to 64K connections). With RFC 1006, TSAPs uniquely identify these communication end point connections to an IP address. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 520: Tsend_C And Trcv_C (Send And Receive Data Via Ethernet) Instructions

    STEP 7 enters the corresponding data in the DB for the instruction. If you want to use a multi-instance DB, you must manually configure the DB on both CPUs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 521 (TSEND_C) or received (TRCV_C). Ad hoc mode = 65535: A variable length of data is set for • reception (TRCV_C). CONNECT IN_OUT TCON_Param Pointer to the connection description (Page 153) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 522 The default setting of the LEN parameter (LEN = 0) uses the DATA parameter to determine the length of the data being transmitted. Ensure that the DATA transmitted by the TSEND_C instruction is the same size as the DATA parameter of the TRCV_C instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 523 1 to 8192 specified length 8192, except 65535 ISO on TCP Ad hoc mode B#16#12 65535 1 to 1472 ISO on TCP Protocol-controlled B#16#12 0 (recommended) or 1 to 1 to 8192 8192, except 65535 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 524 In the S7-1200, you set "ad hoc mode" by assigning "65535" to the LEN parameter. If you import an S7-300/400 STEP 7 project containing "ad hoc mode" into the S7-1200, you must change the LEN parameter to "65535". Note...
  • Page 525 Inconsistent parameters: Error in the connection description • Local port (parameter local_tsap_id) is already present in another connection • description. ID in the connection description different from the ID specified as parameter • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 526 The TSEND_C and TRCV_C and TSEND and TRCV instructions all support the TCP and ISO on TCP Ethernet protocols. Refer to "Device Configuration: Configuring the Local/Partner connection path (Page 150)" for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 527: Tcon, Tdiscon, Tsend, And Trcv (Tcp Communication) Instructions

    The job successfully completed. FALSE FALSE TRUE The job was ended with an error. The cause of the error can be found in the STATUS parameter. FALSE FALSE FALSE A new job was not assigned. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 528 The ID must be identical to the associated parameter ID in the local connection description. Value range: W#16#0001 to W#16#0FFF CONNECT IN_OUT TCON_Param Pointer to the connection description (Page 153) (TCON) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 529 IP address. 80A5 TCON: Connection ID (Page 514) is already in use. 80A7 TCON: Communications error: you executed TDISCON before TCON was complete. TDISCON must first completely terminate the connection referenced by the ID. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 530 In this state, the TSEND instruction "Busy" output is set, and the "Status" output has a value of "0x7002". This condition may occur if you are transferring more than 4096 bytes of data. The issue is resolved at the next execution of the TRCV instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 531 . The address refers to I memory, Q memory, M memory, or a DB. DONE Bool TSEND: 0: Job not yet started or still running. • 1: Job executed without error. • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 532 TSEND instruction is the same size as the DATA parameter of the TRCV instruction. As soon as all the job data has been received, TRCV transfers it to the receive area and sets NDR to 1. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 533 In the S7-1200, you set "ad hoc mode" by assigning "65535" to the LEN parameter. If you import an S7-300/400 STEP 7 project containing "ad hoc mode" into the S7-1200, you must change the LEN parameter to "65535". S7-1200 Programmable controller...
  • Page 534 Every CPU has an integrated PROFINET port, which supports standard PROFINET communications. The TSEND_C, TRCV_C, TSEND and TRCV instructions all support the TCP and ISO on TCP Ethernet protocols. Refer to "Device Configuration: Configuring the Local/Partner connection path (Page 150)" for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 535: Udp

    ● TDISCON disconnects the communication between the client and server. Refer to TCON, TDISCON, TSEND, and TRCV (Page 527) in the "TCP and ISO-on-TCP" section for more information on the TCON and TDISCON communication instructions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 536 Otherwise, range of values: 1 to 1472 • DONE Bool Status parameter DONE (TUSEND): (TUSEND) 0: Job is not yet started or still running. • 1: Job completed without error. • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 537 Due to the asynchronous function of the instructions: For TUSEND, you must keep the data in the sender area consistent until the DONE parameter or the ERROR parameter assumes the value TRUE. For TURCV, the data in the receiver area are only consistent when the NDR parameter assumes the value TRUE. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 538 IP address (TUSEND). 80B3 The set protocol variant (connection_type parameter in the connection description) • is not UDP. Please use the TSEND or TRCV instruction. ADDR parameter: Invalid settings for port number (TUSEND) • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 539 Both partners are passive in UDP communication. Typical parameter start values for the "TCON_Param" data type are shown in the following figures. Port numbers (LOCAL_TSAP_ID) are written in a 2-byte format. All ports except for 161, 34962, 34963, and 34964 are allowed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 540 "TADDR_Param" data type. The TURCV instruction receives data through UDP. After a successful execution of the TURCV instruction, the "TADDR_Param" data type shows the address of the remote partner (the sender), as shown in the figures below. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 541: T_Config

    A warm restart does initialize all non-retentive system and user data and retains the values of all retentive user data. Note You should not attempt to execute more than one T_CONFIG instruction at a time. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 542 Description (DW#16#...) 00000000 No error Note: If the instruction executes successfully, the "no error" status may not be returned. 00700000 The job is not finished (BUSY = 1). 00700100 Start of job execution S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 543 C080C400 Communication failure. The error can occur temporarily and will require a repeat of the user program. C080D200 Execution of the instruction is not supported by the PROFINET interface. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 544 In the IF_CONF_Header field, only two subfields, "addr" (IP address) and "nos" (Name of station) are currently allowed. Table 10- 20 Subfields supported subfield_type_id Data type Explanation IF_CONF_V4 IP parameters: IP address, subnet mask, router address IF_CONF_NOS PROFINET IO device name (Name of station) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 545 IEC 61158-6-10). Otherwise, nos is rejected and the "T_CONFIG (Page 541)" instruction enters the error code DW#16#C0809400 in STATUS. If you occupy the first byte with zero, the station name is deleted. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 546 "Ethernet address" page, the "Set IP address using a different method" radio button must be clicked to enable you to change the IP address using the "T_CONFIG" instruction after the program is downloaded. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 547 In the CPU "Properties", "Ethernet address" page, the "Set PROFINET device name using a different method" radio button must be clicked to enable you to change the PROFINET device name using the "T_CONFIG" instruction after the program is downloaded. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 548: Common Parameters For Instructions

    STEP 7 and is the ID of the network that you want to use for this communication block. The ID must be identical to the associated parameter ID in the local connection description. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 549 – 01.00, 01.01, 02.00, 02.01, 03.00, 03.01 – 10.00, 10.01, 11.00, 11.01, ... BF.00, BF.01 ● TCP port (passive): 5001, 102, 123, 20, 21, 25, 34962, 34963, 34964, 80 ● UDP port (passive): 161, 34962, 34963, 34964 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 550: Communication With A Programming Device

    2. Plug the Ethernet cable into the PROFINET port shown below. 3. Connect the Ethernet cable to the programming device. ① PROFINET port An optional strain relief is available to strengthen the PROFINET connection. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 551: Configuring The Devices

    The CPU "Download to device" function and its "Extended download to device" dialog can show all accessible network devices and whether or not unique IP addresses have been assigned to all devices. Refer to "Testing the PROFINET network" (Page 162) for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 552: Hmi-To-Plc Communication

    Refer to "Communication with a programming device: Configuring the devices" (Page 551) for more information. Configuring the logical network connections between an HMI and a CPU Refer to "HMI-to-PLC communication: Configuring the logical network connections between two devices" (Page 553) for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 553: Configuring Logical Network Connections Between Two Devices

    ● Configuration/Setup: Hardware configuration is required. ● Supported functions: Reading/Writing data to a peer CPU ● No Ethernet switch is required for one-to-one communications; an Ethernet switch is required for more than two devices in a network. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 554: Configuring Logical Network Connections Between Two Devices

    PROFINET box on the second device. Release the mouse button and your PROFINET connection is joined. Refer to "Device Configuration: Creating a network connection" (Page 149) for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 555: Configuring The Local/Partner Connection Path Between Two Devices

    To begin, you insert the instruction into the program from the "Communications" folder in the "Instructions" task card. The TSEND_C instruction is displayed, along with the Call options dialog where you assign a DB for storing the parameters of the instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 556 To begin, insert the instruction into the program from the "Communications" folder in the "Instructions" task card. The TRCV_C instruction is displayed, along with the Call options dialog where you assign a DB for storing the parameters of the instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 557 Configuring the General parameters You specify the parameters in the Properties configuration dialog of the TRCV_C instruction. This dialog appears near the bottom of the page whenever you have selected any part of the TRCV_C instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 558: Configuring A Cpu And Profinet Io Device

    1. Right-click the "Not assigned" link on the device and select "Assign new IO controller" from the context menu to display the "Select IO controller" dialog. 2. Select your S7-1200 CPU (in this example, "PLC_1") from the list of IO controllers in the project.
  • Page 559: Assigning Cpus And Device Names

    ● After you have configured your CPU or network device in your project, you can configure parameters for the PROFINET interface, to include its IP address. Refer to "Configuring an IP address for a CPU in your project" (Page 159) for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 560: Configuring The Io Cycle Time

    This option ensures that the update time is not set to less than the send clock. Table 10- 27 Configuring the ET200S PROFINET IO cycle time ET200 S PROFINET IO device ET200S PROFINET IO cycle dialog ① PROFINET port S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 561: Configuring A Cpu And Profinet Idevice

    PROFINET IO interface to the CPU of a higher-level station. "I-device" naming conventions In the remainder of this description, a CPU or a CP with I-device functionality is simply called an "I-device". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 562: Properties And Advantages Of The I-Device

    ● Lower communications load by processing process data locally. ● Manageable, due to processing of subtasks in separate STEP 7 projects 10.2.7.3 Characteristics of an I-device An I-device is included in an IO system like a standard IO device. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 563 The lower-level IO system can, in turn, contain I-devices (see figure below). This makes hierarchically structured IO systems possible. In addition to its role as IO controller, an I-device can also be used through a PROFIBUS interface as DP master for a lower-level PROFIBUS system. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 564 The I-device as IO device and IO controller is explained based on the example of a print process. The I-device controls a unit (a subprocess). One unit is used, for example, to insert additional sheets such as flyers or brochures in a package of printed material. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 565: Data Exchange Between Higher- And Lower-Level Io System

    "Configuring the I-device". The next figure shows the data exchange between the higher- and lower-level IO system. The individual communication relations are explained below based upon the numbers: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 566 In this way, the user program and the transfer area exchange input and output data. ④ Data exchange between the user program and the I/O of the I-device In this way, the user program and the centralized / distributed I/O exchange input and output data. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 567: Configuring The I-Device

    5. Now you have the option of choosing the IO controller in the "Assigned IO controller" drop-down list. Once you have chosen the IO controller, the networking and the IO system between both devices are displayed in the network view. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 568 Assign a name for the I-device proxy as well as a description in the fields provided. Click the "Export" button to complete your process. Finally, import the GSD file, for example, in another project. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 569: Diagnostics

    The S7-1200 is connected to a PROFIBUS network as a DP slave with the CM 1242-5 communication module. The CM 1242-5 (DP slave) module can be the communications partner of DP V0/V1 masters.
  • Page 570 DP V0/V1 slaves. In the figure below, the S7-1200 is a master controlling an ET200S DP slave: If a CM 1242-5 and a CM 1243-5 are installed together, an S7-1200 can perform as both a slave of a higher-level DP master system and a master of a lower-level DP slave system, simultaneously: For V4.0, you can configure a maximum of three PROFIBUS CMs per station, in which there...
  • Page 571: Communications Services Of The Profibus Cms

    PG and the transfer of diagnostics data to a PG. Possible communications partners for OP communication are HMI panels, SIMATIC panel PCs with WinCC flexible or SCADA systems that support S7 communication. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 572: Reference To The Profibus Cm User Manuals

    Further information You can find detailed information on the PROFIBUS CMs in the manuals for the devices. You can find these on the Internet in the pages of Siemens Industrial Automation Customer Support under the following entry IDs: ● CM 1242-5 (http://support.automation.siemens.com/WW/view/en/49852105) ●...
  • Page 573: Configuring Logical Network Connections Between Two Profibus Devices

    (PROFIBUS) box on the first device. Drag a line to the PROFIBUS box on the second device. Release the mouse button and your PROFIBUS connection is joined. Refer to "Device Configuration: Creating a network connection" (Page 149) for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 574: Assigning Profibus Addresses To The Cm 1243-5 Module And Dp Slave

    ● Address 0: Reserved for network configuration and/or programming tools attached to the ● Address 1: Reserved by Siemens for the first master ● Address 126: Reserved for devices from the factory that do not have a switch setting and must be re-addressed through the network ●...
  • Page 575: Distributed I/O Instructions

    I/O instructions with these communication networks. 10.3.5 Diagnostic instructions Refer to the "Diagnostics (PROFINET or PROFIBUS)": "Diagnostics instructions" (Page 345) for information on how to use these instructions with these communication networks. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 576: Diagnostic Events For Distributed

    10.4 AS-i The S7-1200 AS-i master CM 1243-2 allows the attachment of an AS-i network to an S7- 1200 CPU. The actuator/sensor interface, or AS-i, is a single master network connection system for the lowest level in automation systems. The CM 1243-2 serves as the AS-i master for the network.
  • Page 577: Configuring An As-I Master And Slave Device

    10.4.1 Configuring an AS-i master and slave device The AS-i master CM 1243-2 is integrated into the S7-1200 automation system as a communication module. You can find detailed information on the AS-i master CM 1243-2 in the "AS-i master CM 1243-2 and AS-i data decoupling unit DCM 1271 for SIMATIC S7-1200"...
  • Page 578: Configuring Logical Network Connections Between Two As-I Devices

    Address area for the slave I/O addresses AS-i interface (X1) Assigned AS-i network Note "Diagnostic interrupt for faults in the AS-i configuration" and "Automatic address programming" are always active and are therefore shown in gray. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 579: Assigning An As-I Address To An As-I Slave

    Any address in the range of 1 - 31 can be assigned to an AS-i slave device; in other words, it does not matter whether the slaves begin with address 21 or whether the first slave is actually given the address 1. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 580 ② AS-i slave address 2A; Device: AS-i 8WD44, 3DO, A/B; order number: 8WD4 428-0BD ③ AS-i slave address 3; Device: AS-i SM-U, 2DI/2DO; order number: 3RG9 001-0AC00 Enter the AS-i slave address here: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 581 Name of the network to which the device is connected Address(es) Assigned AS-i address for the slave device in range of 1(A or B) to 31(A or B) for a total of up to 62 slave devices S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 582: Exchanging Data Between The User Program And As-I Slaves

    "ACTUAL > EXPECTED". Further information You can find detailed information on the AS-i master CM 1243-2 in the "AS-i master CM 1243-2 and AS-i data decoupling unit DCM 1271 for SIMATIC S7-1200" Manual (http://support.automation.siemens.com/WW/view/en/50414115/133300). S7-1200 Programmable controller...
  • Page 583: Configuring Slaves With Step 7

    The digital input module (AS-i SM-U, 4DI) in the AS-i network above has been assigned slave address 1. By clicking on the digital input module, the "AS interface" tab in the device "Properties" displays the slave address, as shown below: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 584 (Page 582) ("ACTUAL -> EXPECTED") will be overwritten. Further information You can find detailed information on the AS-i master CM 1243-2 in the "AS-i master CM 1243-2 and AS-i data decoupling unit DCM 1271 for SIMATIC S7-1200" Manual (http://support.automation.siemens.com/WW/view/en/50414115/133300). S7-1200 Programmable controller...
  • Page 585: Distributed I/O Instructions

    – You cannot change AS-i slave device and CPU I/O addresses. – The green "CM" LED is OFF. ● Configuration mode: – You can make required changes in your AS-i slave device and CPU I/O addresses. – The green "CM" LED is ON. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 586 When the yellow "CER" LED is ON, there is an error in the AS-i slave device configuration. Select the "ACTUAL > EXPECTED" button to overwrite the AS-i master CM1243-2 module slave device configuration with the AS-i field network slave device configuration. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 587: S7 Communication

    PUT/GET communication" function is activated for the partner CPU in the "Protection" property of the local CPU properties: ● Accessing data in a remote CPU: An S7-1200 CPU can only use absolute addresses in the ADDR_x input field to address variables of remote CPUs (S7-200/300/400/1200).
  • Page 588 0: request has not yet started or is still running • 1: task was completed successfully • DONE (PUT) Output Bool DONE: 0: request has not yet started or is still running • 1: task was completed successfully • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 589 The sum of the number of bytes of each of your address and memory area parameters must be less than or equal to the defined limits. If you exceed these limits, the GET or PUT instruction returns an error. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 590 An instance DB was specified that does not belong to GET or PUT • No instance DB was specified, but rather a shared DB • No instance DB found (loading a new instance DB) • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 591: Creating An S7 Connection

    If you want to allow access to CPU data from the client side, that is, you do not want to restrict the communication services of the CPU, refer to "Access protection for the S7-1200 CPU" (Page 190) for more information.
  • Page 592: Configuring The Local/Partner Connection Path Between Two Devices

    GET/PUT connection parameter assignment The GET/PUT instructions connection parameter assignment is a user aid for configuring CPU-to-CPU S7 communication connections. After inserting a GET or PUT block, the GET/PUT instructions connection parameter assignment is started: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 593: Connection Parameters

    "ID". The page's content has information about the local endpoint and allows you to define the local interface. You can also define the partner end point. The "Block parameters" page allows you to configure the additional block parameters. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 594 This allows a two-way connection, and the "One-way" checkbox is unchecked. In a PROFIBUS GET/PUT connection, in some cases, the Partner device can only act as a server (for example, an S7-300), and the "One-way" checkbox is checked. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 595 GET/PUT communication. The user can create a completely new connection in this table. Click the button to the right of the "Connection name" field to start the "Connection overview" dialog. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 596: Configuring A Cpu-To-Cpu S7 Connection

    Given the configuration of PLC_1, PLC_2, and PLC_3 as shown in the figure below, insert GET or PUT blocks for "PLC_1". For the GET or PUT instruction, the "Properties" tab is automatically displayed in the inspector window with the following menu selections: ● "Configuration" ● "Connection parameters" S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 597 "Partner Address" contains the Partner IP address; control is read only. Connection ID "Connection ID" contains "100". In the Program editor, in the Main [OB1], the GET/PUT block "Connection ID" value also contains "100". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 598 One-way Read-only and unchecked. Note: "PLC_1" (an S7-1200 CPU 1214CDC/DC/Rly) and "PLC_3" (an S7-300 CPU 319-3PN/DP) can both act as a server and a client in a PROFINET GET/PUT connection, allowing a two-way connection. The GET/PUT icon in the Property View tree also changes from red to green.
  • Page 599 "Partner Address" contains the Partner IP address; control is read only. Connection ID "Connection ID" contains "100". In the Program editor, in the Main [OB1], the GET/PUT block "Connection ID" value also contains "100". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 600 The GET/PUT icon in the Property View tree also changes from red to green. Completed PROFIBUS S7 connection In the "Network view", a one-way S7 connection is shown in the "Connections" table between "PLC_1" and "PLC_3". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 601: Web Server

    Web server The Web server for the S7-1200 provides Web page access to data about your CPU and process data. You can access the S7-1200 Web pages from a PC or from a mobile device. The Web server displays the pages in a format and size compatible with the device you use to access the Web pages.
  • Page 602 Web server Note S7-1200 V4.0 CPUs do not include a separate firmware update standard Web page. The firmware update feature is included in the module information page. User-defined Web pages The S7-1200 also provides support for you to create user-defined Web pages that can access CPU data.
  • Page 603: Enabling The Web Server

    • Perform error-checking and range-checking on your variables in your program logic because Web page users can change PLC variables to invalid values. • Use a secure Virtual Private Network (VPN) to connect to the S7-1200 PLC Web server from a location outside your protected network.
  • Page 604: Configuring Web Server Users

    4. Enter user names, access levels, and passwords for the user logins that you want to provide. After you download the configuration to the CPU, only authorized users can access Web server functions for which they have privileges. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 605 • Perform error-checking and range-checking on your variables in your program logic because Web page users can change PLC variables to invalid values. • Use a secure Virtual Private Network (VPN) to connect to the S7-1200 PLC Web server from a location outside your protected network.
  • Page 606: Accessing The Web Pages From A Pc

    11.3 Accessing the Web pages from a PC You can access the S7-1200 standard Web pages from a PC or from a mobile device. To access the S7-1200 standard Web pages from a PC, follow these steps: 1. Ensure that the S7-1200 and the PC are on a common Ethernet network or are connected directly to each other with a standard Ethernet cable.
  • Page 607: Accessing The Web Pages From A Mobile Device

    Accessing the Web pages from a mobile device To access an S7-1200 from a mobile device, you must connect your PLC to a network that connects to the Internet or to a local wireless access point. Use a secure Virtual Private Network (VPN) to connect a mobile device to the S7-1200 PLC Web server.
  • Page 608 Accessing the Web pages from a PC (Page 606). Note that if you choose you can configure the PLC in STEP 7 (Page 603) to be accessible only by secure access (https). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 609: Standard Web Pages

    Print icon: prepares and displays a printable version of the information available from the displayed page ⑥ Navigation area to switch to another page ⑦ Content area for specific standard Web page that you are viewing. This example is the CPU Identification page. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 610: Logging In And User Privileges

    ● Read tag status ● Write tag status ● Open user-defined pages ● Write in user-defined pages ● Read files ● Write/delete files ● Change operating mode ● Flash LEDs ● Perform firmware update S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 611 Home page. To log in, follow these steps: 1. Enter the user name for the Username field. 2. Enter the user password in the Password field. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 612 Web page users can change PLC variables to invalid values. If you encounter any errors logging in, return to the Introduction page (Page 613) and download the Siemens security certificate (Page 666). You can then log in with no errors. Logging out To log out, simply click the "Logout"...
  • Page 613: Introduction

    The Introduction page is the welcome screen for entry into the S7-1200 standard Web pages. From this page, you click "Enter" to access the S7-1200 standard Web pages. At the top of the screen are links to useful Siemens Web sites, as well as a link to download the Siemens security certificate (Page 666).
  • Page 614: Start

    CPU. You can also use the buttons to change the operating mode of the CPU and flash the LEDs, if you have logged in (Page 610) with those specific privileges. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 615: Identification

    ● Order number ● Version information Viewing the Identification page requires the "query diagnostics" privilege. By default the "Everybody" user has this privilege with no login. See also Configuring Web server users (Page 604) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 616: Diagnostic Buffer

    Viewing the Module Information page requires the "query diagnostics" privilege (Page 604). By default the "Everybody" user has this privilege with no login. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 617 If you drill down to the CPU, the module information displays the name of the digital and analog inputs and outputs that the CPU model provides (for example, "DI14/DO10", "AI2"), addressing information for the I/O, status indicators, slot numbers, and comments. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 618 Filter link. The list updates to show you modules that correspond to your filtering criteria. Module information: Identification tab The identification tab displays the serial number and version numbers of the selected module. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 619 CPU or other modules that support firmware update. Note You can only update S7-1200 CPUs of version 3.0 and higher with the Update Firmware feature. The Web server uses the "https" protocol to perform the firmware update.
  • Page 620: Communication

    "Go" button beside a value to write that value to the CPU. You can also enter multiple values and click "Modify All Values" to write all of the values to the CPU. The buttons and column labels for modifying only appear if you have the "write variable status" privilege. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 621 For example, enter -1.0e8 rather than -1e8. • The Variable Status page supports only 15 digits for an LReal value (regardless of the location of the decimal point). Entering more than 15 digits creates a rounding error. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 622: File Browser

    "write/delete files" privileges. Click a folder to access the individual files in the folder. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 623 Time stamps for data logs The Web server displays the time stamps for the data logs in either UTC time or PLC local time depending upon your selection at the top of the page. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 624 You see no other indication that it is an incomplete file. To be sure you upload the complete file, remain on the File Browser page until the displayed file size reaches the actual size of the file. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 625: User-Defined Web Pages

    (Page 374) recipes, see the Recipes and Data logs (Page 369) chapter. 11.6 User-defined Web pages The S7-1200 Web server also provides the means for you to create your own application- specific HTML pages that incorporate data from the PLC. WARNING...
  • Page 626: Creating Html Pages

    This process is illustrated below: ① HTML files with embedded AWP commands See also Industrial Security Web site (http://www.siemens.com/industrialsecurity) 11.6.1 Creating HTML pages You can use the software package of your choice to create your own HTML pages for use with the Web server.
  • Page 627: Awp Commands Supported By The S7-1200 Web Server

    Web server 11.6 User-defined Web pages To program your HTML code to use data from the S7-1200, you include AWP commands (Page 627) as HTML comments. When finished, save your HTML pages to your PC and note the folder path where you save them.
  • Page 628 HTML form. Reading special variables Writing special variables Defining enum types Referencing enum types S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 629: Reading Variables

    If a tag name or data block name includes special characters, you must use additional quotation marks or escape characters as described in the topic Handling tag names that contain special characters (Page 639). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 630: Writing Variables

    The data block name is within the double quotes but not the data block tag name. Note that for data block tags, you use the name of the block and not a data block number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 631: Reading Special Variables

    HTTP response header. You might, for example, want to read a pathname from a PLC tag to redirect the URL to another location using the HEADER:Location special variable. Syntax S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 632 Use clause is specified. Example: Reading a special variable with a Use clause In this example, the HTTP special variable "HEADER:Status" receives the value of the PLC tag "Status". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 633: Writing Special Variables

    "SERVER:current_user_id" to the PLC tag named "SERVER:current_user_id ". In this example, the Web page writes the value of the HTTP special variable "SERVER:current_user_id" to the PLC tag named "my_userid". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 634: Using An Alias For A Variable Reference

    "Weight" throughout the rest of the user-defined Web page. <-- AWP_Out_Variable Name='Weight' Use='"Raw_Milk_Tank_Weight"' --> In this example, the value in the PLC tag "Raw_Milk_Tank_Weight" can be referenced simply by "Weight" throughout the rest of the user-defined Web page. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 635: Defining Enum Types

    CPU. Syntax S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 636 Because the enum type definition (Page 635) assigns "Tank is full" to the numerical value 1, the value 1 is written to the alias "Alarm" which corresponds to the PLC tag named "Motor1.Alarm" in data block "Data_Block_4" in the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 637: Creating Fragments

    (Page 639). Note Previous releases required a separate AWP_Enum_Ref declaration to associate a variable with a defined enum type. STEP 7 and the S7-1200 support existing code with AWP_Enum_Ref declarations; however, this command is no longer needed. 11.6.2.8...
  • Page 638: Importing Fragments

    When declaring variables for use in your user-defined Web pages, you can combine a variable declaration and an alias for the variable (Page 634). You can also declare multiple In_Variables in one statement and multiple Out_Variables in one statement. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 639: Handling Tag Names That Contain Special Characters

    Tag name Read command :=special_tag: :="T\\": :=another_special_tag: :=a_less_than_b: :="Data_block_1".Tag_1: Data_block_1 Tag_1 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 640 Use clauses follow the same conventions as Name clauses. Note Regardless of what characters you use in your HTML page, set the charset of the HTML page to UTF-8 and save it from the editor with UTF-8 character encoding. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 641: Configuring Use Of User-Defined Web Pages

    8. Specify filename extensions to be examined for the presence of AWP commands. By default, STEP 7 analyzes files with .htm, .html, or .js extensions. If you have additional file extensions, append them. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 642: Programming The Www Instruction For User-Defined Web Pages

    In this case, your program logic can control when to call the WWW instruction. Table 11- 3 WWW instruction LAD / FBD Description ret_val := WWW( Provides access to user-defined Web pages ctrl_db:=_uint_in_); from standard Web pages S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 643: Downloading The Program Blocks To The Cpu

    7 program just like any other program blocks. You follow the normal process to download the program blocks to the CPU. Note that you can only download user-defined Web page program blocks when the CPU is in STOP mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 644: Accessing The User-Defined Web

    Web pages. If you do not have a memory card installed, these blocks take up internal load memory space, which is limited according to your CPU model. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 645: Example Of A User-Defined Web Page

    Description In this application, each wind turbine in a wind turbine farm is equipped with an S7-1200 for control of the turbine. Within the STEP 7 program, each wind turbine has a data block with data specific to that wind turbine.
  • Page 646 This page also uses AWP commands for enum type definition (Page 635) and reference (Page 635) for handling ON/OFF settings. The first part of the page displays a header line that includes the wind turbine number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 647: Reading And Displaying Controller Data

    S7-1200. The following sections allow for manual control of the turbine, overriding the normal automatic control by the S7-1200. These types are as follows: • Manual override: enables manual override of the turbine. The STEP 7 user program...
  • Page 648: Using An Enum Type

    ManualOverrideEnable, it uses just a normal read variable command, but with the use of the previously declared and referenced enum type, the page displays "Off" or "On" rather than 0 or 1.

    Manual override: :="Data_block_1".ManualOverrideEnable:

    S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 649: Writing User Input To The Controller

    CPU that controls braking.

    Braking:

    %

    S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 650: Writing A Special Variable

    This test program simulates a Web page to monitor and control a Wind Turbine Required PLC tags and Data Block Tags in STEP 7: PLC Tag: User_ID: Int Data Blocks: Data_block_1 Tags in Data_Block_1: TurbineNumber: Int WindSpeed: Real WindDirection: Real S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 651

    Remote Wind Turbine Monitor: Turbine #:="Data_block_1".TurbineNumber:

    Wind speed:

    :="Data_block_1".WindSpeed: km/h

    Wind direction:

    :="Data_block_1".WindDirection: deg.

    S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 652

    Yaw override: :="Data_block_1".YawOverride:

    Set: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 653

    Braking:

    %

    S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 654: Configuration In Step 7 Of The Example Web Page

    Configuration in STEP 7 of the example Web page To include the "Remote Wind Turbine Monitor" HTML page as a user-defined Web page for the S7-1200, you configure the data about the HTML page in STEP 7 and create data blocks from the HTML page.
  • Page 655 ● Application name: This optional field contains the name that the Web browser includes in the address field when displaying the page. For this example, it is "Remote Wind Turbine Monitor", but you can use any name. No other fields require configuration. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 656: Setting Up User-Defined Web Pages In Multiple Languages

    WWW instruction (Page 642) with the number of the generated control DB as an input parameter, download the program blocks, and put the CPU in run mode. When an operator subsequently accesses the standard Web pages for the S7-1200 that controls the wind turbine, the "Remote Wind Turbine Monitor" Web page is accessible from the "User Pages"...
  • Page 657: Programming The Language Switch

    S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 658 Optionally, in the commented section, the page could set an expiration value for the cookie. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 659: Configuring Step 7 To Use A Multi-Language Page Structure

    For example, if the folder structure shown here was at C:\, the setting for HTML directory would be C:\html, and if English were to be the initial page display, you would navigate to en\langswitch.html for the default HTML page setting. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 660: Advanced User-Defined Web

    Block tag Data type Description initializing BOOL Web application is reading control DB error BOOL Web application could not be initialized deactivating BOOL Web application is terminating deactivated BOOL Web application is terminated S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 661 Send this fragment; page is complete - do not process any additional fragments // Request states The request states are read-only idle BOOL Nothing to do, but active waiting BOOL Fragment is waiting to be enabled S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 662 If the STEP 7 user program sets more than one request command, the WWW instruction processes only one in this order of precedence: abort, finish, repeat, continue. The WWW instruction clears all of the request commands after processing. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 663 Web page with this fragment can be displayed from the Web browser. Note that this is a simplified example; the fragment to check could be in any one of the four requesttab structs in the array. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 664: Constraints

    Web pages and user-defined Web pages with an URL of either http://ww.xx.yy.zz or https://ww.xx.yy.zz, where "ww.xx.yy.zz" represents the IP address of the CPU. ● Siemens provides a security certificate for secure access to the Web server. From the Introduction standard Web page (Page 613), you can download and import the certificate into the Internet options of your Web browser (Page 666).
  • Page 665: Feature Restrictions When The Internet Options Disable Javascript

    ● Selecting a display format does not automatically change the data value display to the selected format. You must click the "Monitor value" button to refresh the display with the new format. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 666: Feature Restrictions When The Internet Options Do Not Allow Cookies

    11.7.3 Importing the Siemens security certificate You can import the Siemens security certificate into your Internet options so that you won't be prompted for security verification when you enter https://ww.xx.yy.zz in your Web browser, where "ww.xx.yy.zz" is the IP address of the CPU. If you use an http:// URL and not an https:// URL, then you do not need to download and install the certificate.
  • Page 667: Importing Csv Format Data Logs To Non-Usa/Uk Versions Of Microsoft Excel

    Other browsers Follow the conventions of your Web browser to import and install the Siemens certificate. After you have installed the Siemens security certificate "S7-Controller Family" in the Internet options for your Web browser content, you will not be required to verify a security prompt when you access the Web server with https:// ww.xx.yy.zz.
  • Page 668 Web server 11.7 Constraints S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 669: Communication Processor And Modbus Tcp

    Install the CM to the left of the CPU or another CM. Install the CB on the front of the CPU. Refer to the "Installation" chapter in the S7-1200 System Manual (Page 62) for detailed instructions on module installation and removal.
  • Page 670: Biasing And Terminating An Rs485 Network Connector

    12.2 Biasing and terminating an RS485 network connector Siemens provides an RS485 network connector (Page 991) that you can use to easily connect multiple devices to an RS485 network. The connector has two sets of terminals that allow you to attach the incoming and outgoing network cables. The connector also includes switches for selectively biasing and terminating the network.
  • Page 671: Point-To-Point (Ptp) Communication

    UARTs to support a variety of baud rates and parity options. The RS232 and RS422/485 communication modules (CM 1241) and the RS485 communication board (CB 1241) provide the electrical interfaces for performing the PtP communications. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 672: Configuring The Communication Ports

    The parameter values can differ. For the CM 1241 RS422/485, you have additional options for port configuration as shown below. The 422 mode of the CM 1241 RS422/485 module also supports software flow control. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 673 Note Parameter values set from the PORT_CFG instruction in the user program override port configuration settings set from the device configuration. Note that the S7-1200 does not retain parameters set from the PORT_CFG instruction in the event of power down.
  • Page 674: Managing Flow Control

    DSR signal becomes active. The state of DSR is only evaluated at the start of the send operation. If DSR becomes inactive after transmission has started, the transmission will not be paused. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 675: Configuring The Transmit (Send) And Receive Parameters

    Parameter values set from the SEND_CFG instruction in the user program override the "Transmit message configuration" properties. Note that the CPU does not retain parameters set from the SEND_CFG instruction in the event of power down. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 676: Configuring Receive Parameters

    Parameter values set from the RCV_CFG instruction in the user program override the "Receive message configuration" properties. Note that the CPU does not retain parameters set from the RCV_CFG instruction in the event of power down. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 677 You can configure up to four specific character sequences. You use a multiple-sequence start condition when different sequences of characters can indicate the start of a message. If any one of the character sequences is matched, the message is started. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 678 After the CM or CB establishes that the start conditions have been met, it begins evaluating end conditions. Sample configuration - start message on one of two character sequences Consider the following start message condition configuration: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 679 40 bit times, and a maximum length of 50 bytes. The message will end if the message takes longer than 300 milliseconds to receive, or if the gap between any two characters exceeds 40 bit times, or if 50 bytes are received. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 680 You must configure another end condition to indicate the actual end of a message. ① Transmitted characters ② Received characters ③ First character must be successfully received by this time. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 681 1 to 4096. characters Note that for the S7-1200, this end condition is only valid for V4.0 CPUs or higher. Recognize message end by The message end occurs when the configured maximum number of characters has been max length received.
  • Page 682 The ending characters do not need to be contiguous. The "Length m" value can be used to specify the length of a checksum field whose size is not included in the length field. These fields appear in the Receive message configuration of the device properties: S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 683 The other six characters are counted in the length count; therefore the total number of characters following the length specifier is nine.) In this example, the characters from 5 to 10 inclusive are the characters counted by Len (n). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 684: Point-To-Point Instructions

    If none of the above bits are set, then the instruction returns • status results that describe the current state of the function. STATUS retains its value for the duration of the execution of the function. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 685 Transmission runtime 80Dx Used to define common transmission runtime errors Reception runtime 80Ex Used to define common reception runtime errors Signal handling 80Fx Used to define common errors associated with all signal handling S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 686: Port_Cfg (Configure Communication Parameters Dynamically) Instruction

    UInt Bits per character (Default value:): 1 = 8 data bits, 2 = 7 data bits STOPBITS UInt Stop bits (Default value: 0): 1 = 1 stop bit, 2 = 2 stop bits S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 687 Specific number of stop bits does not exist. 80A5 Specific type of flow control does not exist. 80A6 Wait time is 0 and flow control enabled 80A7 XON and XOFF are illegal values (for example, the same value) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 688: Send_Cfg (Configure Serial Transmission Parameters Dynamically) Instruction

    This parameter specifies that a break will be sent upon the start of each message for the specified number of bit times. The maximum is 65535 bit times up to an eight second maximum. A value of 0 disables the feature. (Default value: 12) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 689: Rcv_Cfg (Configure Serial Receive Parameters Dynamically) Instruction

    The RCV_CFG configuration changes are not permanently stored in the CPU. The parameters configured in the device configuration are restored when the CPU transitions from RUN to STOP mode and after a power cycle. See Configuring receive parameters (Page 675) for more information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 690 The number of bit times required for idle line timeout. (Default value: 40). Only used with an idle line condition. 0 to 65535 STARTCHAR Byte The start character used with the start character condition. (Default value: B#16#2) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 691 These errors result in no received message, because the start condition was not satisfied. Table 12- 16 Start conditions Start condition First Character First Character +1 First Character +2 First Character +3 First Character +4 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 692 It is an end condition only in the sense that it terminates a receiver operation because no response is received when a response is expected. You must select a separate end condition. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 693 Idle line timeout is enabled and it is zero. 80CB End sequence is enabled but all chars are "don't care". 80CC Start sequence (any one of 4) is enabled but all characters are "don't care". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 694: Send_Ptp (Transmit Send Buffer Data) Instruction

    When transmitting a complex structure, always use a length of 0. PTRCL Bool This parameter selects the buffer as normal point-to-point or specific Siemens- provided protocols that are implemented within the attached CM or CB. (Default value: False) FALSE = user program controlled point-to-point operations. (only valid option)
  • Page 695 Transmit aborted because of no DSR from the DCE device 80D3 Transmit aborted because of queue overflow (transmit more than 1024 bytes) 80D5 Reverse bias signal (wire break condition) 833A The DB for the BUFFER parameter does not exist. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 696 Otherwise, STATUS = 8088H, ERROR = 1, and no transmission occurs. String The LENGTH parameter contains the number of characters to be transmitted. Only the characters of the String are transmitted. The maximum and actual length bytes of the String are not transmitted. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 697: Rcv_Ptp (Enable Receive Messages) Instruction

    If more than one message is available in the CM or CB, the RCV_PTP instruction returns the oldest message available. A subsequent RCV_PTP instruction execution returns the next oldest message available. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 698: Rcv_Rst (Delete Receive Buffer) Instruction

    "hardware identifier". The port symbolic name is assigned in the "System constants" tab of the PLC tag table. (Default value: 0) DONE Bool When TRUE for one scan, indicates that the last request was completed without errors. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 699: Sgn_Get (Query Rs-232 Signals) Instruction

    REQ:=_bool_in_, communication signals. PORT:=_uint_in_, This function is valid only for the RS232 CM. NDR=>_bool_out_, ERROR=>_bool_out_, STATUS=>_word_out_, DTR=>_bool_out_, DSR=>_bool_out_, RTS=>_bool_out_, CTS=>_bool_out_, DCD=>_bool_out_, RING=>_bool_out_); STEP 7 automatically creates the DB when you insert the instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 700: Sgn_Set (Set Rs-232 Signals) Instruction

    SGN_SET sets the states of RS232 communication REQ:=_bool_in_, signals. PORT:=_uint_in_, This function is valid only for the RS232 CM. SIGNAL:=_byte_in_, RTS:=_bool_in_, DTR:=_bool_in_, DSR:=_bool_in_, DONE=>_bool_out_, ERROR=>_bool_out_, STATUS=>_word_out_); STEP 7 automatically creates the DB when you insert the instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 701 CM or CB is RS485 and no signals can be set 80F1 Signals cannot be set because of Hardware flow control 80F2 Cannot set DSR because module is DTE 80F3 Cannot set DTR because module is DCE S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 702: Programming The Ptp Communications

    ● RCV_PTP (Page 697) Additional instructions provide the capability to reset the receive buffer, and to get and set specific RS232 signals: ● RCV_RST (Page 698) ● SGN_GET (Page 699) ● SGN_SET (Page 700) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 703: Polling Architecture

    Communication processor and Modbus TCP 12.3 Point-to-point (PtP) communication 12.3.4.1 Polling architecture The STEP 7 user program must call the S7-1200 point-to-point instructions cyclically/periodically to check for received messages. Polling the send tells the user program when the transmit has completed. Polling architecture: master The typical sequence for a master is as follows: 1.
  • Page 704: Example: Point-To-Point Communication

    12.3.5 Example: Point-to-Point communication In this example, an S7-1200 CPU communicates to a PC with a terminal emulator through a CM 1241 RS232 module. The point-to-point configuration and STEP 7 program in this example illustrate how the CPU can receive a message from the PC and echo the message back to the PC.
  • Page 705: Configuring The Communication Module

    Refer to Configuring the RS422 and RS485 (Page 707). ● Transmit message configuration: Accept the default for transmit message configuration. No break is to be sent at message start. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 706 "don’t care" or unselected characters. The CM 1241 does not evaluate the "don’t care" characters but looks for a linefeed character preceded by zero or more "don’t care" characters to indicate the message end. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 707: Rs422 And Rs485 Operating Modes

    – Select none when you supply the bias and termination (Case 3). – Select forward bias to use internal bias and termination (Case 2). – Select reverse bias to use internal bias and termination, and enable cable break detection for the slaves (Case 1). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 708 ● Receive line initial state: no bias ● Cable break: No cable break detection (transmitter enabled only while transmitting) Bias and termination are added by the user at the end nodes of the network. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 709 – Select forward bias to use internal bias and termination (Case 4). Case 4: RS485: Forward bias ● Mode of operation: RS485 ● Receive line initial state: Forward bias (biased with R(B) > R(A) > 0 V) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 710: Programming The Step 7 Program

    Network 2: Use the NDR value (Tag_1 at M0.0) set by the RCV_PTP instruction to make a copy of the number of bytes received and to set a flag (Tag_8 at M20.0) to trigger the SEND_PTP instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 711: Configuring The Terminal Emulator

    4. Configure the terminal emulator ASCII setup to send a line feed after every line (after the user presses the Enter key). 5. Echo the characters locally so that the terminal emulator displays what is typed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 712: Running The Example Program

    RS485 connections to CM 1241 RS485 communication modules or a CB 1241 RS485 communication board. Up to three CM 1241 RS422/RS485 modules and one CB 1241 RS485 board can be installed in a S7-1200 CPU. Each RS485 port can operate up to sixteen drives.
  • Page 713: Requirements For Using The Uss Protocol

    FCs in the editor. Instead, you must assign the appropriate DB reference to the "USS_DB" input of these instructions. Double-click on the parameter field and then click on the parameter helper icon to see the available DB names). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 714 You may only call the USS_RPM and USS_WPM functions from a main program cycle OB. Calculating the time required for communicating with the drive Communications with the drive are asynchronous to the S7-1200 scan cycle. The S7-1200 typically completes several scans before one drive communications transaction is completed.
  • Page 715: Uss_Port (Edit Communication Via Uss Network) Instruction

    All USS functions associated with one USS network and PtP communication port must use the same instance DB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 716: Uss_Drv (Swap Data With Drive) Instruction

    STATUS8=>_word_out_); LAD and FBD: Expand the box to reveal all the parameters by clicking the bottom of the box. The parameter pins that are grayed are optional and parameter assignment is not required. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 717 Drive inhibited: This bit indicates the state of the inhibit bit on the drive. FAULT Bool Drive fault: This bit indicates that the drive has registered a fault. You must fix the problem and then set the F_ACK bit to clear this bit when set. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 718 Table 12- 39 Interaction of the SPEED_SP and DIR parameters SPEED_SP Drive rotation direction Value > 0 Reverse Value > 0 Forward Value < 0 Forward Value < 0 Reverse S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 719: Uss_Rpm (Readout Parameters From The Drive) Instruction

    This bit is set when USS_DRV sees the read response data from the drive. This bit is reset when either: you request the response data via another USS_RPM poll, or on the second of the next two calls to USS_DRV S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 720: Uss_Wpm (Change Parameters In The Drive) Instruction

    All USS functions associated with one USS PARAM:=_uint_in_, network and PtP communication port must use the same data block. INDEX:=_uint_in_, EEPROM:=_bool_in_, USS_WPM must be called from a main program cycle VALUE:=_variant_in_, DONE=>_bool_out_, ERROR=>_bool_out_, STATUS=>_word_out_, USS_DB:=_fbtref_inout_); S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 721 Immediately calling a USS_RPM or USS_WPM FC for the specified motor drive will result in a 0x818A error. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 722: Uss Status Codes

    818B, USS_Extended_Error contains the drive number where the communication error occurred. For STATUS code hexadecimal 818C, USS_Extended_Error contains a drive error code returned from the drive when using a USS_RPM or USS_WPM instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 723 STATUS code value is hexadecimal 818C. The error code value of "USS_Extended_Error" depends on the drive model. See the drive's manual for a description of the extended error codes for read and write parameter operations. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 724: General Drive Setup Information

    ● The RS485 network must be terminated properly. Connecting a MicroMaster drive This information about SIEMENS MicroMaster drives is provided as an example. For other drives, refer to the drive's manual for setup instructions. To make the connection to a MicroMaster Series 4 (MM4) drive, insert the ends of the RS485 cable into the two caged-clamp, screw-less terminals provided for USS operation.
  • Page 725 The terminal block connections are labeled numerically. Using a PROFIBUS connector on the S7-1200 side, connect the A terminal of the cable to the drive terminal 15 (for an MM420) or terminal 30 (MM440). Connect the B terminal of B (P) A (N) the cable connector to terminal 14 (MM420) or terminal 29 (MM440).
  • Page 726 12.4 Universal serial interface (USS) communication Setting up the MM4 drive Before you connect a drive to the S7-1200, you must ensure that the drive has the following system parameters. Use the keypad on the drive to set the parameters: 1.
  • Page 727: Modbus Communication

    For security information and recommendations, please see our "Operational Guidelines for Industrial Security" (http://www.industry.siemens.com/topics/global/en/industrial- security/Documents/operational_guidelines_industrial_security_en.pdf) in the Siemens Service and Support site. Table 12- 45 Read data functions: Read remote I/O and program data Modbus function code...
  • Page 728 Modbus RTU uses a master/slave network where all communications are initiated by a single Master device and slaves can only respond to a master’s request. The master sends a request to one slave address and only that slave address responds to the command. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 729 ● MB_CLIENT: Make client-server TCP connection, send command message, receive response, and control the disconnection from the server ● MB_SERVER: Connect to a Modbus TCP client upon request, receive Modbus message, and send response S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 730: Modbus Tcp

    Modbus TCP server IP address: Octet 4 IP_PORT UInt Default value = 502: The IP port number of the server to which the client will attempt to connect and ultimately communicate using the TCP/IP protocol. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 731 As a result, it is important that the inputs are not changed during the period of time that a MB_CLIENT operation is actively being processed. If this rule is not followed, then a MB_CLIENT cannot determine that it is the active instance. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 732 Both the MB_DATA_ADDR and MB_DATA_LEN parameters of MB_CLIENT are ignored for this function. Check server status using data diagnostic code 0x0000 (Loopback test – server echoes the request) 1 word per request S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 733 – The 1-bit Bool data type represents one Modbus bit address – 16-bit single word data types like WORD, UInt, and Int represent one Modbus word address – 32-bit double word data types like DWORD, DInt, and Real represent two Modbus word addresses S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 734 ACTIVE. This can occur, for example, when a client request has been issued and then application stops executing the client function before it has completely finished the request. The maximum S7-1200 limit is 55 seconds. MB_Unit_ID Word Modbus unit identifier: A Modbus TCP server is addressed using its IP address.
  • Page 735 Pointer to a optimized DATA_PTR area (must be a standard DB area or M memory area) 8200 The port is busy processing an existing Modbus request. 8380 Received Modbus frame is malformed or too few bytes have been received. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 736: Mb_Server (Communicate Via Profinet As Modbus Tcp Server) Instruction

    LAD / FBD Description "MB_SERVER_DB"( MB_SERVER communicates as a DISCONNECT:=_bool_in_, Modbus TCP server through the CONNECT_ID:=_uint_in_, PROFINET connector on the S7-1200 CPU. No additional communication IP_PORT:=_uint_in_, hardware module is required. NDR=>_bool_out_, DR=>_bool_out_, MB_SERVER can accept a request to connect with Modbus TCP client, receive ERROR=>_bool_out_,...
  • Page 737 MB_SERVER allows incoming Modbus function codes (1, 2, 4, 5, and 15) to read or write bits and words directly in the input process image and output process image of the S7-1200 CPU. For data transfer function codes (3, 6, and 16), the MB_HOLD_REG parameter must be defined as a data type larger than a byte.
  • Page 738 The Connection ID must be unique for each individual connection. This means a single, unique Connection ID must only be used with each individual instance DB. In summary, the instance DB and the Connection ID are paired together and must be unique for every connection. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 739 For example, if the holding register is configured to start at MW100 and is 100 words long. An offset of 20 specifies a beginning holding register address of 40021 instead of 40001. Any address below 40021 and above 40119 will result in an addressing error. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 740 DB name: 1. Set the cursor in the parameter field and type an m character. 2. Select "MB_SERVER_DB" from the drop- list of DB names. 3. Select "MB_SERVER_DB.HR_Start_Offset" from the drop-list of DB variables. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 741 Invalid pointer to MB_HOLD_REG: area is too small 818C Pointer to an optimized MB_HOLD_REG area (must be a standard DB area or M memory area) or Blocked process timeout exceeds the limit of 55 seconds. (S7-1200 specific) 8381 Function code not supported...
  • Page 742: Mb_Server Example: Multiple Tcp Connections

    You can have multiple Modbus TCP server connections. To accomplish this, MB_SERVER must be independently executed for each connection. Each connection must use an independent instance DB, connection ID, and IP port. The S7-1200 allows only one connection per IP port.
  • Page 743: Mb_Client Example 1: Multiple Requests With Common Tcp Connection

    The example shows both clients writing to the same memory area. Also, a returned error is captured which is optional. Network 1: Modbus function 1 - Read 16 output image bits Network 2: Modbus function 2 - Read 32 input image bits S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 744: Mb_Client Example 2: Multiple Requests With Different Tcp Connections

    The example shows both clients writing to the same memory area. Also, a returned error is captured which is optional. Network 1: Modbus function 4 - Read input words (in S7-1200 memory) Network 2: Modbus function 3 - Read holding register words from a Modbus TCP server S7-1200 Programmable controller...
  • Page 745: Mb_Client Example 3: Output Image Write Request

    12.5 Modbus communication 12.5.2.6 MB_CLIENT example 3: Output image write request This example shows a Modbus client request to write the S7-1200 output image. Network 1: Modbus function 15 - Write S7-1200 output image bits 12.5.2.7 MB_CLIENT example 4: Coordinating multiple requests You must ensure that each individual Modbus TCP request finishes execution.
  • Page 746: Modbus Rtu

    Select a project tree Modbus FB instance, right-click, select "Properties", and select the "Information" page to see the Modbus instruction version number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 747: Mb_Comm_Load (Configure Port On The Ptp Module For Modbus Rtu) Instruction

    Flow control selection: 0 – (default) no flow control • 1 – Hardware flow control with RTS always ON (does not apply to • RS485 ports) 2 – Hardware flow control with RTS switched • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 748 An instance data block is assigned for MB_MASTER or MB_SLAVE when you place these instructions in your program. This instance data block is referenced when you specify the MB_DB parameter for the MB_COMM_LOAD instruction. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 749: Mb_Master (Communicate Via The Ptp Port As Modbus Master) Instruction

    MB_MASTER DATA_ADDR:=_udint_in_, instruction in your program. This MB_MASTER DATA_LEN:=_uint_in_, instance data block is used when you specify the DONE=>_bool_out_, MB_DB parameter for the MB_COMM_LOAD BUSY=>_bool_out_, instruction. ERROR=>_bool_out_, STATUS=>_word_out_, DATA_PTR:=_variant_inout_); S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 750 The ERROR bit is TRUE for one scan, after the last request was terminated with an error. The error code value at the STATUS parameter is valid only during the single scan where ERROR = TRUE. STATUS Word Execution condition code S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 751 If the same instance of MB_MASTER is executed again with REQ input = 1 before the completion of the current request, then no subsequent transmissions are made. However, when the request is completed, a new request is issued whenever MB_MASTER is executed again with REQ input = 1. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 752 Both the DATA_ADDR and DATA_LEN operands of MB_MASTER are ignored for this function. Check slave status using data diagnostic code 0x0000 (Loopback test – slave echoes the request) 1 word per request S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 753 ● There is no requirement that the DATA_PTR data areas be in the same global data block. You can create one data block with multiple areas for Modbus reads, one data block for Modbus writes, or one data block for each slave station. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 754 818C Invalid pointer for DATA_PTR or invalid Blocked_Proc_Timeout: The data area must be a DB (that allows both symbolic and direct access) or M memory. 8200 Port is busy processing a transmit request. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 755: Mb_Slave (Communicate Via The Ptp Port As Modubus Slave) Instruction

    Standard addressing range (1 to 247) V2.0: UInt Extended addressing range (0 to 65535) MB_HOLD_REG Variant Pointer to the Modbus Holding Register DB: The Modbus holding register can be M memory or a data block. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 756 MB_HOLD_REG parameter on the MB_SLAVE instruction. Note MB_HOLD_REG data block type A Modbus holding register data block must allow both direct (absolute) and symbolic addressing. When you create the data block the "Standard" access attribute must be selected. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 757 MW108 DB10.DBW8 MW128 DB10.DBW58 "Recipe".ingredient[5] Table 12- 77 Diagnostic functions S7-1200 MB_SLAVE Modbus diagnostic functions Codes Sub-function Description 0000H Return query data echo test: The MB_SLAVE will echo back to a Modbus master a word of data that is received.
  • Page 758 MB_SLAVE must be based on the particular parameters of your Modbus master. At a minimum, you should execute MB_SLAVE twice within the response timeout period of the Modbus master. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 759 HR_Start_Offset is a word value that specifies the starting address of the Modbus holding register and is stored in the MB_SLAVE instance data block. You can set this public static variable value by using the parameter helper drop-list, after MB_SLAVE is placed in your program. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 760 Byte 3 Byte 4 Byte 5 Byte 6 Request Slave address F code Start address Length of coils Valid Response Slave address F code Length Coil data Error response Slave address 0x81 E code S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 761 DATA_PTR area 8384 Data value error 8385 Data diagnostic code value not supported (function code 08) In addition to the MB_SLAVE errors listed above, errors can be returned from the underlying PtP communication instructions. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 762: Modbus Rtu Master Example Program

    Additional MB_MASTER instructions can be used in the program cycle OB to communicate with other slaves, or one MB_MASTER FB could be re-used to communicate with additional slaves. Network 2 Read 100 words from the slave holding register. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 763 Network 3 This is an optional network that just shows the values of the first 3 words once the read operation is done. Network 4 Write 64 bits to the output image register starting at slave address Q2.0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 764: Modbus Rtu Slave Example Program

    9600 baud for short messages (20 bytes or less in the request). Network 2 Check for Modbus master requests during each scan. The Modbus holding register is configured for 100 words starting at MW1000. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 765: Telecontrol And Teleservice With The Cp 1242-7

    Connection to a GSM network IP-based WAN communication via GPRS Using the CP 1242-7 communications processor, the S7-1200 can be connected to GSM networks. The CP 1242-7 allows WAN communication from remote stations with a control center and inter-station communication.
  • Page 766 ● For communication with or via a central control room, the control center requires a PC with Internet access. ● Apart from the station equipment, a remote S7-1200 station with a CP 1242-7 must meet the following requirements to be able to communicate via the GSM network: –...
  • Page 767: Applications Of The Cp 1242-7

    A TeleService connection can be established between an engineering station with STEP 7 and a remote S7-1200 station with a CP 1242-7 via the GSM network and the Internet. The connection runs from the engineering station via a telecontrol server or a TeleService gateway that acts as an intermediary forwarding frames and establishing the authorization.
  • Page 768: Other Properties Of The Cp

    The configuration data of the CP 1242-7 is stored on the local CPU. This allows simple replacement of the CP when necessary. You can insert up to three modules of the CP 1242-7 type per S7-1200. This, for example, allows redundant communications paths to be established.
  • Page 769: Accessories

    12.6 Telecontrol and TeleService with the CP 1242-7 Further information The CP 1242-7 manual contains detailed information. You will find this on the Internet on the pages of Siemens Industrial Automation Customer Support under the following entry ID: 45605894 (http://support.automation.siemens.com/WW/view/en/45605894) 12.6.4...
  • Page 770: Configuration Examples For Telecontrol

    Sending messages by SMS Figure 12-3 Sending messages by SMS from an S7-1200 station A SIMATIC S7-1200 with a CP 1242-7 can send messages by SMS to a mobile phone or a configured S7-1200 station. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 771 Figure 12-4 Communication between S7-1200 stations and a control center In telecontrol applications, SIMATIC S7-1200 stations with a CP 1242-7 communicate with a control center via the GSM network and the Internet. The "TELECONTROL SERVER BASIC" (TCSB) application is installed on the telecontrol server in the master station. This results in the following use cases: ●...
  • Page 772 In TeleService via GPRS, an engineering station on which STEP 7 is installed communicates via the GSM network and the Internet with the CP 1242-7 in the S7-1200. Since a firewall is normally closed for connection requests from the outside, a switching station between the remote station and the engineering station is required.
  • Page 773 TeleService via GPRS in a configuration with telecontrol server TeleService without a telecontrol server The connection runs via the TeleService gateway. The connection between the engineering station and the TeleService gateway can be local via a LAN or via the Internet. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 774 Communication processor and Modbus TCP 12.6 Telecontrol and TeleService with the CP 1242-7 Figure 12-7 TeleService via GPRS in a configuration with TeleService gateway S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 775: Teleservice Communication (Smtp Email)

    Irrelevant Irrelevant Job is in progress. The job was completed successfully. The job was terminated with an error. For the cause of the error, refer to the STATUS parameter. No job in progress S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 776 TO_S String Recipient addresses: STRING data with a maximum length of 240 characters String CC copy to recipient addresses (optional): STRING data with a maximum length of 240 characters S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 777 ISDN phone connection. USERNAME Static String Mail account user name: STRING data with a maximum length 180 characters. PASSWORD Static String Mail server password: STRING data with a maximum length 180 characters. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 778 Because of run-time mode and memory usage, a syntax check is not performed on the TM_MAIL TO_S:, CC: and FROM: data. If the format rules above are not followed exactly. The SMTP email server transaction will fail. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 779 If you use Microsoft Exchange as an internal mail server, then you can configure the server to allow SMTP access from the IP address assigned the S7-1200 PLC. Configure the Exchange management console: Server configuration > Hub transport > Receive connectors >...
  • Page 780 Another cause of this error could be an erroneous entry of the domain name after the "@" character in the TO_S or CC parameters. 8552 Operation aborted: Exceeded the allocated memory size; try again later. 8554 Transmission failed: Try again later. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 781 • More information on SMTP error codes can be found on the internet or in the error documentation for the mail server. You can also read the last error message from the mail server. The error message is stored in buffer1parameter of the instance DB for TM_MAIL. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 782 Teleservice communication (SMTP email) 13.1 TM_Mail (Send email) instruction S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 783: Online And Diagnostic Tools

    Power is off Startup, self-test, or firmware Flashing update (alternating yellow and green) Stop mode On (yellow) Run mode On (green) Remove the memory card On (yellow) Flashing Error On (either yellow or green) Flashing S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 784 Note "Unknown or incompatible version of CPU configuration" error Attempting to download an S7-1200 V3.0 program to an S7-1200 V4.0 CPU causes a CPU error, and the CPU displays a corresponding error message in the diagnostic buffer. If you reached this state by using an invalid version program transfer card (Page 127), then remove the card, perform a STOP to RUN transition, a memory reset (MRES) or cycle power.
  • Page 785 Not configured or update in progress Flashing green Module configured with no errors On (green) On (green) Error condition Flashing red I/O error (with diagnostics enabled) Flashing red I/O error (with diagnostics disabled) On (green) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 786: Going Online And Connecting To A Cpu

    Your programming device is now connected to the CPU. The orange color frames indicate an online connection. You can now use the Online & diagnostics tools from the Project tree and the Online tools task card. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 787: Assigning A Name To A Profinet Io Device Online

    STEP 7 project and, using the "Online & diagnostics" tool, to the PROFINET IO device configuration memory (for example, an ET200 S interface module configuration memory). If a name is missing or does not match in either location, the PROFINET IO data exchange mode will not run. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 788 3. In the list that is displayed, click the required PROFINET IO device, and click the "Assign name" button to write the name to the PROFINET IO device configuration memory. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 789: Setting The Ip Address And Time Of Day

    IP address) or has been reset to factory settings. 14.5 Resetting to factory settings You can reset an S7-1200 to its original factory settings under the following conditions: ● No memory card is inserted in the CPU. ● The CPU has an online connection.
  • Page 790 ● The diagnostics buffer is cleared. ● The time of day is reset. ● The IP address is retained or deleted based on the setting you made. (The MAC address is fixed and is never changed.) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 791: Updating Firmware

    You can also perform a firmware update by one of the following additional methods: ● Using a memory card (Page 133) ● Using the Web server "Module Information" standard Web page (Page 616) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 792: Cpu Operator Panel For The Online Cpu

    You can monitor the cycle time and memory usage of an online CPU. After connecting to the online CPU, open the Online tools task card to view the following measurements: • Cycle time • Memory usage S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 793: Displaying Diagnostic Events In The Cpu

    Resetting the CPU to the factory settings resets the diagnostic buffer by deleting the entries. You can also use the GET_DIAG instruction (Page 358) to collect the diagnostic information. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 794: Comparing Offline And Online Cpus

    "Start detailed comparison" button to show the code blocks side-by-side. The detailed comparison highlights the differences between the code blocks of online CPU and the code blocks of the CPU in your project. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 795: Monitoring And Modifying Values In The Cpu

    Always exercise caution when using control functions. These functions can seriously influence the execution of the user/system program. Table 14- 3 Online capabilities of the STEP 7 editors Editor Monitor Modify Force Watch table Force table Program editor Tag table DB editor S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 796: Going Online To Monitor The Values In The Cpu

    To monitor the execution of the user program and to display the values of the tags, click the "Monitor all" button in the toolbar. The "Monitor value" field shows the value for each tag. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 797: Displaying Status In The Program Editor

    – Right-click the selected value to display the context menu. – Select the "Copy" command. 5. Paste the copied value into the corresponding "Start value" column for the tag. (Right- click the cell and select "Paste" from the context menu.) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 798: Using A Watch Table To Monitor And Modify Values In The Cpu

    • Monitor now: This command starts the monitoring of the visible tags in the active watch table. The watch table monitors the tags immediately and once only. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 799: Using A Trigger When Monitoring Or Modifying Plc Tags

    Once: Collects the data once at the end of the scan cycle, before the CPU writes the outputs At transition to Permanent: Continuously collects data when the CPU transitions to STOP STOP Once: Collects the data once after the CPU transitions to STOP S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 800: Enabling Outputs In Stop Mode

    Setting the CPU to RUN mode disables "Enable peripheral outputs" option. If any inputs or outputs are forced, the CPU is not allowed to enable outputs while in STOP mode. The force function must first be cancelled. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 801: Forcing Values In The Cpu

    To clear these forced elements, you must use STEP 7 to connect with the online CPU and then use the force table to turn off or stop the force function for those elements. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 802: Operation Of The Force Function

    (PTO) devices are assigned during device configuration. When digital I/O point addresses are assigned to these devices, the values of the assigned I/O point addresses cannot be modified by the force function of the force table. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 803: Downloading In Run Mode

    Only authorized personnel who understand the effects of RUN mode changes on system operation should perform a download in RUN mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 804: Prerequisites For "Download In Run Mode

    RUN mode. (Page 808) ● Your program must compile successfully. ● You must have successfully established communication between the programming device where you are running STEP 7 and the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 805: Changing Your Program In Run Mode

    If the program compiles successfully, STEP 7 starts to download the program to the CPU. 2. When STEP 7 prompts you to load your program or cancel the operation, click "Load" to download the program to the CPU. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 806: Downloading Selected Blocks

    Note You can download a maximum number of twenty blocks in RUN mode at one time. If you must download more than twenty blocks, you must place the CPU in STOP mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 807: Downloading A Single Selected Block With A Compile Error In Another Block

    Downloading a single selected block with a compile error in another block If you attempt a consistent download with a compile error in another block, then the dialog indicates an error, and the load button is disabled. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 808: Modifying And Downloading Existing Blocks In Run Mode

    The CPU retains the values of the existing data block tags and initializes the newly-added tags to their start values. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 809 RUN mode. You can only add retentive block tags up to the retentive memory reserve in order to be able to download them in RUN mode. When you download the extended retentive block tags, the tags contain their current values. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 810 The ability to modify blocks and download them in RUN mode is new with V4.0 of the S7-1200 CPU. Prior to V4.0, you could only download modified blocks in STOP mode. ● You cannot download more new block tags in RUN mode than the memory reserve can accommodate.
  • Page 811: System Reaction If The Download Process Fails

    STOP to RUN mode. The first scan bit is set only by the transition to RUN mode and is not affected by a download in RUN mode. ● The current values of data blocks (DB) and/or tags can be overwritten. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 812 In all cases the RLO output from the instruction will be false when the error occurs. The error is temporary. If it occurs, the instruction should be retried later. Note You must not retry the operation in the current execution of the OB. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 813: Tracing And Recording Cpu Data On Trigger Conditions

    Use the tools in STEP 7 to analyze the data, display it graphically, and save it. Note that the trace feature is only available as of V4.0 of the S7-1200 CPU. See the STEP 7 information system for details about how to program a trace, how to download the configuration, upload the trace data, and display the data in the logic analyzer.
  • Page 814 Online and diagnostic tools 14.13 Tracing and recording CPU data on trigger conditions S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 815: Sm 1278 4Xio-Link Master

    The IO-Link master programs acyclic communication with an IO-Link device using the IOL_CALL function block (FB) in your STEP 7 S7-1200 controller program. The IOL_CALL FB indicates the IO-Link master your program uses, and which ports the master uses for data exchange.
  • Page 816: Properties

    ● Data transmission rate COM1 (4.8 kbaud), COM2 (38.4 kbaud), COM3 (230.4 kbaud) ● SIO mode (standard IO mode) ● Connection of up to four IO-Link devices (3-wire connection) or four standard actuators or standard encoders ● Programmable diagnostics function by port S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 817: Functions

    If you insert the SM 4xIO-Link Master with the load switched on, this can lead to dangerous conditions in your plant. Physical damage to the S7-1200 automation system may occur as a result. Remove or insert the SM 4xIO-Link Master only when the load is switched off.
  • Page 818: Reset Module To Factory Settings

    If you remove an SM 1278 4xIO-Link signal module, reset it to factory settings before you put it into storage. Procedure For "Reset to factory settings", proceed as described in the S7-PCT online help under "Master Configuration > 'Commands' tab". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 819: Connecting

    The following table contains illustrations of connection examples, where n = port number: IO-Link operating mode Operating mode DI Operating mode DQ Note Connected sensors must use the device supply provided by the Master module L connection. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 820: Block Diagram

    SM 1278 4xIO-Link Master 15.2 Connecting 15.2.2 Block diagram S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 821: Parameters/Address Space

    Configuration Configuring the SM 1278 4xIO-Link Master For the module integration, you need the Siemens engineering tool TIA Portal V12 or higher. You also need S7-PCT V3.2 or higher for the IO-Link integration. For commissioning, you require both an engineering tool and S7-PCT V3.2 or higher for parameter assignment.
  • Page 822: Address Space

    Transfer of the alterable parameters to the module. Error message The following return value is reported in the event of an error: Error code Meaning 80B1 Error in data length 80E0 Error in header information 80E1 Parameter error S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 823 0 = Diagnostics deactivated 1 = Diagnostics activated The following table shows the data record IOL properties: Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reserved S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 824: Interrupt, Error, And System Alarms

    SM 1278 4xIO-Link Master 15.4 Interrupt, error, and system alarms 15.4 Interrupt, error, and system alarms 15.4.1 Status and error display LED display S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 825 The following table explains the meaning of the status and error displays. You can find remedial measures for diagnostic alarms in the "Diagnostic alarms" section. LED DIAG DIAG Meaning Backplane bus supply of the S7-1200 not OK Module is not configured Flashes Module parameterized and no module diagnostics Module parameterized and module diagnostics...
  • Page 826: Diagnostic Alarms

    Incorrect device 1886 Storage error 6320 Device was not configured correctly 6321 6350 Supply 1806 L+ supply voltage for device missing voltage 1807 L+ supply voltage for device too low (<20 V) missing S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 827 Safety 1880 Serious error (master has to be replaced) shutdown External fault 1809 Error in data storage 180A 180B 180C 180D 1808 More than 6 errors are pending simultaneously on the IO-Link device S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 828 SM 1278 4xIO-Link Master 15.4 Interrupt, error, and system alarms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 829: Technical Specifications

    The test criteria for the S7-1200 automation system are based on these standards and test specifications. Note that not all S7-1200 models may be certified to these standards, and certification status may change without notification. It is your responsibility to determine applicable certifications by referring to the ratings marked on the product.
  • Page 830 ● Canadian Standards Association: CSA C22.2 Number 142 (Process Control Equipment) Note The SIMATIC S7-1200 series meets the CSA standard. The cULus logo indicates that the S7-1200 has been examined and certified by Underwriters Laboratories (UL) to standards UL 508 and CSA 22.2 No. 142. FM approval...
  • Page 831 The S7-1200 automation system satisfies requirements of standards to AS/NZS 2064 (Class A). Korea Certification The S7-1200 automation system satisfies the requirements of the Korean Certification (KC Mark). It has been defined as Class A Equipment and is intended for industrial applications and has not been considered for home use.
  • Page 832 Wiring systems subject to surges from lightning strike coupling must be equipped with external protection. One specification for evaluation of protection from lightning type surges is found in EN 61000-4-5, with operational limits established by EN 61000-6-2. S7-1200 DC CPUs and signal modules require external protection to maintain safe operation when subject to surge voltages defined by this standard.
  • Page 833 DIN rail mount: 3.5 mm from 5-9 Hz, 1G from 9 - 150 Hz Panel Mount: 7.0 mm from 5-9 Hz, 2G from 9 to 150 Hz 10 sweeps each axis, 1 octave per minute S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 834 85 VAC to 264 VAC, 47 to 63 Hz Note When a mechanical contact turns on output power to the S7-1200 CPU, or any digital signal module, it sends a "1" signal to the digital outputs for approximately 50 microseconds. This could cause unexpected machine or process operation which could result in death or serious injury to personnel and/or damage to equipment.
  • Page 835 Some of the 24 VDC power input ports in the S7-1200 system are interconnected, with a common logic circuit connecting multiple M terminals. For example, the following circuits are interconnected when designated as "not isolated"...
  • Page 836 Activating a digital input Possible Switching frequency Mechanical Max. 10 Hz At ohmic load Max. 1 Hz At inductive load (according to Max. 0.5 Hz IEC 947-5-1 DC13/AC15) At lamp load Max. 1Hz S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 837: Cpu 1211C

    HSC default address assignments (Page 411) 100/ 80 kHz (Ia.0 to Ia.5) Pulse outputs Up to 4 configured to use any built-in or SB outputs 100 kHz (Qa.0 to Qa.3) Pulse catch inputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 838: Timers, Counters And Code Blocks Supported By Cpu 1211C

    4 (1 per event) Cyclic interrupts 4 (1 per event) Hardware interrupts 50 (1 per event) Time error interrupts Diagnostic error interrupts Pull or plug of modules Rack or station failure Time of day Multiple Status S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 839 20 A at 264 VAC 12 A at 28.8 VDC 12 A at 28.8 VDC Isolation (input power to logic) 1500 VAC Not isolated Not isolated Ground leakage, AC line to functional 0.5 mA max. earth S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 840: Digital Inputs And Outputs

    (Logic 1 Level = 15 to 26 VDC) Number of inputs on simultaneously 6 at 60 °C horizontal, 50 °C vertical Cable length (meters) 500 m shielded, 300 m unshielded, 50 m shielded for HSC inputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 841 For CPU models with relay outputs, you must install a digital signal board (SB) to use the pulse outputs. Depending on your pulse receiver and cable, an additional load resistor (at least 10% of rated current) may improve pulse signal quality and noise immunity. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 842: Analog Inputs

    70 ms 200 ms Medium (16 cycles): 16 samples 200 ms 240 ms 1150 ms Strong (32 cycles): 32 samples 400 ms 480 ms 2300 ms Sample time 4.17 ms 5 ms 25 ms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 843: Sample Time For The Built-In Analog Ports Of The Cpu

    7FFF 11.851 V Overflow 32512 7F00 32511 7EFF 11.759 V Overshoot range 27649 6C01 27648 6C00 10 V Rated range 20736 5100 7.5 V 12 mV Negative values Negative values are not supported S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 844: Cpu 1211 Wiring Diagrams

    L+ / 24 VDC Sensor Out -- DQ a.2 M / 24 VDC Sensor Out DQ a.3 No connection DI a.0 No connection DI a.1 No connection DI a.2 DI a.3 DI a.4 DI a.5 No connection No connection S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 845 L+ / 24 VDC Sensor Out -- DQ a.2 M / 24 VDC Sensor Out DQ a.3 No connection DI a.0 No connection DI a.1 No connection DI a.2 DI a.3 DI a.4 DI a.5 No connection No connection S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 846 M / 24 VDC Sensor Out DQ a.2 DQ a.3 DI a.0 No connection DI a.1 No connection DI a.2 DI a.3 DI a.4 DI a.5 No connection No connection Note Unused analog inputs should be shorted. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 847: Cpu 1212C

    30 / 20 kHz (Ia.6 to Ia.7) • Pulse outputs Up to 4 configured to use any built-in or SB outputs 100 kHz (Qa.0 to Qa.3) • 30 kHz (Qa.4 to Qa.5) • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 848: Timers, Counters And Code Blocks Supported By Cpu 1212C

    4 (1 per event) Cyclic interrupts 4 (1 per event) Hardware interrupts 50 (1 per event) Time error interrupts Diagnostic error interrupts Pull or plug of modules Rack or station failure Time of day Multiple S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 849 20 A at 264 VAC 12 A at 28.8 VDC 12 A at 28.8 VDC Isolation (input power to logic) 1500 VAC Not isolated Not isolated Ground leakage, AC line to functional earth 0.5 mA max. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 850: Digital Inputs And Outputs

    4 (no adjacent points) at 60 °C horizontal or 50 °C vertical 8 at 55 °C horizontal or 45 °C vertical Cable length (meters) 500 m shielded, 300 m unshielded, 50 m shielded for HSC inputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 851 For CPU models with relay outputs, you must install a digital signal board (SB) to use the pulse outputs. Depending on your pulse receiver and cable, an additional load resistor (at least 10% of rated current) may improve pulse signal quality and noise immunity. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 852: Analog Inputs

    70 ms 200 ms Medium (16 cycles): 16 samples 200 ms 240 ms 1150 ms Strong (32 cycles): 32 samples 400 ms 480 ms 2300 ms Sample time 4.17 ms 5 ms 25 ms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 853: Sample Time For The Built-In Analog Ports Of The Cpu

    7FFF 11.851 V Overflow 32512 7F00 32511 7EFF 11.759 V Overshoot range 27649 6C01 27648 6C00 10 V Rated range 20736 5100 7.5 V 12 mV Negative values Negative values are not supported S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 854: Cpu 1212C Wiring Diagrams

    L+ / 24 VDC Sensor Out -- DQ a.2 M / 24 VDC Sensor Out DQ a.3 DI a.0 DQ a.4 DI a.1 DQ a.5 DI a.2 DI a.3 DI a.4 DI a.5 DI a.6 DI a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 855 L+ / 24 VDC Sensor Out -- DQ a.2 M / 24 VDC Sensor Out DQ a.3 DI a.0 DQ a.4 DI a.1 DQ a.5 DI a.2 DI a.3 DI a.4 DI a.5 DI a.6 DI a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 856 M / 24 VDC Sensor Out DQ a.2 DQ a.3 DI a.0 DQ a.4 DI a.1 DQ a.5 DI a.2 DI a.3 DI a.4 DI a.5 DI a.6 DI a.7 Note Unused analog inputs should be shorted. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 857: Cpu 1214C

    Up to 6 configured to use any built-in or SB inputs. See table, CPU1214C: HSC default address assignments (Page 411) 100/ 80 kHz (Ia.0 to Ia.5) • 20 kHz (Ia.6 to Ib.5) • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 858: Timers, Counters And Code Blocks Supported By Cpu 1214C

    Status of 2 code blocks can be monitored simultaneously Program cycle Multiple Startup Multiple Time-delay interrupts 4 (1 per event) Cyclic interrupts 4 (1 per event) Hardware interrupts 50 (1 per event) Time error interrupts Diagnostic error interrupts S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 859 CPU with all expansion 300 mA at 120 VAC 1500 mA at 24 VDC accessories 150 mA at 240 VAC Inrush current (max.) 20 A at 264 VAC 12 A at 28.8 VDC S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 860: Digital Inputs And Outputs

    7 (no adjacent points) at 60 °C horizontal or 50 °C vertical • 14 at 55 °C horizontal or 45 °C vertical • Cable length (meters) 500 m shielded, 300 m unshielded, 50 m shielded for HSC inputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 861 For CPU models with relay outputs, you must install a digital signal board (SB) to use the pulse outputs. Depending on your pulse receiver and cable, an additional load resistor (at least 10% of rated current) may improve pulse signal quality and noise immunity. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 862: Analog Inputs

    70 ms 200 ms Medium (16 cycles): 16 samples 200 ms 240 ms 1150 ms Strong (32 cycles): 32 samples 400 ms 480 ms 2300 ms Sample time 4.17 ms 5 ms 25 ms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 863: Sample Time For The Built-In Analog Ports Of The Cpu

    7FFF 11.851 V Overflow 32512 7F00 32511 7EFF 11.759 V Overshoot range 27649 6C01 27648 6C00 10 V Rated range 20736 5100 7.5 V 12 mV Negative values Negative values are not supported S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 864: Cpu 1214C Wiring Diagrams

    DQ a.3 DQ a.4 DI a.0 DI a.1 DQ a.5 DI a.2 DQ a.6 DI a.3 DQ a.7 DI a.4 DQ b.0 DI a.5 DQ b.1 DI a.6 DI a.7 DI b.0 DI b.1 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 865 M / 24 VDC Sensor Out DQ a.3 DQ a.4 DI a.0 DI a.1 DQ a.5 DI a.2 DQ a.6 DI a.3 DQ a.7 DI a.4 DQ b.0 DI a.5 DQ b.1 DI a.6 DI a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 866 M / 24 VDC Sensor Out DQ a.2 DQ a.3 DI a.0 DQ a.4 DI a.1 DQ a.5 DI a.2 DQ a.6 DI a.3 DQ a.7 DI a.4 DQ b.0 DI a.5 DQ b.1 DI a.6 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 867: Cpu 1215C

    (24 VDC) Table A- 67 CPU features Technical data Description User memory Work 100 Kbytes Load 4 Mbytes, internal, expandable up to SD card size Retentive 10 Kbytes On-board digital I/O 14 inputs/10 outputs S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 868 For CPU models with relay outputs, you must install a digital signal board (SB) to use the pulse outputs. Table A- 68 Performance Type of instruction Execution speed Boolean 0.08 μs/instruction Move Word 1.7 μs/instruction Real math 2.3 μs/instruction S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 869: Timers, Counters And Code Blocks Supported By Cpu 1215C

    Structure in DB, 16 bytes per timer Counters Type Quantity Limited only by memory size Storage Structure in DB, size dependent upon count type SInt, USInt: 3 bytes • Int, UInt: 6 bytes • DInt, UDInt: 12 bytes • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 870 L+ minus 4 VDC min. Output current rating (max.) 400 mA (short-circuit protected) Maximum ripple noise (<10 MHz) < 1 V peak to peak Same as input line Isolation (CPU logic to sensor power) Not isolated S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 871: Digital Inputs And Outputs

    1500 VAC for 1 minute (coil to contact) 500 VAC for 1 minute None (coil to logic) Isolation resistance 100 MΩ min. when new Isolation between open contacts 750 VAC for 1 minute S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 872: Analog Inputs And Outputs

    None, Weak, Medium, or Strong See the table for step response (ms) for the analog inputs of the CPU. Noise rejection 10, 50, or 60 Hz Impedance ≥100 KΩ Isolation (field side to logic) None S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 873: Step Response Of Built-In Analog Inputs Of The Cpu

    7FFF 11.851 V Overflow 32512 7F00 32511 7EFF 11.759 V Overshoot range 27649 6C01 27648 6C00 10 V Rated range 20736 5100 7.5 V 12 mV Negative values Negative values are not supported S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 874: Analog Output Specifications

    Negative values are not supported In an overflow condition, analog outputs will behave according to the device configuration properties settings. In the "Reaction to CPU STOP" parameter, select either: "Use substitute value" or "Keep last value". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 875: Cpu 1215C Wiring Diagrams

    DQ a.2 M / 24 VDC Sensor Out AI 0 DQ a.3 AI 1 DQ a.4 DI a.0 DI a.1 DQ a.5 DI a.2 DQ a.6 DI a.3 DQ a.7 DI a.4 DQ b.0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 876 For additional noise immunity, connect "M" to chassis ground even if not using sensor supply. ② For sinking inputs, connect "-" to "M" (shown). For sourcing inputs, connect "+" to "M". Note: X11 connectors must be gold. See Appendix C, Spare Parts for order number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 877 DQ a.5 DI a.2 DQ a.6 DI a.3 DQ a.7 DI a.4 DQ b.0 DI a.5 DQ b.1 DI a.6 DI a.7 DI b.0 DI b.1 DI b.2 DI b.3 DI b.4 DI b.5 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 878 DQ a.2 AI 1 DQ a.3 DI a.0 DQ a.4 DI a.1 DQ a.5 DI a.2 DQ a.6 DI a.3 DQ a.7 DI a.4 DQ b.0 DI a.5 DQ b.1 DI a.6 DI a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 879: Cpu 1217C

    On-board digital I/O 14 inputs/ 10 outputs On-board analog I/O 2 inputs/ 2 outputs Process image size 1024 bytes of inputs (I) / 1024 bytes of outputs (Q) Bit memory (M) 8192 bytes S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 880: Timers, Counters And Code Blocks Supported By Cpu 1217C

    Up to 1024 blocks total (OBs + FBs + FCs + DBs) Address range for FBs, FCs, FB and FC: 1 to 65535 (such as FB 1 to FB 65535) and DBs DB: 1 to 59999 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 881 • 8 for client GET/PUT (CPU-to-CPU) S7 communication • Data rates 10/100 Mb/s Isolation (external signal to PLC logic) Transformer isolated, 1500 VAC, for short term event safety only Cable type CAT5e shielded S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 882: Digital Inputs And Outputs

    500 VAC for 1 minute (functional isolation) Isolation groups Filter times us settings: 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 10.0, 12.8, 20.0 ms settings: 0.05, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 10.0, 12.8, 20.0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 883 Logic 0 signal with 10 KΩ load 0.1 VDC max. Current (max.) 0.5 A Lamp load ON state resistance 0.6 Ω max. Leakage current per point 10 μA max. Surge current 8 A for 100 ms max. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 884 Cable length (meters) 500 m shielded, 150 m unshielded Depending on your pulse receiver and cable, an additional load resistor (at least 10% of rated current) may improve pulse signal quality and noise immunity. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 885 High-speed counter input rate: 100 kHz max. DIa.6 Type: 24 V, source-sink Type 1 input High-speed counter input rate: 30 kHz max. DIa.7 Type: 24 V, source-sink Type 1 input High-speed counter input rate: 30 kHz max. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 886 DIb.4+ .4- Type: 1.5 V Differential input High-speed counter input rate: 1 MHz max. DIb.5+ .5- Type: 1.5 V Differential input High-speed counter input rate: 1 MHz max. 1.5 V Differential output detail S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 887: Analog Inputs And Outputs

    10 bits Maximum withstand voltage 35 VDC Smoothing None, Weak, Medium, or Strong See the table for step response (ms) for the analog inputs of the CPU. Noise rejection 10, 50, or 60 Hz S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 888: Step Response Of Built-In Analog Inputs Of The Cpu

    Table A- 100 Sample time for built-in analog inputs of the CPU Rejection frequency (Integration time selection) Sample time 60 Hz (16.6 ms) 4.17 ms 50 Hz (20 ms) 5 ms 10 Hz (100 ms) 25 ms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 889: Measurement Ranges Of The Analog Inputs For Voltage (Cpus)

    100 m, shielded twisted pair In an overflow condition, analog outputs will behave according to the device configuration properties settings. In the "Reaction to CPU STOP" parameter, select either: "Use substitute value" or "Keep last value". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 890 Negative values are not supported In an overflow condition, analog outputs will behave according to the device configuration properties settings. In the "Reaction to CPU STOP" parameter, select either: "Use substitute value" or "Keep last value". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 891: Cpu 1217C Wiring Diagrams

    DQ a.1- DI a.0 DI b.4+ DQ a.2+ DI a.1 DI b.4- DQ a.2- DI a.2 DI b.5+ DQ a.3+ DI a.3 DI b.5- DQ a.3- DI a.4 DI a.5 DI a.6 DQ a.4 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 892: Digital Signal Modules (Sms)

    15 VDC at 2.5 mA Logic 0 signal (max.) 5 VDC at 1 mA 5 VDC at 1 mA Isolation (field side to logic) 500 VAC for 1 minute 500 VAC for 1 minute Isolation groups S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 893 Table A- 109 Connector pin locations for SM 1221 DI 8 x 24 VDC (6ES7 221-1BF32-0XB0) No connection No connection No connection DI a.0 DI a.4 DI a.1 DI a.5 DI a.2 DI a.6 DI a.3 DI a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 894: Sm 1222 8-Point Digital Output Specifications

    0.2 Ω max. when new 0.6 Ω max. Leakage current per point 10 μA max. Surge current 7 A with contacts closed 7 A with contacts closed 8 A for 100 ms max. Overload protection S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 895: Sm 1222 16-Point Digital Output Specifications

    45 x 100 x 75 Weight 260 grams 220 grams Power dissipation 8.5 W 2.5 W Current consumption (SM Bus) 135 mA 140 mA Current consumption (24 VDC) 11 mA / Relay coil used 100 mA S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 896 8 (no adjacent points) at 60 °C • horizontal or 50 °C vertical 16 at 55 °C horizontal or 45 °C • vertical Cable length (meters) 500 m shielded, 150 m unshielded 500 m shielded, 150 m unshielded S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 897 Table A- 117 Connector pin locations for SM 1222 DQ 8 x 24 VDC (6ES7 222-1BF32-0XB0) L+ / 24 VDC No connection M / 24 VDC No connection Functional Earth No connection DQ a.0 DQ a.4 DQ a.1 DQ a.5 DQ a.2 DQ a.6 DQ a.2 DQ a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 898 DQ a.6X DQ a.0 DQ a.2 DQ a.4 DQ a.6 No connection No connection No connection No connection DQ a.1X DQ a.3X DQ a.5X DQ a.7X DQ a.1 DQ a.3 DQ a.5 DQ a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 899 No connection DQ a.0 DQ a.4 DQ b.0 DQ b.4 DQ a.1 DQ a.5 DQ b.1 DQ b.5 DQ a.2 DQ a.6 DQ b.2 DQ b.6 DQ a.3 DQ a.7 DQ b.3 DQ b.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 900: Sm 1223 Digital Input/Output Vdc Specifications

    Number of inputs on simultaneously 8 (no adjacent • points) at 60 °C horizontal or 50 °C vertical 16 at 55 °C • horizontal or 45 °C vertical Cable length (meters) 500 m shielded, 300 m unshielded S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 901 Number of outputs on simultaneously 8 8 (no adjacent • points) at 60 °C horizontal or 50 °C vertical 16 at 55 °C • horizontal or 45 °C vertical Cable length (meters) 500 m shielded, 150 m unshielded S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 902 No connection DI a.0 DI a.4 DQ a.0 DQ a.4 DI a.1 DI a.5 DQ a.1 DQ a.5 DI a.2 DI a.6 DQ a.2 DQ a.6 DI a.3 DI a.7 DQ a.3 DQ a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 903 SM 1223 DI 16 x 24 VDC, DQ 16 x 24 VDC Notes (6ES7 223-1BH32-0XB0) (6ES7 223-1BL32-0XB0) ① For sinking inputs, connect "-" to "M" (shown). For sourcing inputs, connect "+" to "M". S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 904: Sm 1223 Digital Input/Output Ac Specifications

    Dimensions W x H x D (mm) 45 x 100 x 75 mm Weight 190 grams Power dissipation 7.5 W Current consumption (SM Bus) 120 mA Current consumption (24 VDC) 11 mA per output when on S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 905 1500 VAC for 1 minute (coil to contact) None (coil to logic) Isolation resistance 100 MΩ min. when new Isolation between open contacts 750 VAC for 1 minute Isolation groups Current per common (max.) 10 A Inductive clamp voltage S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 906 No connection DI a.0 DI a.4 DQ a.0 DQ a.4 DI a.1 DI a.5 DQ a.1 DQ a.5 DI a.2 DI a.6 DQ a.2 DQ a.6 DI a.3 DI a.7 DQ a.3 DQ a.7 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 907: Analog Signal Modules (Sms)

    400, 60, 50, or 10 Hz Refer to the section on sample rates (Page 916). Input impedance ≥ 9 MΩ (voltage) / 280 Ω (current) ≥ 1 MΩ (voltage) / <315 Ω, >280 Ω (current) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 908 Table A- 140 Wiring diagrams for the analog input SMs SM 1231 AI 4 x 13 bit (6ES7 231-4HD32-0XB0) SM 1231 AI 8 x 13 bit (6ES7 231-4HF32-0XB0) Note: Connectors must be gold. See Appendix C, Spare Parts for order number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 909 AI 7- Table A- 143 Wiring diagram for the analog input SM SM 1231 AI 4 x 16 bit (6ES7 231-5ND30-0XB0) Note: Connectors must be gold. See Appendix C, Spare Parts for order number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 910: Sm 1232 Analog Output Module Specifications

    ±10 V, 0 to 20 mA, or 4 mA to 20 ±10 V, 0 to 20 mA, or 4 mA to 20 Resolution Voltage: 14 bits Voltage: 14 bits Current: 13 bits Current: 13 bits S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 911 Table A- 147 Diagnostics Technical data SM 1232 AQ 2 x 14 bit SM 1232 AQ 4 x 14 bit Overflow/underflow Short to ground (voltage mode only) Wire break (current mode only) 24 VDC low voltage S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 912 X10 (gold) X11 (gold) L+ / 24 VDC No connection M / 24 VDC No connection No connection No connection AQ 0M No connection AQ 0 No connection AQ 1M No connection AQ 1 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 913: Sm 1234 Analog Input/Output Module Specifications

    Smoothing None, weak, medium, or strong Refer to the section on step response times (Page 916). Noise rejection 400, 60, 50, or 10 Hz Refer to the section on sample rates (Page 916). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 914 SM 1234 AI 4 x 13 bit / AQ 2 x 14 bit Overflow/underflow Short to ground (voltage mode only) Yes on outputs Wire break (current mode only) Yes on outputs 24 VDC low voltage S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 915 Inputs configured for current mode will not conduct loop current unless the module is powered and configured. Current input channels will not operate unless external power is supplied to the transmitter. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 916: Step Response Of The Analog Inputs

    1.470 V Overshoot range 27649 6C01 27648 6C00 10 V 2.5 V 1.250 V Rated range 20736 5100 7.5 V 3.75 V 1.875 V 0.938 V 361.7 μV 180.8 μV 90.4 μV 45.2 μV S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 917: Measurement Ranges Of The Analog Outputs For Voltage And Current (Sb And Sm)

    ± 10 V 32767 7FFF See note 1 Overflow 32512 7F00 See note 1 32511 7EFF 11.76 V Overshoot range 27649 6C01 27648 6C00 10 V Rated range 20736 5100 7.5 V 361.7 μ V S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 918 See note 1 See note 1 Underflow -32768 8000 See note 1 See note 1 In an overflow or underflow condition, analog outputs will take on the substitute value of the STOP mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 919: Thermocouple And Rtd Signal Modules (Sms)

    Repeatability ±0.05% FS ±0.05% FS Measuring principle Integrating Integrating Module update time See Noise reduction selection table See Noise reduction selection table (Page 923). (Page 923). Cold junction error ±1.5 °C ±1.5 °C S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 920 ● "Thermocouple": The value will be reported in degrees multiplied by ten (for example, 25.3 degrees will be reported as decimal 253). ● "Voltage": The nominal range full scale value will be decimal 27648. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 921 No connection M / 24 VDC No connection No connection AI 0+ /TC AI 2+ /TC AI 0- /TC AI 2- /TC AI 1+ /TC AI 3+ /TC AI 1- /TC AI 3- /TC S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 922: Basic Operation For A Thermocouple

    If better cold junction error compensation is needed, an external iso-thermal terminal block may be used. The thermocouple module provides for use of a 0 °C referenced or 50 °C referenced terminal block. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 923: Selection Tables For The Sm 1231 Thermocouple

    In the presence of radiated radio frequency of 970 MHz to 990 MHz, the accuracy of the SM 1231 AI 4 x 16 bit TC may be degraded. Note Thermocouple channel Each channel on the Thermocouple signal module can be configured with a different thermocouple type (selectable in the software during configuration of the module). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 924 -32768 8000 Underflow Faulty wiring (for example, polarity reversal, or open inputs) or sensor error in the negative range (for example, wrong type of thermocouple) may cause the thermocouple module to signal underflow. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 925: Sm 1231 Rtd

    ±0.05% FS ±0.05% FS Maximum sensor dissipation 0.5 m W 0.5 m W Measuring principle Integrating Integrating Module update time See Noise reduction selection table See Noise reduction selection table (Page 928). (Page 928). S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 926 (for example, 25.34 degrees will be reported as decimal 2534). The SM 1231 RTD module supports measurements with 2-wire, 3-wire and 4-wire connections to the sensor resistor. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 927 AI 6 M+ /RTD AI 0 M- /RTD AI 2 M- /RTD AI 4 M- /RTD AI 6 M- /RTD AI 0 I+ /RTD AI 2 I+ /RTD AI 4 I+ /RTD AI 6 I+ /RTD S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 928: Selection Tables For The Sm 1231 Rtd

    Pt 0.003910 Pt 10 -273.2 °C -240.0 °C 1100.0 °C 1295 °C ±1.0 °C ±2.0 °C Pt 50 -273.2 °C -240.0 °C 1100.0 °C 1295 °C ±0.8 °C ±1.6 °C Pt 100 Pt 500 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 929 Best accuracy will be achieved for the 10 Ω RTD ranges if 4 wire connections are used. The resistance of the connection wires in 2 wire mode will cause an error in the sensor reading and therefore accuracy is not guaranteed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 930 7FFF > 1832.0 32767 7FFF Overflow 1000.0 10000 2710 1832.0 18320 4790 Overrange 850.1 8501 2135 1562.1 15621 3D05 850.0 8500 2134 1562.0 15620 3D04 Rated range -200.0 -2000 F830 -328.0 -3280 F330 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 931: Technology Modules

    Output current, rated value 200 mA Power loss Power loss, typ. 1 W, excluding port loading Digital inputs/outputs Cable length (meters) 20 m, unshielded, max. SDLC Cable length (meters) 20 m, unshielded, max. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 932 (SIO mode) and PORT status Cn (IO-Link mode) For channel diagnostics Yes; red Fn LED For module diagnostics Yes; green/red DIAG LED Electrical isolation Electrical isolation channels Between the channels Between the channels and the backplane bus Permitted potential difference S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 933 Operating temperature Min. -20 °C Max. 60 °C Horizontal installation, min. -20 °C Horizontal installation, max. 60 °C Vertical installation, min. -20 °C Vertical installation, max. 50 °C Overview of the response time S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 934: Sm 1278 4Xio-Link Master Sm Wiring Diagrams

    No connection No connection No connection M / 24 VDC No connection No connection No connection Functional Earth No connection No connection No connection No connection No connection No connection No connection C/QL C/QL S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 935: Digital Signal Boards (Sbs)

    2 (no adjacent points) at 60 °C • horizontal or 50 °C vertical 4 at 55 °C horizontal or 45 °C • vertical Cable length (meters) 50 shielded twisted pair 50 shielded twisted pair S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 936 Table A- 188 Connector pin locations for SB 1221 DI 4 x 24 VDC, 200 kHz (6ES7 221-3BD30-0XB0) L+ / 24 VDC M / 24 VDC DI e.0 DI e.1 DI e.2 DI e.3 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 937: Sb 1222 200 Khz Digital Output Specifications

    200 kHz max., 2 Hz min. Surge current 0.11 A 0.11 A Overload protection Isolation (field side to logic) 500 VAC for 1 minute 500 VAC for 1 minute Isolation groups Currents per common 0.4 A 0.4 A S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 938 • Change a driver from a sink only driver to a sinking and sourcing driver • Change to a higher quality cable • Reduce the circuit/components from 24 V to 5 V • Add an external load at the input S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 939 Table A- 194 Connector pin locations for SB 1222 DQ 4 x 5 VDC, 200 kHz (6ES7 222-1AD30-0XB0) L+ / 5 VDC M / 5 VDC DQ e.0 DQ e.1 DQ e.2 DQ e.3 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 940: Sb 1223 200 Khz Digital Input / Output Specifications

    0.05, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 0.05, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 10.0, 12.8, 20.0 10.0, 12.8, 20.0 Number of inputs on simultaneously Cable length (meters) 50 shielded twisted pair 50 shielded twisted pair S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 941 • Change a driver from a sink only driver to a sinking and sourcing driver • Change to a higher quality cable • Reduce the circuit/components from 24 V to 5 V • Add an external load at the input S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 942 Table A- 199 Connector pin locations for SB 1223 DI 2 x 24 VDC/DQ 2 x 24 VDC, 200 kHz (6ES7 223-3BD30-0XB0) L+ / 24 VDC M / 24 VDC DI e.0 DI e.1 DQ e.0 DQ e.1 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 943: Sb 1223 2 X 24 Vdc Input / 2 X 24 Vdc Output Specifications

    0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4,10.0, 12.8, 20.0 ms settings 0.05, 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 10.0, 12.8, 20.0 Number of inputs on simultaneously Cable length (meters) 500 shielded, 300 unshielded S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 944 Cable length (meters) 500 m shielded, 150 m unshielded Depending on your pulse receiver and cable, an additional load resistor (at least 10% of rated current) may improve pulse signal quality and noise immunity. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 945 Table A- 205 Connector pin locations for SB 1223 DI 2 x 24 VDC, DQ 2 x 24 VDC (6ES7 223-0BD30- 0XB0) L+ / 24 VDC M / 24 VDC DI e.0 DI e.1 DQ e.0 DQ e.1 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 946: Analog Signal Boards (Sbs)

    Noise rejection 400, 60, 50, or 10 Hz (refer to Analog input response times for sample rates.) Accuracy (25 °C / -20 to 60 °C) ±0.3% / ±0.6% of full scale S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 947 Table A- 209 Wiring diagram for the analog input SB SB 1231 AI x 12 bit (6ES7 231-4HA30-0XB0) ① Connect "R" and "0+" for current Note: Connectors must be gold. See Appendix C, Spare Parts for order number. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 948: Sb 1232 1 Analog Output Specifications

    Voltage: ≥ 1000 Ω Current: ≤ 600 Ω Behavior on RUN to STOP Last value or substitute value (default value 0) Isolation (field side to logic) None Cable length (meters) 100 m, twisted and shielded S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 949 Note: Connectors must be gold. See Appendix C, Spare Parts for order number. Table A- 215 Connector pin locations for SB 1232 AQ 1 x 12 bit (6ES7 232-4HA30-0XB0) X19 (gold) AQ 0M AQ 0 No connection No connection No connection S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 950: Measurement Ranges For Analog Inputs And Outputs

    1.875 V 0.938 V 361.7 μV 180.8 μV 90.4 μV 45.2 μV FFFF -20736 AF00 -7.5 V -3.75 V -1.875 V -0.938 V -27648 9400 -10 V -5 V -2.5 V -1.250 V S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 951: Measurement Ranges Of The Analog Outputs For Voltage And Current (Sb And Sm)

    32511 7EFF 11.76 V Overshoot range 27649 6C01 27648 6C00 10 V Rated range 20736 5100 7.5 V 361.7 μ V FFFF -361.7 μ V -20736 AF00 -7.5 V -27648 9400 -10 V S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 952 See note 1 See note 1 Underflow -32768 8000 See note 1 See note 1 In an overflow or underflow condition, analog outputs will take on the substitute value of the STOP mode. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 953: Thermocouple Signal Boards (Sbs)

    See Thermocouple selection table (Page 954). Repeatability ±0.05% FS Measuring principle Integrating Module update time See Thermocouple filter selection table (Page 954). Cold junction error ±1.5° C Isolation (field side to logic) 500 VAC S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 954: Basic Operation For A Thermocouple

    The temperature of the module is measured internally, and then converted to a value to be added to the sensor conversion. The corrected sensor conversion is then linearized using the thermocouple tables. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 955 0.306 0.066 16.67 0.056 0.036 To maintain module resolution and accuracy when 400 Hz rejection is selected, the integration time is 10 ms. This selection also rejects 100 Hz and 200 Hz noise. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 956 Table A- 228 Connector pin locations for SB 1231 AI 1 x 16 bit thermocouple (6ES7 231-5QA30- 0XB0) X19 (gold) No connection No connection No connection No connection AI 0- /TC AI 0+ /TC S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 957: Rtd Signal Boards (Sbs)

    Accuracy See Selection tables (Page 960). Repeatability ±0.05% FS Maximum sensor dissipation 0.5 m W Measuring principle Integrating Module update time See Selection table (Page 960). Isolation (field side to logic) 500 VAC S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 958 (for example, 25.34 degrees will be reported as decimal 2534). The SB 1231 RTD signal board supports measurements with 2-wire, 3-wire and 4-wire connections to the sensor resistor. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 959 Table A- 233 Connector pin locations for SB 1231 AI 1 x 16 bit RTD (6ES7 231-5PA30-0XB0) X19 (gold) No connection No connection AI 0 M+ /RTD AI 0 M- /RTD AI 0 I+ /RTD AI 0 I- /RTD S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 960: Selection Tables For The Sb 1231 Rtd

    -200.0 °C 200.0 °C 240.0 °C ±0.7 °C ±1.4 °C Cu 100 RTD values below the under-range minimum value are reported as -32768. RTD values above the over-range maximum value are reported as +32768. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 961 Because the configuration of the module can vary the length of the initialization time, you should verify the behavior or the module in your configuration. If required, you can include logic in your user program to accommodate the initialization time of the module. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 962: Bb 1297 Battery Board

    The S7-1200 BB 1297 Battery Board is designed for long-term backup of the Real-time clock. It is pluggable in the signal board slot of the S7-1200 CPU (firmware 3.0 and later versions). You must add the BB 1297 to the device configuration and download the hardware configuration to the CPU for the BB to be functional.
  • Page 963 Battery status is updated at power up and then once per day while CPU is in RUN mode. Table A- 238 Insertion diagram for the BB 1297 battery board BB 1297 battery board (6ES7 297-0AX30-0XA0) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 964: Communication Interfaces

    710 VDC for 1 minute PROFIBUS interface to ground • PROFIBUS interface to internal circuit • Dimensions and weights Width 30 mm • • Height 100 mm • • Depth 75 mm • • S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 965: Cm 1243-5 Profibus Dp Master

    0 °C to 45 °C • • vertical) Relative humidity at 25 °C during operation, without 95 % condensation, maximum Degree of protection IP20 Power supply, current consumption and power loss Type of power supply S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 966 28.8 V • • Current consumption (typical) from 24 V DC 100 mA • • from the S7-1200 backplane bus 0 mA • • Effective power loss (typical) from 24 V DC 2.4 W • • from the S7-1200 backplane bus •...
  • Page 967: Gprs

    To use these modules, your CPU firmware must be V2.0 or higher. A.14.2.1 CP 1242-7 GPRS Table A- 243 Technical specifications of the CP 1242-7 Technical specifications Order number 6GK7 242-7KX30-0XE0 Wireless interface Antenna connector SMA socket Nominal impedance 50 ohms Wireless connection S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 968 28.8 V • • Current consumption (typical) from 24 V DC 100 mA • • from the S7-1200 backplane bus 0 mA • • Effective power loss (typical) from 24 V DC 2.4 W • • from the S7-1200 backplane bus •...
  • Page 969 Antenna with 5 m fixed cable and SMA male connector Dimensions (D x H) in mm 25 x 193 Weight Antenna incl. cable 310 g • • Fittings 54 g • • Installation With supplied bracket S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 970: Cm 1243-2 As-I Master

    Date 01.12.2011 Interfaces Maximum current consumption From the S7-1200 backplane bus Max. 250 mA, supply voltage S7-1200 communication bus 5 V DC From the AS-i cable Max. 100 mA Maximum current carrying capacity between the ASI+/ASI- terminals Pin assignment See section Electrical connections of the AS-i master CM...
  • Page 971: Electrical Connections Of The As-I Master Cm 1243-2

    The AS-i master CM 1243-2 is supplied over the communications bus of the S7-1200. This means that a diagnostics message can still be sent to the S7-1200 following failure of the AS-i supply voltage. The connection to the communications bus is on the right-hand side of the AS-i master CM 1243-2.
  • Page 972 You will find additional information on connecting the AS-i cable in the section "Installation, connection and commissioning of the modules" in the manual "AS-i Master CM 1243-2 and AS-i data decoupling unit DCM 1271 for SIMATIC S7-1200". Terminal assignment Label...
  • Page 973: Rs232, Rs422, And Rs485

    No parity (default), even, odd, Mark (parity bit always set to 1), Space (parity bit always set to 0) Number of stop bits 1 (default), 2 Flow control Not supported Wait time 0 to 65535 ms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 974 Use shielded twisted pair cable and connect the cable shield to ground. You terminate only the two ends of the RS485 network. The devices in between the two end devices are not terminated or biased. See the S7-1200 System Manual section on "Biasing and terminating an RS485 network connector"...
  • Page 975: Cm 1241 Rs232 Specifications

    No parity (default), even, odd, Mark (parity bit always set to 1), Space (parity bit always set to 0) Number of stop bits 1 (default), 2 Flow control Hardware, software Wait time 0 to 65535 ms S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 976: Cm 1241 Rs422/485 Specifications

    Internal bias options provided, or no internal bias. In all cases, external termination is required, see Biasing and terminating an RS485 network connector (Page 670) and Configuring the RS422 and RS485 in the S7-1200 System Manual (Page 707) Receiver input impedance 5.4K Ω min. including termination Receiver threshold/sensitivity +/- 0.2 V min., 60 mV typical hysteresis...
  • Page 977 The RTS is a TTL level signal and can be used to control another half duplex device based on this signal. It is active when you transmit and is inactive all other times. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 978: Teleservice (Ts Adapter And Ts Adapter Modular)

    43 x 35 x 23 67 x 35 x 23 93 x 40 x 23 Weight 20 grams 30 grams 43 grams Points Used with CPU CPU 1211C, CPU 1212C CPU 1214C, CPU 1215C CPU 1217C S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 979 Use these input simulators only in non-hazardous locations. Do not use in Class I DIV 2 or Class I Zone 2 hazardous locations. 8 Position Simulator (6ES7 274-1XF30-0XA0) ① 24 VDC sensor power out 14 Position Simulator (6ES7 274-1XF30-0XA0) ① 24 VDC sensor power out S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 980: S7-1200 Potentiometer Module

    CPU analog inputs 0 VDC to 10 VDC. To install the potentiometer: 1. Insert the circuit board ‘fingers’ into any S7-1200 CPU analog input terminal block, and connect an external DC power supply to the 2-position connector on the potentiometer module.
  • Page 981: I/O Expansion Cable

    Table A- 258 Expansion cables Technical Data Order number 6ES7 290-6AA30-0XA0 Cable length Weight 200 g Refer to the installation section (Page 64) for information about installing and removing the S7-1200 expansion cable. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 982: Companion Products

    A.20 Companion products A.20.1 PM 1207 power module The PM 1207 is a power supply module for the SIMATIC S7-1200. It provides the following features: ● Input 120/230 VAC, output 24 VDC/2.5A ● Order number 6ESP 332-1SH71-4AA0 For more information about this product and for the product documentation, refer to the product catalog web site for the PM 1207 (https://eb.automation.siemens.com/mall/en/de/Catalog/Product/6AG1332-1SH71-4AA0).
  • Page 983: Cm Canopen Module

    A.20.3 CM CANopen module The CM CANopen module is a plug-in module between the SIMATIC S7-1200 PLC and any device running CANopen. The CM CANopen can be configured to be both master or slave. There are two CM CANopen modules: the CANopen module (order number 021620-B), and the CANopen (Ruggedized) module (order number 021730-B).
  • Page 984 Technical specifications A.20 Companion products S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 985: Calculating A Power Budget

    Unpredictable operation could result in death, severe personal injury and/or property damage. The DC sensor supply on the CPU and any external power supply should provide power to different points. A single connection of the commons is allowed. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 986 The I/O requires 456 mA and the CPU provides only 400 mA. This installation requires an additional source of at least 56 mA at 24 VDC power to operate all the included 24 VDC inputs and outputs. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 987 (56 mA) Form for calculating your power budget Use the following table to determine how much power (or current) the S7-1200 CPU can provide for your configuration. Refer to the technical specifications (Page 829) for the power budgets of your CPU model and the power requirements of your signal modules.
  • Page 988 Calculating a power budget S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 989: Order Numbers

    6ES7 223-1BL32-0XB0 (Source) SM 1223 8 x 24 VDC Input (Sink/Source) / 8 x Relay Output 6ES7 223-1PH32--0XB0 SM 1223 16 x 24 VDC Input (Sink/Source) / 16 x Relay Output 6ES7 223-1PL32-0XB0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 990 SB 1231 1 Analog Input 6ES7 231-4HA30-0XB0 SB 1231 1 Analog Input Thermocouple 6ES7 231-5QA30-0XB0 SB 1231 1 Analog Input RTD 6ES7 231-5PA30-0XB0 Battery BB 1297 Battery Board (battery type CR1025 not included) 6ES7 297-0AX30-0XA0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 991: Communication

    GSM/GPRS antenna 6NH9 860-1AA00 ANT794-3M Flat antenna 6NH9 870-1AA00 Table C- 9 Connectors Type of Connector Order Number RS485 35-degree cable output, screw-terminal connection 6ES7 972-0BA42-0XA0 35-degree cable output, FastConnect connection 6ES7 972-0BA60-0XA0 S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 992: Other Modules

    6EP1 332-1SH71-4AA0 Ethernet switch CSM 1277 Ethernet switch - 4 ports 6GK7 277-1AA10-0AA0 CM CANopen CANopen for SIMATIC S7-1200 021620-B CANopen (Ruggedized) for SIMATIC S7-1200 021730-B Memory cards Table C- 11 Memory cards SIMATIC memory cards Order Number SIMATIC MC 4 MB...
  • Page 993: Spare Parts And Other Hardware

    I/O simulator Simulator (1211C/1212C - 8 position) 6ES7 274-1XF30-0XA0 Simulator (1214C/1215C - 14 position) 6ES7 274-1XH30-0XA0 Simulator, CPU 1217C 6ES7 274-1XK30-0XA0 Potentiometer S7-1200 Potentiometer module 6ES7 274-1XA30-0XA0 module Spare door kit CPU 1211C/1212C 6ES7 291-1AA30-0XA0 CPU 1214C 6ES7 291-1AB30-0XA0 CPU 1215C...
  • Page 994: Programming Software

    WinCC Professional 4096 PowerTags V12 SP1 6AV2103-0HA01-0AA5 WinCC Professional max. PowerTags V12 SP1 6AV2103-0XA01-0AA5 Documentation Table C- 15 S7-1200 documentation Printed documentation Language Order Number S7-1200 Programmable Controller System German 6ES7 298-8FA30-8AH0 Manual English 6ES7 298-8FA30-8BH0 French 6ES7 298-8FA30-8CH0 Spanish 6ES7 298-8FA30-8DH0...
  • Page 995: Exchanging A V3.0 Cpu For A V4.0 Cpu

    V3.0 protection level V4.0 access level No protection Full access (no protection) Write protection Read access Write/read protection HMI access Note that the V4.0 access level "No access (complete protection)" did not exist for V3.0. S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 996 GET/PUT is enabled. Motion control support S7-1200 V4.0 CPUs do not support the V1.0 and V2.0 motion libraries. If you perform a device exchange for a STEP 7 project with V1.0 or V2.0 motion libraries, the device exchange substitutes compatible V3.0 motion control instructions (Page 455) for the V1.0 or...
  • Page 997 Note: The array "Command[]" is a UDT of the type "TO_CmdTab_Config_Command" in V3.0 and "TO_Struct_Command" in V4.0. Instruction changes The following instructions have changes in parameters or behavior: ● RDREC and WRREC (Page 315) ● CONV (Page 244) S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 998 Exchanging a V3.0 CPU for a V4.0 CPU HMI panel communication If you had one or more HMI panels (Page 32) connected to your S7-1200 V3.0 CPU, the communication to the S7-1200 V4.0 CPU depends on the type of communication you use and the firmware version of the HMI panel.
  • Page 999: Index

    SM 1231, 907 SM 1231 RTD, 925 grounding, 72 SM 1231 Thermocouple, 919 isolation guidelines, 71 SM 1232, 910 wiring guidelines, 70, 72 SM 1234, 913 Access protection, CPU, 190 AND (logic operation), 275 Accessing S7-1200 Programmable controller System Manual, 03/2014, A5E02486680-AG...
  • Page 1000 CALCULATE (calculate), 229 scaling analogs, 39 using for complex equations, 39 Basic panels (HMI), 32 Calendar, 283 Battery board (BB) Call structure, 201 BB 1297, 962 Calling code blocks within the user program, 172 S7-1200 Programmable controller 1000 System Manual, 03/2014, A5E02486680-AG...

Table of Contents