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

Advertisement

S7 S7-1200 Programmable controller
SIMATIC
S7
S7-1200 Programmable controller
System Manual
11/2009
A5E02486680-02
Preface
______________
Product overview
______________
Installation
______________
PLC concepts
______________
Device configuration
______________
Programming concepts
______________
Programming instructions
______________
PROFINET
Point-to-Point (PtP)
______________
communications
______________
Online and diagnostic tools
______________
Technical specifications
______________
Calculating a power budget
______________
Order numbers
1
2
3
4
5
6
7
8
9
A
B
C

Advertisement

Table of Contents
loading

Summary of Contents for Siemens SIMATIC S7

  • Page 1 Preface S7 S7-1200 Programmable controller ______________ Product overview ______________ Installation SIMATIC ______________ PLC concepts ______________ S7-1200 Programmable controller Device configuration ______________ Programming concepts System Manual ______________ Programming instructions ______________ PROFINET Point-to-Point (PtP) ______________ communications ______________ Online and diagnostic tools ______________ Technical specifications ______________ Calculating a power budget...
  • 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

    Siemens products that you are using, they can provide the fastest and most efficient answers to any problems you might encounter.
  • Page 4 Preface S7 S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 5: Table Of Contents

    Table of contents Preface ..............................3 Product overview ............................. 11 Introducing the S7-1200 PLC.......................11 Signal boards ..........................13 Signal modules ..........................13 Communication modules ......................14 STEP 7 Basic ..........................14 1.5.1 Different views to make the work easier ..................15 1.5.2 Help when you need it .........................16 Display panels..........................19 Installation ...............................
  • Page 6 Table of contents Device configuration ..........................69 Inserting a CPU........................... 70 Detecting the configuration for an unspecified CPU ..............71 Configuring the operation of the CPU ..................72 Adding modules to the configuration................... 73 Configuring the parameters of the modules................74 Creating a network connection ....................
  • Page 7 Table of contents Extended instructions.........................132 6.2.1 Common error parameters for extended instructions ..............132 6.2.2 Clock and calendar instructions ....................132 6.2.3 String and character instructions ....................136 6.2.3.1 String data overview ........................136 6.2.3.2 String conversion instructions ....................136 6.2.3.3 String operation instructions ......................144 6.2.4 Program control instructions ......................150 6.2.4.1...
  • Page 8 Table of contents Reference Information....................... 233 7.4.1 Locating the Ethernet (MAC) address on the CPU..............233 7.4.2 Configuring Network Time Protocol synchronization ..............234 Point-to-Point (PtP) communications ..................... 237 Using the RS232 and RS485 communication modules............237 Configuring the communication ports ..................238 Managing flow control .......................
  • Page 9 Table of contents Communication modules (CMs)....................317 A.6.1 CM 1241 RS485 Specifications ....................317 A.6.2 CM 1241 RS232 Specifications ....................318 SIMATIC memory cards......................318 Input simulators..........................319 I/O expansion cable ........................320 Calculating a power budget ........................321 Calculating a sample power requirement ..................322 Calculating your power requirement ..................323 Order numbers ............................
  • Page 10 Table of contents S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 11: Product Overview

    Product overview Introducing the S7-1200 PLC The S7-1200 programmable logic controller (PLC) 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 12 Product overview 1.1 Introducing the S7-1200 PLC Feature CPU 1211C CPU 1212C CPU 1214C Physical size (mm) 90 x 100 x 75 110 x 100 x 75 User memory Work memory 25 Kbytes 50 Kbytes    Load memory 1 Mbyte 2 Mbytes ...
  • Page 13: Signal Boards

    Product overview 1.2 Signal boards Signal boards A signal board (SB) allows you to add I/O to your CPU. You can add one SB with either digital or analog I/O. An SB connects on the front of the CPU. ● SB with 4 digital I/O (2 x DC inputs and 2 x DC outputs) ●...
  • Page 14: Communication Modules

    Product overview 1.4 Communication modules Communication modules The S7-1200 family provides communication modules (CMs) for additional functionality to the system. There are two communication modules: RS232 and RS485. ● The CPU supports up to 3 communication modules ● Each CM connects to the left side of the CPU (or to the left side of another CM) ①...
  • Page 15: Different Views To Make The Work Easier

    Product overview 1.5 STEP 7 Basic 1.5.1 Different views to make the work easier To help increase your productivity, the Totally Integrated Automation Portal provides two different views of the toolset: a task-oriented set of portals that are organized on the functionality of the tools (Portal view), or a project-oriented view of the elements within the project (Project view).
  • Page 16: Help When You Need It

    Product overview 1.5 STEP 7 Basic 1.5.2 Help when you need it Finding answers to your questions quickly To help you resolve issues quickly and efficiently, STEP 7 Basic provides intelligent point-of- need assistance: ● An entry field provides "rollout" help to assist you with entering the correct information (valid ranges and type of data) for that field.
  • Page 17 Product overview 1.5 STEP 7 Basic Click the "Show/hide contents" button on the information system to display the contents and undock the help window. You can then resize the help window. Use the "Contents" or "Index" tabs to search through the information system by topic or by key word. Help window (default) Help window with contents displayed Note...
  • Page 18 Product overview 1.5 STEP 7 Basic Printing topics from the information system To print from the information system, click the "Print" button on the help window. To print from the information system, click the "Print" button on the help window. The "Print"...
  • Page 19: Display Panels

    Product overview 1.6 Display panels Display panels As visualization becomes a standard component for most machine designs, the SIMATIC HMI Basic Panels provide touch-screen devices for basic operator control and monitoring tasks. All panels are have a protection rating for IP65 and have CE, UL, cULus, and NEMA 4x certification.
  • Page 20 Product overview 1.6 Display panels S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 21: Installation

    The small size of the S7-1200 allows you to make efficient use of space. WARNING The SIMATIC S7-1200 PLCs are Open Type Controllers. It is required that you install the S7-1200 in a housing, cabinet, or electric control room. Entry to the housing, cabinet, or electric control room should be limited to authorized personnel.
  • Page 22 Installation When planning your layout for the S7-1200 system, allow enough clearance for the wiring and communications cable connections. ① Side view ③ Vertical installation ② Horizontal installation ④ Clearance area Power budget Your CPU has an internal power supply that provides power for the CPU, the signal modules, signal board and communication modules and for other 24 VDC user power requirements.
  • Page 23 Installation WARNING Connecting an external 24 VDC power supply in parallel with the 24 VDC sensor supply can result in a conflict between the two supplies as each seeks to establish its own preferred output voltage level. The result of this conflict can be shortened lifetime or immediate failure of one or both power supplies, with consequent unpredictable operation of the PLC system.
  • Page 24: Installation And Removal Procedures

    Installation 2.2 Installation and removal procedures Installation and removal procedures Mounting dimensions (mm) S7-1200 Devices Width A Width B CPUs: CPU 1211C and CPU 1212C 90 mm 45 mm CPU 1214C 110 mm 55 mm Signal modules: 8 and 16 point DC and Relay (8I, 16I, 8Q, 16Q, 8I/8Q) 45 mm 22.5 mm Analog (4AI, 8AI, 4AI/4AQ, 2AQ, 4AQ)
  • Page 25 Installation 2.2 Installation and removal procedures Installing and removing the S7-1200 devices The CPU can be easily installed on a standard DIN rail or on a panel. DIN rail clips are provided to secure the device on the DIN rail. The clips also snap into an extended position to provide a screw mounting position for panel-mounting the unit.
  • Page 26: Installing And Removing The Cpu

    Installation 2.2 Installation and removal procedures 2.2.1 Installing and removing the CPU Installation You can install the CPU on a panel or on a DIN rail. Note Attach any communication modules to the CPU and install the assembly as a unit. Install signal modules separately after the CPU has been installed.
  • Page 27: Installing And Removing A Signal Module

    Installation 2.2 Installation and removal procedures Removal To prepare the CPU for removal, remove power from the CPU and disconnect the I/O connectors, wiring, and cables from the CPU. Remove the CPU and any attached communication modules as a unit. All signal modules should remain installed. If a signal module is connected to the CPU, retract the bus connector: 1.
  • Page 28 Installation 2.2 Installation and removal procedures Extend the bus connector. 1. Place a screwdriver beside the tab on the top of the 2. Slide the tab fully to the left to extend the bus connector into the CPU. Extending the bus connector makes both mechanical and electrical connections for the SM.
  • Page 29: Installing And Removing A Communication Module

    Installation 2.2 Installation and removal procedures 2.2.3 Installing and removing a communication module Installation Attach the CM to the CPU before installing the assembly as a unit to the DIN rail or panel. Remove the bus cover from the left side of the CPU: 1.
  • Page 30: Installing And Removing A Signal Board

    Installation 2.2 Installation and removal procedures Removal Remove the CPU and CM as a unit from the DIN rail or panel. Prepare for CM removal. 1. Remove power from the CPU. 2. Remove the I/O connectors and all wiring and cables from the CPU and CMs.
  • Page 31: Removing And Reinstalling The S7-1200 Terminal Block Connector

    Installation 2.2 Installation and removal procedures Removal Prepare the CPU for removal of the SB by removing power from the CPU and removing the top and bottom terminal block covers from the CPU. To remove the SB, follow these steps: 1.
  • Page 32: Wiring Guidelines

    Installation 2.3 Wiring guidelines To install the connector, follow these steps: 1. Prepare the components for terminal block installation by removing power from the CPU and opening the cover for the terminal block. 2. Align the connector with the pins on the unit. 3.
  • Page 33 Installation 2.3 Wiring guidelines WARNING Control devices can fail in an unsafe condition, resulting in unexpected operation of controlled equipment. Such unexpected operations could result in death, severe personal injury and/or property damage. Use an emergency stop function, electromechanical overrides, or other redundant safeguards that are independent of the S7-1200.
  • Page 34 Installation 2.3 Wiring guidelines Guidelines for wiring the S7-1200 When designing the wiring for your S7-1200, provide a single disconnect switch that simultaneously removes power from the S7-1200 CPU power supply, from all input circuits, and from all output circuits. Provide over-current protection, such as a fuse or circuit breaker, to limit fault currents on supply wiring.
  • Page 35 Installation 2.3 Wiring guidelines Control DC inductive loads S7-1200 DC outputs include suppression circuits that are adequate for the inductive loads in most applications. Since the relays can be used for either a DC or an AC load, internal protection is not provided.
  • Page 36 Installation 2.3 Wiring guidelines S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 37: Plc Concepts

    PLC concepts Execution of the user program The CPU supports the following types of code blocks that allow you to create an efficient structure for your user program: ● Organization blocks (OBs) define the structure of the program. Some OBs have predefined behavior and start events, but you can also create OBs with custom start events.
  • Page 38 PLC concepts 3.1 Execution of the user program Under the default configuration, all digital and analog I/O points are updated synchronously with the scan cycle using an internal memory area called the process image. The process image contains a snapshot of the physical inputs and outputs (the physical I/O points on the CPU, signal board, and signal modules).
  • Page 39: Operating Modes Of The Cpu

    PLC concepts 3.1 Execution of the user program Note The CPU always performs a restart after a download Whenever you download an element of your project (such as a program block, data block, or hardware configuration), the CPU performs a restart on the next transition to RUN mode. In addition to clearing the inputs, initializing the outputs and initializing the non-retentive memory, the restart also initializes the retentive memory areas.
  • Page 40 PLC concepts 3.1 Execution of the user program You can change the current operating mode using the "STOP" or "RUN" commands from the online tools of the programming software. You can also include a STP instruction 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.
  • Page 41 PLC concepts 3.1 Execution of the user program The CPU also performs the following tasks during the startup processing. ● Interrupts are queued but not processed during the startup phase ● No cycle time monitoring is performed during the startup phase ●...
  • Page 42 PLC concepts 3.1 Execution of the user program Organization blocks (OBs) OBs control the execution of the user program. Each OB must have a unique OB number. Some default OB numbers are reserved below 200. Other OBs must be numbered 200 or greater.
  • Page 43: Event Execution Priorities And Queuing

    PLC concepts 3.1 Execution of the user program 3.1.2 Event execution priorities and queuing The CPU processing is controlled by events. The events trigger interrupt OBs to be executed. The interrupt OB for an event is specified during the creation of the block, during Device configuration or with an ATTACH or DETACH instruction.
  • Page 44 PLC concepts 3.1 Execution of the user program Each CPU event has an associated priority, and the event priorities are classified into priority groups. The following table summarizes the queue depths, priority groups and priorities for the supported CPU events. Note You cannot change the priority or the priority group assignments or the queue depths.
  • Page 45 PLC concepts 3.1 Execution of the user program priority group, the CPU then returns to the lower priority group and resumes the processing of the pre-empted OB at the point where the processing of that OB had been interrupted. Interrupt latency The interrupt event latency (the time from notification of the CPU that an event has occurred until the CPU begins execution of the first instruction in the OB that services the event) is approximately 210 µsec, provided that a program cycle OB is the only event service routine...
  • Page 46 PLC concepts 3.1 Execution of the user program Understanding diagnostic error events Some devices are capable of detecting and reporting diagnostic errors. The occurrence or removal of any of several different diagnostic error conditions results in a diagnostic error event. The following diagnostic errors are supported: ●...
  • Page 47 PLC concepts 3.1 Execution of the user program Monitoring the cycle time The cycle time is the time that the CPU operating system requires to execute the cyclic phase of the RUN mode. The CPU provides two methods of monitoring the cycle time: ●...
  • Page 48: Cpu Memory

    PLC concepts 3.1 Execution of the user program Configuring the cycle time and communication load You use the CPU properties in the Device configuration to configure the following parameters: ● Cycle time: You can enter a maximum scan cycle time. You can also enter a fixed minimum scan cycle time.
  • Page 49 PLC concepts 3.1 Execution of the user program Retentive memory Data loss after power failure can be avoided by marking certain data as retentive. The following data can be configured to be retentive: ● Bit memory(M): You can define the precise width of the memory for bit memory in the PLC tag table or in the assignment list.
  • Page 50 PLC concepts 3.1 Execution of the user program The following types of events are recorded in the diagnostics buffer: ● Each system diagnostic event; for example, CPU errors and module errors ● Each state change of the CPU (each power up, each transition to STOP, each transition to RUN) To access the diagnostic buffer, you must be online.
  • Page 51 PLC concepts 3.1 Execution of the user program CAUTION Overwriting the system memory or clock memory bits can corrupt the data in these functions and cause your user program to operate incorrectly, which can cause damage to equipment and injury to personnel. Because both the clock memory and system memory are unreserved in M memory, instructions or communications can write to these locations and corrupt the data.
  • Page 52: Password Protection For The S7-1200 Cpu

    PLC concepts 3.1 Execution of the user program You configure the behavior of the outputs in Device Configuration. Select the individual devices and use the "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.
  • Page 53: Recovery From A Lost Password

    PLC concepts 3.2 Data storage, memory areas and addressing 3.1.5 Recovery from a lost password If you have lost the password for a password-protected CPU, use an empty transfer card to delete the password-protected program. The empty transfer card erases the internal load memory of the CPU.
  • Page 54 PLC concepts 3.2 Data storage, memory areas and addressing Memory area Description Force Retentive Temporary data for a block, local to that Temp memory block Data memory and also parameter memory Data block for FBs Each different memory location has a unique address. Your user program uses these addresses to access the information in the memory location.
  • Page 55 PLC concepts 3.2 Data storage, memory areas and addressing I[byte address].[bit address] I0.1 Byte, Word, or Double Word I[size][starting byte address] IB4, IW5, or ID12 By appending a ":P" to the address, you can immediately read the digital and analog inputs of the CPU, SB or SM.
  • Page 56 PLC concepts 3.2 Data storage, memory areas and addressing Accesses using Q_:P affect both the physical output as well as the corresponding value stored in the output process image. Q[byte address].[bit address]:P Q1.1:P Byte, Word, or Double word Q[size][starting byte address]:P QB5:P, QW10:P or QD40:P M (bit memory area): Use the bit memory area (M memory) for both control relays and data to store the intermediate status of an operation or other control information.
  • Page 57: Data Types

    PLC concepts 3.3 Data types Addressing the I/O in the CPU and I/O modules When you add a CPU and I/O modules to your configuration screen, I and Q addresses are automatically assigned. You can change the default addressing by selecting the address field in the configuration screen and typing new numbers.
  • Page 58 PLC concepts 3.3 Data types Data type Size (bits) Range Constant Entry Examples Bool 0 to 1 TRUE, FALSE, 0, 1 Byte 16#00 to 16#FF 16#12, 16#AB Word 16#0000 to 16#FFFF 16#ABCD, 16#0001 DWord 16#00000000 to 16#FFFFFFFF 16#02468ACE Char 16#00 to 16#FF 'A', 't', '@' Sint -128 to 127...
  • Page 59 PLC concepts 3.3 Data types maximum total character count (1 byte), the current character count (1 byte), and up to 254 characters, with each character stored in 1 byte. You can use literal strings (constants) for instruction parameters of type IN using single quotes.
  • Page 60 PLC concepts 3.3 Data types DTL (Data and Time Long) data type The DTL data type is a structure of 12 bytes that saves information on date and time in a predefined structure. You can define a DTL in either the Temp memory of the block or in a Length Format Value range...
  • Page 61: Using A Memory Card

    PLC concepts 3.4 Using a memory card Using a memory card NOTICE The CPU supports only the pre-formatted SIMATIC memory card (Page 318). If you use a Windows formatter to reformat the SIMATIC memory card, the CPU cannot use the reformatted memory card.
  • Page 62: Inserting A Memory Card In The Cpu

    PLC concepts 3.4 Using a memory card 3.4.1 Inserting a memory card in the CPU WARNING If you insert a memory card (whether configured as a program or transfer card) into a running CPU, the CPU goes immediately to STOP mode. Control devices can fail in an unsafe condition, resulting in unexpected operation of controlled equipment.
  • Page 63: Configuring The Startup Parameter Of The Cpu Before Copying The Project To The Memory Card

    PLC concepts 3.4 Using a memory card 3.4.2 Configuring the startup parameter of the CPU before copying the project to the memory card When you copy a program to a transfer card or a program card, the program includes the startup parameter for the CPU.
  • Page 64 PLC concepts 3.4 Using a memory card 5. Add the program by selecting the CPU device (such as PLC_1 [CPU 1214 DC/DC/DC]) in the 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"...
  • Page 65: Program Card

    PLC concepts 3.4 Using a memory card The CPU then goes to the start-up mode (RUN or STOP) that you configured for the project. Note You must remove the transfer card before setting the CPU to RUN mode. 3.4.4 Program card CAUTION Electrostatic discharge can damage the memory card or the receptacle on the CPU.
  • Page 66 PLC concepts 3.4 Using a memory card Always remember to configure the startup parameter of the CPU (Page 63) before copying a project to the program card. To create a program card with STEP 7 Basic, follow these steps: 1. Insert a blank memory card into the card reader/writer attached to your programming device.
  • Page 67 PLC concepts 3.4 Using a memory card Using a program card as the load memory for your CPU CAUTION If you insert a blank memory card into the CPU, the CPU goes to STOP mode. If you power-cycle the CPU, change the CPU from STOP to RUN mode, or reset the CPU memory (MRES), the CPU copies the internal load memory of the CPU to the memory card (which configure the memory card as a program card) and erases the program from the internal load memory.
  • Page 68 PLC concepts 3.4 Using a memory card S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 69: Device Configuration

    Device configuration You create the device configuration for your PLC by adding a CPU and additional modules to your project. ① Communications module (CM): Up to 3, inserted in slots 101, 102, and 103 ② CPU: Slot 1 ③ Ethernet port of CPU ④...
  • Page 70: Inserting A Cpu

    Device configuration 4.2 Inserting a CPU Inserting a CPU You create your device configuration by inserting a CPU into your project. Selecting the CPU from the "Add a new device" dialog creates the rack and CPU. "Add a new device" dialog Device view of the hardware configuration Selecting the CPU in the...
  • Page 71: Detecting The Configuration For An Unspecified Cpu

    Device configuration 4.3 Detecting the configuration for an unspecified CPU Detecting the configuration for an unspecified CPU Uploading an existing hardware configuration is easy If you are connected to a CPU, you can upload the configuration of that CPU, including any modules, to your project. Simply create a new project and select the "unspecified CPU"...
  • Page 72: Configuring The Operation Of The Cpu

    Device configuration 4.4 Configuring the operation of the CPU Configuring the operation of the CPU 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. Edit the properties to configure the following parameters: ●...
  • Page 73: Adding Modules To The Configuration

    Device configuration 4.5 Adding modules to the configuration Adding modules to the configuration Use the hardware catalog to add modules to the CPU. There are three types of modules: ● Signal modules (SM) provide additional digital or analog I/O points. These modules are connected to the right side of the CPU.
  • Page 74: Configuring The Parameters Of The Modules

    Device configuration 4.6 Configuring the parameters of the modules Configuring the parameters of the modules To configure the operational parameters for the modules, select the module in the Device view and use the "Properties" tab of the inspector window to configure the parameters for the module.
  • Page 75: Creating A Network Connection

    Device configuration 4.7 Creating a network connection Creating a network connection Use the "Network view" of Device configuration to create the network connections between the devices in your project. After creating the network connection, use the "Properties" tab of the inspector window to configure the parameters of the network. Action Result Select "Network view"...
  • Page 76: Configuring An Ip Address In Your Project

    Device configuration 4.8 Configuring an IP address in your project Configuring an IP address in your project Configuring the PROFINET interface After you configure the rack with the CPU (Page 72) , you can configure parameters for the PROFINET interface. To do so, click the green PROFINET box on the CPU to select the PROFINET port.
  • Page 77 Device configuration 4.8 Configuring an IP address in your project IP addresses properties: In the Properties window, select the "Ethernet address" configuration entry. The TIA Portal displays the Ethernet address configuration dialog, which associates the software project with the IP address of the CPU that will receive that project.
  • Page 78 Device configuration 4.8 Configuring an IP address in your project S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 79: Programming Concepts

    Programming concepts Guidelines for designing a PLC system When designing a PLC system, you can choose from a variety of methods and criteria. The following general guidelines can apply to many design projects. Of course, you must follow the directives of your own company's procedures and the accepted practices of your own training and location.
  • Page 80: Structuring Your User Program

    Programming concepts 5.2 Structuring your user program Recommended steps Tasks Create the Based on the requirements of the functional specification, create configuration drawings of the configuration drawings control equipment: Overview drawing that shows the location of each PLC in relation to the process or machine. ...
  • Page 81: Using Blocks To Structure Your Program

    Programming concepts 5.3 Using blocks to structure your program Linear structure: Modular structure: By creating generic code blocks that can be reused within the user program, you can simplify the design and implementation of the user program. Using generic code blocks has a number of benefits: ●...
  • Page 82: Organization Block (Ob)

    Programming concepts 5.3 Using blocks to structure your program Processing continues with execution of the instruction that follows after the block call. You can nest the block calls for a more modular structure. ① Start of cycle ② Nesting depth Creating reusable code blocks Use the "Add new block"...
  • Page 83 Programming concepts 5.3 Using blocks to structure your program After finishing the processing of the program cycle OBs, the CPU immediately executes the program cycle OBs again. This cyclic processing is the "normal" type of processing used for programmable logic controllers. For many applications, the entire user program is located in a single program cycle OB.
  • Page 84: Function (Fc)

    Programming concepts 5.3 Using blocks to structure your program Configuring the operation of an OB You can modify the operational parameters for an OB. For example, you can configure the time parameter for a time-delay OB or for a cyclic OB. 5.3.2 Function (FC) A function (FC) is a code block that typically performs a specific operation on a set of input...
  • Page 85 Programming concepts 5.3 Using blocks to structure your program Reusable code blocks with associated memory You typically use an FB to control the operation for tasks or devices that do not finish their operation within one scan cycle. To store the operating parameters so that they can be quickly accessed from one scan to the next, each FB in your user program has one or more instance DBs.
  • Page 86: Data Block (Db)

    Programming concepts 5.4 Understanding data consistency 5.3.4 Data block (DB) You create data blocks (DB) in your user program to store data for the code blocks. All of the program blocks in the user program can access the data in a global DB, but an instance DB stores data for a specific function block (FB).
  • Page 87: Selecting The Programming Language

    Programming concepts 5.5 Selecting the programming language instructions in an interrupt OB, use a DIS_AIRT instruction to delay any interruption (an interrupt OB or a communication interrupt from an HMI or another CPU) until an EN_AIRT instruction is executed. Note The use of the DIS_AIRT instruction delays the processing of interrupt OBs until the EN_AIRT instruction is executed, affecting the interrupt latency (time from an event to the time when the interrupt OB is executed) of your user program.
  • Page 88 Programming concepts 5.5 Selecting the programming language ● You cannot create a branch that would cause a short circuit. Function Block Diagram (FBD) programming language Like LAD, FBD is also a graphical programming language. The representation of the logic is based on the graphical logic symbols used in Boolean algebra.
  • Page 89: Copy Protection

    Programming concepts 5.6 Copy protection Copy protection Copy or "know-how" protection allows you to prevent one or more code blocks (OB, FB, or FC) in your program from unauthorized access. You create a password to limit access to the code block. When you configure a block for "know-how"...
  • Page 90: Uploading The Elements Of Your Program

    Programming concepts 5.8 Uploading the elements of your program Uploading the elements of your program You can upload all program blocks and the tag table from an online CPU to an offline project, but you cannot upload the device configuration or watch tables. You cannot upload into an empty project;...
  • Page 91: Debugging And Testing The Program

    Programming concepts 5.9 Debugging and testing the program Debugging and testing the program You use "watch tables" for monitoring and modifying the values of a user program being executed by the online CPU. You can create and save different watch tables in your project to support a variety of test environments.
  • Page 92 Programming concepts 5.9 Debugging and testing the program S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 93: Programming Instructions

    Programming instructions Basic instructions 6.1.1 Bit logic LAD contacts You can connect contacts to other contacts and create your own combination logic. If the input bit you specify uses memory identifier I (input) or Q (output), then the bit value is read from the process-image register. The physical contact signals in your control process are wired to I terminals on the PLC.
  • Page 94 Programming instructions 6.1 Basic instructions AND logic OR logic XOR logic Parameter Data type Description IN1, IN2 Bool Input bit ● All inputs of an AND box must be TRUE for the output to be TRUE. ● Any input of an OR box must be TRUE for the output to be TRUE. ●...
  • Page 95: Set And Reset Instructions

    Programming instructions 6.1 Basic instructions Parameter Data type Description Bool Assigned bit ● If there is power flow through an output coil, then the output bit is set to 1. ● If there is no power flow through an output coil, then the output coil bit is set to 0. ●...
  • Page 96 Programming instructions 6.1 Basic instructions Parameter Data type Description IN (or connect to contact/gate logic) Bool Bit location to be monitored Bool Bit location to be set or reset SET_BF and RESET_BF: Set and Reset Bit Field LAD: SET_BF LAD: RESET_BF FBD: SET_BF FBD: RESET_BF Parameter...
  • Page 97: Positive And Negative Edge Instructions

    Programming instructions 6.1 Basic instructions Instruction "OUT" bit Previous state Previous state 6.1.1.2 Positive and negative edge instructions Positive and Negative transition detectors P contact: LAD N contact: LAD P box: FBD N box: FBD P coil: LAD N coil: LAD P= box: FBD N= box: FBD P_TRIG: LAD\FBD...
  • Page 98 Programming instructions 6.1 Basic instructions P contact: The state of this contact is TRUE when a positive transition (OFF-to-ON) is detected on the assigned "IN" bit. The contact logic state is then combined with the power flow in state to set the power flow out state. The P contact can be located anywhere in the network except the end of a branch.
  • Page 99: Timers

    Programming instructions 6.1 Basic instructions Note Edge instructions evaluate the input and memory-bit values each time they are executed, including the first execution. You must account for the initial states of the input and memory bit in your program design either to allow or to avoid edge detection on the first scan. Because the memory bit must be maintained from one execution to the next, you should use a unique bit for each edge instruction, and you should not use this bit any other place in your program.
  • Page 100 Programming instructions 6.1 Basic instructions Parameter Data type Description Bool Enable timer input Bool Reset TONR elapsed time to zero Bool Preset time value input Bool Timer output Time Elapsed time value output Timer data block Specify which timer to reset with the RT instruction Parameter IN starts and stops the timers: ●...
  • Page 101 Programming instructions 6.1 Basic instructions Pulse timing diagram TON: ON-delay timing diagram TOF: OFF-delay timing diagram S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 102: Counters

    Programming instructions 6.1 Basic instructions TONR: ON-delay Retentive timing diagram 6.1.3 Counters 6.1.3.1 Counters You use the counter instructions to count internal program events and external process events: ● CTU is a count up counter. ● CTD is a count down counter. ●...
  • Page 103 Programming instructions 6.1 Basic instructions Select the count value data type from the drop-down list under the box name. Create your own "Counter name" that names the counter Data Block and describes the purpose of this counter in your process. Parameter Data type Description...
  • Page 104 Programming instructions 6.1 Basic instructions CTU: CTU counts up by 1 when the value of parameter CU changes from 0 to 1. If the value of parameter CV (Current count value) is greater than or equal to the value of parameter PV (Preset count value), then the counter output parameter Q = 1.
  • Page 105: Ctrl_Hsc Instruction

    Programming instructions 6.1 Basic instructions CTUD: CTUD counts up or down by 1 on the 0 to 1 transition of the Count up (CU) or Count down (CD) inputs. If the value of parameter CV (Current count value) is equal to or greater than the value of parameter PV (Preset value), then the counter output parameter QU = 1.
  • Page 106 Programming instructions 6.1 Basic instructions Parameter Parameter Data type Description type HW_HSC HSC identifier Bool 1 = Request new direction Bool 1 = Request to set new counter value Bool 1= Request to set new reference value PERIOD Bool 1 = Request to set new period value (only for frequency measurement mode) NEW_DIR New direction:...
  • Page 107: Operation Of The High-Speed Counter

    Programming instructions 6.1 Basic instructions The current count value is not available in the CTRL_HSC parameters. The Process Image address that stores the current count value is assigned during the high-speed counter hardware configuration. You may use program logic to directly read the count value and the value returned to your program will be a correct count for the instant in which the counter was read.
  • Page 108 Programming instructions 6.1 Basic instructions Selecting the functionality for the HSC All HSCs function the same way for the same counter mode of operation. There are four basic types of HSC: ● Single-phase counter with internal direction control ● Single-phase counter with external direction control ●...
  • Page 109 Programming instructions 6.1 Basic instructions Description Default Input Assignment Function HSC1 Built In I0.0 I0.1 I0.3 or Signal Board I4.0 I4.1 I4.3 or monitor PTO 0 PTO 0 Pulse PTO 0 Direction HSC: Built In I0.2 I0.3 I0.1 or signal board I4.2 I4.3 I4.1...
  • Page 110: Configuration Of The Hsc

    Programming instructions 6.1 Basic instructions Digital I/O points assigned to HSC devices cannot be forced The digital I/O points used by high-speed counter 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 Watch table force function.
  • Page 111: Compare

    Programming instructions 6.1 Basic instructions 6.1.4 Compare You use the compare instructions to compare two values of the same data type. When the LAD contact comparison is TRUE, then the contact is activated. When the FBD box comparison is TRUE, then the box output is TRUE. After you click on the instruction in the program editor, you can select the comparison type and data type from the drop-down menus.
  • Page 112 Programming instructions 6.1 Basic instructions Relation type The comparison is true if: IN1 is equal to IN2 <> IN1 is not equal to IN2 >= IN1 is greater than or equal to IN2 <= IN1 is less than or equal to IN2 >...
  • Page 113: Math

    Programming instructions 6.1 Basic instructions OK and Not OK instructions You use the OK and NOT_OK instructions to test whether an input data reference is a valid real number according to IEEE specification 754. When the LAD contact is TRUE, the contact is activated and passes power flow.
  • Page 114: Mod Instruction

    Programming instructions 6.1 Basic instructions Parameter Data type Description IN1, IN2 SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Constant Math operation inputs SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal Math operation output 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).
  • Page 115 Programming instructions 6.1 Basic instructions ENO status Description No error Value IN2 = 0, OUT is assigned the value zero NEG instruction You use the NEG (negation) instruction to invert the arithmetic sign of the value at parameter IN and store the result in parameter OUT. Click below the box name and select a data type from the drop-down menu.
  • Page 116 Programming instructions 6.1 Basic instructions ENO status Description No error The resulting value is outside the valid number range of the selected data type. Example for SInt: INC (127) results in -128 which exceeds the data type maximum. Absolute Value instruction You use the ABS instruction to get the absolute value of a signed integer or real number at parameter IN and store the result in parameter OUT.
  • Page 117 Programming instructions 6.1 Basic instructions Note The IN1, IN2, and OUT parameters must be the same data type. Parameter Data type Description IN1, IN2 SInt, Int, DInt, USInt, UInt, UDInt, Real, Math operation inputs Constant SInt, Int, DInt, USInt, UInt, UDInt, Real Math operation output ENO status Description...
  • Page 118 Programming instructions 6.1 Basic instructions ENO status Description No error Real: If one or more of the values for MIN, IN and MAX is NaN (Not a Number), then NaN is returned. If MIN is greater than MAX, the value IN is assigned to OUT. Floating-point math instructions You use the floating point instructions to program mathematical operations using a Real or LReal data type:...
  • Page 119: Move

    Programming instructions 6.1 Basic instructions Instruction Condition Result (OUT) status No error Valid result Result exceeds valid Real/LReal range +INF IN is +/- NaN (not a number) +NaN SQRT IN is negative -NaN IN is +/- INF (infinity) or +/- NaN +/- INF or +/- NaN IN is 0.0, negative, -INF, or -NaN -NaN...
  • Page 120 Programming instructions 6.1 Basic instructions MOVE Parameter Data type Description SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Byte, Source address Word, DWord, Char, Array, Struct, DTL, Time SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Byte, Destination address Word, DWord, Char, Array, Struct, DTL, Time MOVE_BLK, UMOVE_BLK Parameter Data type...
  • Page 121 Programming instructions 6.1 Basic instructions ENO status Condition Result No error All COUNT elements were successfully copied Either the source (IN) range or the Elements that fit are copied. No destination (OUT) range exceeds the partial elements are copied. available memory area Fill instructions You use the FILL_BLK and UFILL_BLK instructions as follows: ...
  • Page 122: Swap Instruction

    Programming instructions 6.1 Basic instructions FILL_BLK and UFILL_BLK instructions differ in how interrupts are handled: ● Interrupt events are queued and processed during FILL_BLK execution. Use the FILL_BLK instruction when the data at the move destination address is not used within an interrupt OB subprogram or, if used, the destination data does not have to be consistent.
  • Page 123: Convert

    Programming instructions 6.1 Basic instructions 6.1.7 Convert Convert instruction You use the CONVERT instruction to convert a data element from one data type to another data type. Click below the box name and then select IN and OUT data types from the dropdown list. After you select the (convert from) data type, a list of possible conversions is shown in the (convert to) dropdown list.
  • Page 124: Scale And Normalize Instructions

    Programming instructions 6.1 Basic instructions ENO status Description Result OUT No error Valid result IN is +/- INF or +/- NaN +/- INF or +/- NaN Ceiling and Floor instructions CEIL converts a real number to the smallest integer greater than or equal to that real number (IEEE - round to +infinity).
  • Page 125 Programming instructions 6.1 Basic instructions Parameter Data type Description SInt, Int, DInt, USInt, UInt, UDInt, Real Input minimum value for range VALUE SCALE_X: Real Input value to scale or normalize NORM_X: SInt, Int, DInt, USInt, UInt, UDInt, Real SInt, Int, DInt, USInt, UInt, UDInt, Real Input maximum value for range SCALE_X: SInt, Int, DInt, USInt, UInt, UDInt, Real Scaled or Normalized output...
  • Page 126: Program Control

    Programming instructions 6.1 Basic instructions 6.1.8 Program control Jump and label instructions You use program control instructions for conditional control of the execution sequence: JMP: If there is power flow to a JMP coil (LAD), or if the JMP box input is true (FBD), then program execution continues with the first instruction following the specified label.
  • Page 127: Logical Operations

    Programming instructions 6.1 Basic instructions Sample steps for using the RET instruction inside an FC code block: 1. Create a new project and add an FC: 2. Edit the FC: – Add instructions from the instruction tree. – Add a RET instruction, including one of the following for the "Return_Value" parameter: TRUE, FALSE, or a memory location that specifies the required return value.
  • Page 128 Programming instructions 6.1 Basic instructions Parameter Data type Description SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord Data element to invert SInt, Int, DInt, USInt, UInt, UDInt, Byte, Word, DWord Inverted output Encode and decode instructions ENCO encodes a bit pattern to a binary number. DECO decodes a binary number to a bit pattern.
  • Page 129 Programming instructions 6.1 Basic instructions DECO IN value DECO OUT value ( Decode single bit position) Byte OUT (8 bits): Min. IN 00000001 Max. IN 10000000 Word OUT (16 bits): Min. IN 0000000000000001 Max. IN 1000000000000000 DWord OUT: (32 bits): Min.
  • Page 130: Shift And Rotate

    Programming instructions 6.1 Basic instructions Data type Description UInt Selector value: 0 for IN0  1 for IN1   IN0, IN1, ..SInt, Int, DInt, USInt, UInt, UDInt, Real, Byte, Word, Inputs DWord, Time, Char ELSE SInt, Int, DInt, USInt, UInt, UDInt, Real, Byte, Word, Input substitute value DWord, Time, Char (optional)
  • Page 131 Programming instructions 6.1 Basic instructions Parameter Data type Description Byte, Word, DWord Bit pattern to shift UInt Number of bit positions to shift Byte, Word, DWord Bit pattern after shift operation ● For N=0, no shift occurs and the IN value is assigned to OUT. ●...
  • Page 132: Extended Instructions

    Programming instructions 6.2 Extended instructions Extended instructions 6.2.1 Common error parameters for extended instructions The extended instruction descriptions describe run-time errors that can occur for each program instruction. In addition to these errors, the common errors listed below are also possible.
  • Page 133 Programming instructions 6.2 Extended instructions Data type Size (bits) Valid ranges Minute: USInt 0 to 59 Second: USInt 0 to 59 Nanoseconds: UDInt 0 to 999,999,999 T_CONV (Time Convert) converts a Time data type to a DInt data type, or the reverse conversion from DInt data type to Time data type.
  • Page 134 Programming instructions 6.2 Extended instructions Parameter Parameter Data type Description type DTL, Time DTL or Time value Time Time value to subtract DTL, Time DTL or Time 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.
  • Page 135 Programming instructions 6.2 Extended instructions Parameter Parameter Data type Description type Time of day to set in the PLC system clock RET_VAL Execution condition code RD_SYS_T (Read System Time) reads the current system time from the PLC. This time value does not include local time zone or daylight saving time offsets.
  • Page 136: String And Character Instructions

    Programming instructions 6.2 Extended instructions RET_VAL (W#16#..) Description 8083 Illegal day value 8084 Illegal hour value 8085 Illegal minute value 8086 Illegal second value 8087 Illegal nanosecond value 80B0 The real-time clock has failed 6.2.3 String and character instructions 6.2.3.1 String data overview String data type String data is stored as a 2-byte header followed by up to 254 character bytes of ASCII...
  • Page 137 Programming instructions 6.2 Extended instructions S_CONV (String Convert) converts a character string to the corresponding value, or a value to the corresponding character string. The S_CONV instruction has no output formatting options. This makes the S_CONV instruction simpler, but less flexible, than the STRG_VAL and VAL_STRG instructions.
  • Page 138 Programming instructions 6.2 Extended instructions The following table shows the maximum possible string lengths required for each supported data type. IN data Maximum number of converted Example Total string length including type characters in OUT string maximum and current length bytes USInt SInt -128...
  • Page 139 Programming instructions 6.2 Extended instructions STRG_VAL FORMAT parameter The FORMAT parameter for the STRG_VAL instruction is defined below. The unused bit positions must be set to zero. Bit 8 Bit 7 Bit 0 f = Notation format 1= Exponential notation 0 = Fixed point notation r = Decimal point format 1 = ","...
  • Page 140 Programming instructions 6.2 Extended instructions Parameter Parameter Data type Description type SInt, Int, DInt, USInt, UInt, Value to convert UDInt, Real SIZE USInt Number of characters to be written to the OUT string PREC USInt The precision or size of the fractional portion.
  • Page 141 Programming instructions 6.2 Extended instructions FORMAT (WORD) Number sign character Notation format 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 ","...
  • Page 142 Programming instructions 6.2 Extended instructions ENO status Description No error Illegal or invalid parameter; for example, an access to a DB that does not exist Illegal string where the maximum length of the string is 0 or 255 Illegal string where the current length is greater than the maximum length 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...
  • Page 143 Programming instructions 6.2 Extended instructions Examples of S_CONV value to string conversion Data type IN value OUT string UInt "123" TRUE UInt "0" TRUE UDInt 12345678 "12345678" TRUE Real -INF "INF" FALSE Real +INF "INF" FALSE Real "NaN" FALSE Examples of STRG_VAL conversion IN string FORMAT OUT data type...
  • Page 144: String Operation Instructions

    Programming instructions 6.2 Extended instructions Examples of VAL_STRG conversion The examples are based on an OUT string initialized as follows: "Current Temp = xxxxxxxxxx C" The "x"character represents space characters allocated for the converted value. Data IN value SIZE FORMAT PREC OUT string type...
  • Page 145 Programming instructions 6.2 Extended instructions LEN: Get string length CONCAT: Concatenate two strings LEFT: Get left substring from RIGHT: Get right substring string form string MID: Get middle substring FIND: Find substring or from string character in string INSERT: Insert substring in DELETE: Delete substring string from string...
  • Page 146 Programming instructions 6.2 Extended instructions CONCAT instruction Parameter Parameter Data type Description type String Input string 1 String Input string 2 String Combined string (string 1 + string 2) CONCAT (Concatenate strings) joins String parameters IN1 and IN2 to form one string provided at OUT.
  • Page 147 Programming instructions 6.2 Extended instructions RIGHT instruction Parameter Parameter Data type Description type String Input string Length of the substring to be created, using the right- most L characters of the IN string String Output string RIGHT (Right substring) provides the last L characters of a string. ●...
  • Page 148 Programming instructions 6.2 Extended instructions DELETE instruction Parameter Parameter Data type Description type String Input string Number of characters to be deleted Position of the first character to be deleted: The first character of the IN string is position number 1 String Output string DELETE (Delete substring) deletes L characters from string IN.
  • Page 149 Programming instructions 6.2 Extended instructions Condition Resulting string after insertion is larger than Resulting string characters are copied maximum length of OUT string until the maximum length of OUT is reached REPLACE Parameter Parameter Data type Description type String Input string String String of replacement characters Number of characters to replace...
  • Page 150: Program Control Instructions

    Programming instructions 6.2 Extended instructions occurrence of IN2 string is returned at OUT. If the string IN2 is not found in the string IN1, then zero is returned. The following table shows the condition codes for the instruction. Condition No errors detected Valid character position IN2 is larger than IN1 Character position is set to 0...
  • Page 151: Stop Scan Cycle Instruction

    Programming instructions 6.2 Extended instructions 6.2.4.2 Stop scan cycle instruction STP (Stop PLC scan cycle) puts the PLC in Stop mode. When the PLC is in Stop mode, the execution of your program and physical updates from the process image are stopped. For more information see: Configuring the outputs on a RUN-to-STOP transition (Page 48) If EN = TRUE, then the PLC will enter STOP mode, program execution stops, and the ENO state is meaningless.
  • Page 152 Programming instructions 6.2 Extended instructions ErrorStruct data element Data Description type MODE Byte Internal mapping for how the remaining fields will be interpreted to be used by STEP 7 Basic PAD_1 Byte Internal fill byte for alignment purposes; not used, will be 0 OPERAND_NUMBER UInt Internal instruction operand number...
  • Page 153 Programming instructions 6.2 Extended instructions ERROR_ID ERROR_ID Program block execution error Hexadecimal Decimal 253E 9534 Wrong version or FB does not exist 253F 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...
  • Page 154: Communications Instructions

    Programming instructions 6.2 Extended instructions 6.2.5 Communications instructions 6.2.5.1 Open Ethernet Communication Open Ethernet communication with automatic connect/disconnect (TSEND_C and TRCV_C) Note The processing of the TSEND_C and TRCV_C instructions can take an undetermined amount of time. To ensure that these instructions are processed in every scan cycle, always call them from within the main program cycle scan, such as from a program cycle OB or from a code block that is called from the program cycle scan.
  • Page 155 Programming instructions 6.2 Extended instructions TRCV_C description TRCV_C establishes a TCP or ISO on TCP communication connection to a partner CPU, receives data, and can terminate the connection. After the connection is set up and established, it is automatically maintained and monitored by the CPU. The TRCV_C instruction combines the functions of the TCON, TDISCON, and TRCV instructions.
  • Page 156 Programming instructions 6.2 Extended instructions BUSY DONE ERROR Description 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. TSEND_C parameters Parameter Parameter...
  • Page 157 Programming instructions 6.2 Extended instructions TRCV_C parameters Parameter Parameter Data type Description type EN_R Bool Control parameter enabled to receive: When EN_R = 1, TRCV_C is ready to receive. The receive job is processed. CONT Bool Control parameter CONT: 0: disconnect ...
  • Page 158 Programming instructions 6.2 Extended instructions ERROR STATUS Description (W#16#...) 7002 Data being sent or received 7003 Connection being terminated 7004 Connection established and monitored, no job processing active 8085 LEN parameter is greater than the largest permitted value 8086 The CONNECT parameter is outside the permitted range 8087 Maximum number of connections reached;...
  • Page 159 Programming instructions 6.2 Extended instructions ERROR STATUS Description (W#16#...) 80C4 Temporary communications error: The connection cannot be established at this time  The interface is receiving new parameters  The configured connection is currently being removed by a TDISCON  8722 CONNECT parameter: Source area invalid: area does not exist in DB 873A...
  • Page 160 Programming instructions 6.2 Extended instructions An existing connection is terminated and the set-up connection is removed when the TDISCON instruction is executed or when the CPU has gone into STOP mode. To set up and reestablish the connection, you must execute TCON again. Functional description TCON, TDISCON, TSEND, and TRCV operate asynchronously, which means that the job processing extends over multiple instruction executions.
  • Page 161 Programming instructions 6.2 Extended instructions Parameter Parameter Data type Description type BUSY Bool BUSY = 1: Job is not yet complete BUSY = 0: Job is complete ERROR Bool Status parameter ERROR: ERROR = 1: An error occurred in job processing. STATUS provides detailed information on the type of error.
  • Page 162 Programming instructions 6.2 Extended instructions TSEND Parameter Parameter Data type Description type Bool Control parameter REQUEST starts the send job on a rising edge. The data is transferred from the area specified by DATA and LEN. CONN_OUC Reference to the associated connection. ID must be (Word) identical to the associated parameter ID in the local connection description.
  • Page 163 Programming instructions 6.2 Extended instructions TRCV Parameter Parameter Data type Description type EN_R Bool Control parameter enabled to receive: With EN_R = 1, TRCV is ready to receive. The receive job is being processed. CONN_OUC Reference to the associated connection. ID must be (Word) identical to the associated parameter ID in the local connection description.
  • Page 164 Programming instructions 6.2 Extended instructions Receive area The TRCV instruction writes the received data to a receive area that is specified by the following two variables: ● Pointer to the start of the area ● Length of the area Note The default setting of the LEN parameter (LEN = 0) uses the DATA parameter to determine the length of the data being transmitted.
  • Page 165 Programming instructions 6.2 Extended instructions ERROR STATUS Explanation (W#16#...) 80B4 When using the ISO on TCP (connection_type = B#16#12) to establish a passive connection, condition code 80B4 alerts you that the TSAP entered did not conform to one of the following address requirements: For a local TSAP length of 2 and a TSAP ID value of either E0 or E1 ...
  • Page 166 Programming instructions 6.2 Extended instructions ERROR STATUS Explanation (W#16#...) 7002 Follow-on call (REQ irrelevant), job being processed: The operating system accesses the data in the DATA send area during this processing. 8085 LEN parameter is greater than the largest permitted value. 8086 The ID parameter is not in the permitted address range 8088...
  • Page 167: Point-To-Point Instructions

    Programming instructions 6.2 Extended instructions 6.2.5.2 Point-to-Point instructions The Point-to-Point (PtP) chapter (Page 237) provides detailed information about the PtP instructions and the communication modules. 6.2.6 Interrupt instructions 6.2.6.1 Attach and detach instructions You can activate and deactivate interrupt event-driven subprograms with the ATTACH and DETACH instructions.
  • Page 168 Programming instructions 6.2 Extended instructions Hardware interrupt events The following hardware interrupt events are supported by the CPU: ● Rising edge events (all built-in CPU digital inputs plus any signal board digital inputs) – A rising edge occurs when the digital input transitions from OFF to ON as a response to a change in the signal from a field device connected to the input.
  • Page 169 Programming instructions 6.2 Extended instructions Adding new hardware interrupt OB code blocks to your program By default, no OB is attached to an event when the event is first enabled. This is indicated by the "HW interrupt:" device configuration "<not connected>" label. Only hardware-interrupt OBs can be attached to a hardware interrupt event.
  • Page 170: Start And Cancel Time Delay Interrupt Instructions

    Programming instructions 6.2 Extended instructions Condition codes RET_VAL ENO status Description (W#16#..) 0000 No error 0001 Nothing to Detach (DETACH only) 8090 OB does not exist 8091 OB is wrong type 8093 Event does not exist 6.2.6.2 Start and cancel time delay interrupt instructions You can start and cancel time delay interrupt processing with the SRT_DINT and CAN_DINT instructions.
  • Page 171 Programming instructions 6.2 Extended instructions CAN_DINT parameters Parameter Parameter Data type Description type OB_NR Time delay interrupt OB identifier. You can use an OB number or symbolic name. RET_VAL Execution condition code Operation The SRT_DINT instruction specifies a time delay, starts the internal time delay timer, and associates a time delay interrupt OB subprogram with the time delay timeout event.
  • Page 172: Disable And Enable Alarm Interrupt Instructions

    Programming instructions 6.2 Extended instructions 6.2.6.3 Disable and Enable alarm interrupt instructions Use the DIS_AIRT and EN_AIRT instructions to disable and enable alarm interrupt processing. DIS_AIRT delays the processing of new interrupt events. You can execute DIS_AIRT more than once in an OB. The DIS_AIRT executions are counted by the operating system.
  • Page 173: Motion Control Instructions

    Programming instructions 6.2 Extended instructions 6.2.8 Motion control instructions The motion control instructions use an associated technology data block and the dedicated PTO (pulse train outputs) of the CPU to control the motion on an axis. For information about the motion control instructions, refer to the online help of STEP 7 Basic. NOTICE The maximum pulse frequency of the pulse output generators is 100 KHz for the digital outputs of the CPU and 20 KHz for the digital outputs of the signal board.
  • Page 174: Pulse Instruction

    Programming instructions 6.2 Extended instructions MC_MoveAbsolute starts MC_MoveRelative starts a MC_MoveVelocity causes motion to an absolute position. positioning motion relative the axis to travel with the The job ends when the target to the start position. specified speed. position is reached. Note Pulse-train outputs cannot be used by other instructions in the user program When you configure the outputs of the CPU or signal board as pulse generators (for use with...
  • Page 175 Programming instructions 6.2 Extended instructions Two 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. The two pulse generators are mapped to specific digital outputs as shown in the following table.
  • Page 176 Programming instructions 6.2 Extended instructions ● Pulse width format: – Hundreths (0 to 100) – Thousandths (0 to 1000) – Ten-thousandths (0 to 10000) – S7 analog format (0 to 27648) ● Cycle time: Enter your cycle time value. This value can only be changed in Device configuration.
  • Page 177: Global Library Instructions

    Global library instructions 6.3.1 The USS Protocol library makes controlling Siemens drives which support USS protocol. The instructions include functions that are specifically designed for using the USS protocol to communicate with the drive. The CM 1241 RS485 module communicates with the drives on RS485 ports.
  • Page 178 Programming instructions 6.3 Global library instructions A single Instance Data Block contains temporary storage and buffers for all drives on the USS network connected to each PtP communication module you install. The USS functions for these drives share the information in this data block. All drives (up to 16) connected to a single CM 1241 RS485 are part of the same USS network.
  • Page 179 Programming instructions 6.3 Global library instructions The USS_PORT function handles actual communication between the CPU and the drives via the PtP communication module. Each call to this function handles one communication with one drive. Your program must call this function fast enough to prevent a communication timeout by the drives.
  • Page 180: Uss_Drv Instruction

    Programming instructions 6.3 Global library instructions 6.3.1.2 USS_DRV instruction The USS_DRV instruction exchanges data with the drive by creating request messages and interpreting the drive response messages. A separate function block should be used for each drive, but all USS functions associated with one USS network and PtP communication module must use the same Instance Data Block.
  • Page 181 Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type Bool Drive start bit: When true, this input enables the drive to run at the preset speed. OFF2 Bool Electrical stop bit: When false, this bit cause the drive to coast to a stop with no braking.
  • Page 182: Uss_Port Instruction

    Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type RUN_EN Bool Run enabled – This bit indicates whether the drive is running. D_DIR Bool Drive direction – This bit indicates whether the drive is running forward. INHIBIT Bool Drive inhibited –...
  • Page 183: Uss_Rpm Instruction

    Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type PORT Port PtP communications module. Identifier: This a constant which can be referenced within the "Constants" tab of the default tag table. BAUD DInt The Baud Rate to be used for USS communication. USS_DB DInt This is a reference to the instance DB that is created and...
  • Page 184: Uss_Wpm Instruction

    Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type VALUE Word, Int, This is the value of the parameter that was read and is valid UInt, only when the DONE bit is true. DWord, DInt, UDInt, Real DONE Bool Done: When TRUE indicates that the VALUE output holds...
  • Page 185 Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type Bool Send request: When true, it indicates that a new write request is desired. This is ignored if the request for this parameter is already pending. DRIVE USInt Drive address: This input is the address of the USS drive.
  • Page 186: Uss Status Codes

    Programming instructions 6.3 Global library instructions 6.3.1.6 USS status codes USS instruction status codes are returned at the STATUS output of the USS functions. STATUS value Description (W#16#..) 0000 No error 8180 The length of the drive response did not match the characters received from the drive. The drive number where the error occurred is returned in the "USS_Extended_Error"...
  • Page 187: Modbus

    Programming instructions 6.3 Global library instructions 6.3.2 MODBUS 6.3.2.1 MB_COMM_LOAD The MB_COMM_LOAD instruction configures a port on the Point-to-Point (PtP) CM 1241 RS485 or CM 1241 RS232 module for Modbus RTU protocol communications. Parameter Parameter Data type Description type PORT UInt Communications port identifier: After you install the CM module in the Device configuration, the port...
  • Page 188 Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type RTS_OFF_DLY UInt RTS OFF Delay Selection: 0 – (default) No delay from the last character transmitted until RTS  goes inactive 1 to 65535 – Delay in milliseconds from the last character transmitted ...
  • Page 189: Mb_Master

    Programming instructions 6.3 Global library instructions 6.3.2.2 MB_MASTER The MB_MASTER instruction allows your program to communicate as a Modbus master using a port on the Point-to-Point (PtP) CM 1241 RS485 or CM 1241 RS232 module. You can access data in one or more Modbus slave devices.
  • Page 190 Programming instructions 6.3 Global library instructions Modbus master communication rules ● MB_COMM_LOAD must be executed to configure a port before a MB_MASTER instruction can communicate with that port. ● If a port is to be used to initiate Modbus master requests, that port cannot be used by MB_SLAVE .
  • Page 191 Reads an event counter word from the Modbus slave that is referenced as an input to MB_ADDR  On a Siemens S7-1200 Modbus slave, this counter is incremented every time that the slave receives a valid read or  write (non-broadcast) request from a Modbus master.
  • Page 192 Programming instructions 6.3 Global library instructions DATA_PTR parameter The DATA_PTR parameter points to the local source or destination address (the address in the S7-1200 CPU) of the data that is written to or read from, respectively. When you use the MB_MASTER instruction to create a Modbus master, you must create a global data block that provides data storage for reads and writes to Modbus slaves.
  • Page 193 Programming instructions 6.3 Global library instructions The arrows indicate how each array is associated to different MB_MASTER instructions. The first element of any array or structure is always the first source or destination of any Modbus read or write activity. All the scenarios below are based on the diagram above. Scenario 1: If the first MB_MASTER instruction reads 3 words of data from Modbus address 40001 on any valid Modbus slave, then the following occurs.
  • Page 194 Programming instructions 6.3 Global library instructions Scenario 3: If the second MB_MASTER instruction reads 2 words of data from Modbus address 30033 on any valid Modbus slave, then the following occurs. The word from address 30033 is stored in "Data".Array_2[1]. The word from address 30034 is stored in "Data".Array_2[2].
  • Page 195 Programming instructions 6.3 Global library instructions Table 6- 2 Scenario 8: Read 12 output bits starting at Modbus address 00003 MB_MASTER input values Slave Modbus values MB_ADDR 27 (Slave example) 00001 00010 MODE 0 (Read) 00002 00011 DATA_ADDR 00003 (Outputs) 00003 00012 DATA_LEN...
  • Page 196 Programming instructions 6.3 Global library instructions Table 6- 4 Scenario 10: Read 22 output bits starting at Modbus address 00003 MB_MASTER input values Slave Modbus values MB_ADDR 27 (Slave example) 00001 00014 MODE 0 (Read) 00002 00015 DATA_ADDR 00003 (Outputs) 00003 00016 DATA_LEN...
  • Page 197 Programming instructions 6.3 Global library instructions Scenarios 11 and 12 show the correspondence of Modbus addresses to Boolean array addresses. Table 6- 5 Scenario 11: Write 5 output bits starting at Modbus address 00001 MB_MASTER input values Slave outputs before DATA_PTR data Slave outputs after MB_ADDR...
  • Page 198 Programming instructions 6.3 Global library instructions Table 6- 6 Scenario 12: Read 15 output bits starting at Modbus address 00004 MB_MASTER input values Slave Modbus value DATA_PTR data after MB_ADDR 27 (Slave example) 00001 MODE 0 (Read) 00002 DATA_ADDR 00003 (Outputs) 00003 "Data".Bool[0]=FALSE DATA_LEN...
  • Page 199: Mb_Slave

    Programming instructions 6.3 Global library instructions STATUS value Description (W#16#..) 8188 Invalid Mode value or write mode to read only slave address area 8189 Invalid Data Address value 818A Invalid Data Length value Invalid pointer to the local data source/destination: Size not correct 818B ...
  • Page 200 Programming instructions 6.3 Global library instructions 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. 000AH Clear communication event counter: The MB_SLAVE will clear out the communication event counter that is used for Modbus function 11.
  • Page 201 Programming instructions 6.3 Global library instructions Parameter Parameter Data type Description type ERROR BOOL Error: 0 – No error detected  1 – Indicates that an error was detected and the  error code supplied at parameter STATUS is valid. STATUS WORD Error code...
  • Page 202 Programming instructions 6.3 Global library instructions the data block and assign the data type structure that will be read from and written to, before it can be used with the MB_SLAVE instruction. Note The Modbus Holding Register data block must reference a global data block which was created with the Symbolic Access Only attribute box unchecked.
  • Page 203 Programming instructions 6.3 Global library instructions Each element of the array can be accessed by symbolic name, as shown below. In this example, a new value is moved into the second element of the array which corresponds to Modbus address 40002. Each of the words in the array, as defined in the data block, provides the MB_SLAVE instruction with Modbus holding register addresses.
  • Page 204 Programming instructions 6.3 Global library instructions The image below shows how the data structure above would be assigned to the MB_HOLD_REG input of an MB_SLAVE instruction in your program. Each element of the array can be accessed by its symbolic name as shown below. In this example, a new value is moved into the second element of the array which corresponds to Modbus address 40002.
  • Page 205 Programming instructions 6.3 Global library instructions Example 3 - Named complex structure This example holding register is a series of series of mixed data types with descriptive symbolic names.  Each structure element has a descriptive name with a specific data Advantages: type assigned to it.
  • Page 206 Programming instructions 6.3 Global library instructions from the slave's HR_DB data block into the master's ProcessData data block, as shown below. A series of Modbus master Data_PTR data block locations can be used to transfer the same or different structures from multiple Modbus slaves. Condition codes STATUS value Description...
  • Page 207 Programming instructions 6.3 Global library instructions STATUS value Description (W#16#..) Response code sent to Modbus master (B#16#..) 8380 No response CRC error 8381 Function code not supported 8382 No response Data length error 8383 Data address error 8384 Data value error 8385 Data diagnostic code value not supported (function code 08) S7-1200 Programmable controller...
  • Page 208 Programming instructions 6.3 Global library instructions S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 209: Profinet

    ● ISO on TCP (RFC 1006) The S7-1200 CPU can communicate with other S7-1200 CPUs, with the STEP 7 Basic programming device, with HMI devices, and with non-Siemens devices using standard TCP communications protocols. There are two ways to communicate using PROFINET: ●...
  • Page 210: Communication With A Programming Device

    HMI and a CPU. An Ethernet switch is required for a network with more than two CPUs or HMI devices. The rack-mounted Siemens CSM1277 4-port Ethernet switch can be used to connect your CPUs and HMI devices. The PROFINET port on the S7-1200 CPU does not contain an Ethernet switching device.
  • Page 211: Establishing The Hardware Communications Connection

    PROFINET 7.2 Communication with a programming device 7.2.1 Establishing the hardware communications connection The PROFINET interfaces establish the physical connections between a programming device and a CPU. Since Auto-Cross-Over functionality is built into the CPU, either a standard or crossover Ethernet cable can be used for the interface. An Ethernet switch is not required to connect a programming device directly to a CPU.
  • Page 212: Assigning Internet Protocol (Ip) Addresses

    PROFINET 7.2 Communication with a programming device 7.2.3 Assigning Internet Protocol (IP) addresses 7.2.3.1 Assigning IP addresses to programming and network devices If your programming device is using an on-board adapter card connected to your plant LAN (and possibly the world-wide web), the IP Address Network ID and subnet mask of your CPU and the programming device's on-board adapter card must be exactly the same.
  • Page 213 PROFINET 7.2 Communication with a programming device Programming Device Network Type Internet Protocol (IP) Address Subnet Mask Adapter Card On-board adapter Connected to Network ID of your CPU and the The subnet mask of your CPU and the card your plant LAN programming device's on-board on-board adapter card must be exactly (and possibly...
  • Page 214: Assigning An Ip Address Online

    PROFINET 7.2 Communication with a programming device Checking the IP address of your programming device using the "ipconfig" and "ipconfig /all" commands You can also check the IP address of your programming device, and, if applicable, the IP address of your IP router (Gateway) with the following menu selections: ●...
  • Page 215 PROFINET 7.2 Communication with a programming device Use the following procedure to assign an IP address online: 1. In the "Project tree," verify that no IP address is assigned to the CPU, with the following menu selections:  "Online access" ...
  • Page 216 PROFINET 7.2 Communication with a programming device 3. In the "Online & diagnostics" dialog, make the following menu selections:  "Functions"  "Assign IP address" 4. In the "IP address" field, enter your new IP address. 5. In the "Project tree," verify that your new IP address has been assigned to the CPU, with the following menu selections:...
  • Page 217: Configuring An Ip Address In Your Project

    PROFINET 7.2 Communication with a programming device 7.2.3.3 Configuring an IP address in your project Configuring the PROFINET interface After you configure the rack with the CPU (Page 211) , you can configure parameters for the PROFINET interface. To do so, click the green PROFINET box on the CPU to select the PROFINET port.
  • Page 218 PROFINET 7.2 Communication with a programming device IP addresses properties: In the Properties window, select the "Ethernet address" configuration entry. The TIA Portal displays the Ethernet address configuration dialog, which associates the software project with the IP address of the CPU that will receive that project.
  • Page 219: Testing The Profinet Network

    PROFINET 7.2 Communication with a programming device 7.2.4 Testing the PROFINET network After completing the configuration, download the project to the CPU. All IP addresses are configured when you download the project. Assigning an IP address to a device online The S7-1200 CPU does not have a pre-configured IP address.
  • Page 220 PROFINET 7.2 Communication with a programming device Use "Online access" to display the connected CPU's IP address as shown below. ① Second of two Ethernet networks on this programming device ② IP address of the only S7-1200 CPU on this Ethernet network Note All configured networks of the programming device are displayed.
  • Page 221: Hmi-To-Plc Communication

    Note The rack-mounted Siemens CSM1277 4-port Ethernet switch can be used to connect your CPUs and HMI devices. The PROFINET port on the CPU does not contain an Ethernet switching device.
  • Page 222: Configuring The Logical Network Connections Between An Hmi And A Cpu

    PROFINET 7.3 HMI-to-PLC communication Required steps in configuring communications between an HMI and a CPU Step Task Establishing the hardware communications connection A PROFINET interface establishes the physical connection between an HMI and a CPU. Since Auto-Cross-Over functionality is built into the CPU, you can use either a standard or crossover Ethernet cable for the interface.
  • Page 223: Plc-To-Plc Communication

    PROFINET 7.4 PLC-to-PLC communication Action Result 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. PLC-to-PLC communication A CPU can communicate with another CPU on a network by using the TSEND_C and TRCV_C...
  • Page 224: Configuring The Logical Network Connections Between Two Cpus

    PROFINET 7.4 PLC-to-PLC communication Required steps in configuring communications between two CPUs Step Task Establishing the hardware communications connection A PROFINET interface establishes the physical connection between two CPUs. Since Auto- Cross-Over functionality is built into the CPU, you can use either a standard or crossover Ethernet cable for the interface.
  • Page 225: Configuring Transmit (Send) And Receive Parameters

    PROFINET 7.4 PLC-to-PLC communication Action Result 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. 7.4.2 Configuring transmit (send) and receive parameters Transmission block (T-block) communications are used to establish connections between...
  • Page 226 PROFINET 7.4 PLC-to-PLC communication From the Device configuration in STEP 7 Basic, you can configure how a TSEND_C instruction transmits data. To begin, you insert the instruction into the program from the "Communications" folder in the "Extended Instructions". The instruction is displayed, along with the Call options dialog where you assign a DB for storing the parameters of the TSEND_C instruction.
  • Page 227 PROFINET 7.4 PLC-to-PLC communication Configuring Connection parameters Every CPU has an integrated PROFINET port, which supports standard PROFINET communications. The supported Ethernet protocols are described in the following two connection types: Protocol Protocol Name Usage ISO on TCP Message fragmentation and re-assembly 1006 Transport Controool Protocol Transport of frames...
  • Page 228 PROFINET 7.4 PLC-to-PLC communication Parameter Definition General End point: Partner Name assigned to the partner (receiving) CPU Interface Name assigned to the interfaces Subnet Name assigned to the subnets Address Assigned IP Addresses Connection type Type of Ethernet protocol Connection ID ID number Connection data Local and Partner CPU data storage location...
  • Page 229: Configuring The Trcv_C Instruction Receive Parameters

    PROFINET 7.4 PLC-to-PLC communication Parameter Definition General End point: Partner Name assigned to the partner (receiving) CPU Interface Name assigned to the interfaces Subnet Name assigned to the subnets Address Assigned IP Addresses Connection type Type of Ethernet protocol Connection ID ID number Connection data Local and Partner CPU data storage location...
  • Page 230 PROFINET 7.4 PLC-to-PLC communication You can assign tag memory locations to the inputs and outputs, as shown as in the following figure. Configuring the General parameters You specify the communication 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.
  • Page 231 PROFINET 7.4 PLC-to-PLC communication Configuring the Connection parameters Every CPU has an integrated PROFINET port, which supports standard PROFINET communications. The supported Ethernet protocols are described in the following two connection types: Protocol Protocol Name Usage RFC 1006 ISO on TCP Message fragmentation and re-assembly Transport Control Protocol Transport of frames...
  • Page 232 PROFINET 7.4 PLC-to-PLC communication Parameter Definition General End point: Partner Name assigned to the partner (receiving) CPU Interface Name assigned to the interfaces Subnet Name assigned to the subnets Address Assigned IP Addresses Connection type Type of Ethernet protocol Connection ID ID number Connection data Local and Partner CPU data storage location...
  • Page 233: Reference Information

    PROFINET 7.5 Reference Information Parameter Definition General End point: Partner Name assigned to the partner (receiving) CPU Interface Name assigned to the interfaces Subnet Name assigned to the subnets Address Assigned IP Addresses Connection type Type of Ethernet protocol Connection ID ID number Connection data Local and Partner CPU data storage location...
  • Page 234: Configuring Network Time Protocol Synchronization

    PROFINET 7.5 Reference Information ① MAC address Initially, the CPU has no IP address, only a factory-installed MAC address. PROFINET communications requires that all devices be assigned a unique IP address. Use the CPU "Download to device" function and the "Extended download to device"...
  • Page 235 PROFINET 7.5 Reference Information Time synchronization parameters In the Properties window, select the "Time synchronization" configuration entry. The TIA Portal displays the Time synchronization configuration dialog: Note All IP addresses are configured when you download the project. The following table defines the parameters for time synchronization: Parameter Definition Enable time-of-day...
  • Page 236 PROFINET 7.5 Reference Information S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 237: Point-To-Point (Ptp) Communications

    Point-to-Point (PtP) communications The CPU supports the Point-to-Point protocol (PtP) for character-based serial communication, in which the user application completely defines and implements the protocol of choice. PtP provides maximum freedom and flexibility, but requires extensive implementation in the user program. PtP enables a wide variety of possibilities: ...
  • Page 238: Configuring The Communication Ports

    Point-to-Point (PtP) communications 8.3 Configuring the communication ports ● Displays transmit and receive activity by means of LEDs ● Displays a diagnostic LED ● Powered by the CPU. No external power connection is needed. Refer to the Technical Specifications for Communication Modules (Page 317). Configuring the communication ports The communication modules can be configured by two methods: ●...
  • Page 239: Managing Flow Control

    Point-to-Point (PtP) communications 8.4 Managing flow control Baud rate: The default value for the baud rate is 9.6 kbits per second. Valid choices are: 300 baud 2.4 kbits 19.2 kbits 76.8 kbits 600 baud 4.8 kbits 28.4 kbits 115.2 kbits 1.2 kbits 9.6 kbits 57.6 kbits...
  • Page 240 Point-to-Point (PtP) communications 8.4 Managing flow control Transmission resumes when the CTS signal becomes active. If the CTS signal does not become active within the configured wait time, the module aborts the transmission and returns an error to the user program. You specify the wait time in the port configuration (Page 238).
  • Page 241: Configuring The Transmit (Send) And Receive Parameters

    Point-to-Point (PtP) communications 8.5 Configuring the transmit (send) and receive parameters Configuring the transmit (send) and receive parameters Before the PLC can engage in PtP communications, you must configure parameters for transmitting (or sending) messages and receiving messages. These parameters dictate how communications operate when messages are being transmitted to or received from a target device.
  • Page 242 Point-to-Point (PtP) communications 8.5 Configuring the transmit (send) and receive parameters Configuring the Receive parameters From the device configuration, you configure how a communication interface receives data, and how it recognizes both the start of and the end of a message. Specify these parameters in the Receive message configuration for the selected CM.
  • Page 243 Point-to-Point (PtP) communications 8.5 Configuring the transmit (send) and receive parameters Parameter Definition Start Character The Start Character condition specifies that successfully receiving a character particular character will begin a message. This character will be the first character within a message. Any character that is received before this specific character will be discarded.
  • Page 244 Point-to-Point (PtP) communications 8.5 Configuring the transmit (send) and receive parameters Message end parameters You can also configure how the communication interface recognizes the end of a message. You can configure multiple message end conditions. If any one of the configured conditions occurs, the message ends.
  • Page 245 Point-to-Point (PtP) communications 8.5 Configuring the transmit (send) and receive parameters Parameter Definition Sample configuration In this case, the end condition is satisfied when two consecutive 0x7A characters are received, followed by any two characters. The character preceding the 0x7A 0x7A pattern is not part of the end character sequence. Two characters following the 0x7A 0x7A pattern are required to terminate the end character sequence.
  • Page 246: Programming The Ptp Communications

    Point-to-Point (PtP) communications 8.6 Programming the PtP communications Example 2: Consider another message structured according to the following protocol: Characters 5 to 10 counted by length Data unit=3 bytes 0x06 0x06 Configure the receive message length parameters for this message as follows: ●...
  • Page 247: Polling Architecture

    Point-to-Point (PtP) communications 8.6 Programming the PtP communications  SEND_PTP The communication modules send messages to and receive messages from the actual point-to-point devices. The message protocol is in a  RCV_PTP buffer that is either received from or sent to a specific communication port.
  • Page 248: Point-To-Point Instructions

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions If you set the cycle time for the OB to provide for two executions within the timeout period of the master, the user program should receive transmissions without missing any. Point-to-Point instructions 8.7.1 Common parameters for Point-to-Point instructions Communication module LED behaviors There are three LED indicators on the Communication module (CM): ●...
  • Page 249 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions PORT input parameter Select from the drop down menu (associated with the PORT input) the port identifier for the CM that you want this instance of the instruction to operate. This number is also found as the "hardware identifier"...
  • Page 250: Port_Cfg Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions 8.7.2 PORT_CFG instruction PORT_CFG (Port Configuration) allows you to change port parameters such as baud rate from your program. You can set up the initial static configuration of the port in the device configuration properties, or just use the default values. You can execute the PORT_CFG instruction in your program to change the configuration.
  • Page 251: Send_Cfg Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions Parameter Parameter Data type Description type FLOWCTRL UInt Flow control: 1 - No flow control 2 - XON/XOFF 3 - Hardware RTS always ON 4 - Hardware RTS switched XONCHAR Char Specify the character that is used as the XON character. This is typically a DC1 character (11H).
  • Page 252 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions You can set up the initial static configuration of the port in the device configuration properties, or just use the default values. You can execute the SEND_CFG instruction in your program to change the configuration. The SEND_CFG configuration changes are not permanently stored in the PLC.
  • Page 253: Rcv_Cfg Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions 8.7.4 RCV_CFG instruction RCV_CFG (Receive Configuration) performs dynamic configuration of serial receiver parameters for a Point-to-Point communication port. This instruction configures the conditions that signal the start and end of a received message. Any queued messages within a CM will be discarded when RCV_CFG is executed.
  • Page 254 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions ● Idle Line specifies that a message reception should start once the receive line has been idle or quiet for the number of specified bit times. Once this condition occurs, the start of a message will begin. ①...
  • Page 255 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions End conditions for the RCV_PTP instruction The end of a message is determined by the specification of end conditions. The end of a message is determined by the first occurrence of one or more configured end conditions. Possible message end conditions: ●...
  • Page 256 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions ● Intercharacter Gap is the time measured from the end of one character (the last stop bit) until the end of the next character. If the time between any two characters exceeds the number of configured bit times, the message will be terminated. ①...
  • Page 257 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions ignored are not required to be part of the message. Any trailing characters that are ignored are required to be part of the message. Parameter CONDITIONS data type structure part 1 (start conditions) Parameter Parameter Data type Description...
  • Page 258 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions Parameter CONDITIONS data type structure part 2 (end conditions) Parameter Parameter Data type Description type ENDCOND UInt This parameter specifies message end condition: 01H - Response time  02H - Message time  04H - Inter-character gap ...
  • Page 259: Send_Ptp Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions Condition codes STATUS Description (W#16#..) 80C0 Illegal start condition selected 80C1 Illegal end condition selected, no end condition selected 80C2 Receive interrupt enabled and this is not possible 80C3 Max length end condition is enabled and max length is 0 or > 1024 80C4 Calculated length is enabled and N is >= 1023 80C5...
  • Page 260 Data type Description type PTRCL Bool This parameter selects the buffer as normal point-to-point or specific Siemens-provided protocols that are implemented within the attached CM. FALSE = user program controlled point-to-point operations. (only valid option) DONE Bool TRUE for one scan, after the last request was completed...
  • Page 261 Point-to-Point (PtP) communications 8.7 Point-to-Point instructions The following diagram shows the relationship of DONE, ERROR and STATUS parameters when there is an error. STATUS Description (W#16#..) 80D0 New request while transmitter active 80D1 Transmit aborted because of no CTS within wait time 80D2 Transmit aborted because of no DSR from the DCE device 80D3...
  • Page 262: Rcv_Ptp Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions 8.7.6 RCV_PTP instruction RCV_PTP (Receive Point-to-Point) checks for messages that have been received in the CM. If a message is available, it will be transferred from the CM to the CPU. An error returns the appropriate STATUS value.
  • Page 263: Rcv_Rst Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions STATUS Description (W#16#...) 80E4 Message terminated because calculated length exceeds buffer size 0094 Message terminated due to received maximum character length 0095 Message terminated because of message timeout 0096 Message terminated because of inter-character timeout 0097 Message terminated because of response timeout 0098...
  • Page 264: Sgn_Get Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions 8.7.8 SGN_GET instruction SGN_GET (Get RS232 Signals) reads the current states of RS232 communication signals. This function is only valid for the RS232 CM (communication module). Parameter Parameter Data type Description type Bool Get RS232 signal state values on the rising edge of this input PORT PORT Communication port identifier:...
  • Page 265: Sgn_Set Instruction

    Point-to-Point (PtP) communications 8.7 Point-to-Point instructions 8.7.9 SGN_SET instruction SGN_SET (Set RS232 Signals) sets the states of RS232 communication signals. This function is only valid for the RS232 CM (communication module). Parameter Parameter Data type Description type Bool Start the set RS232 signals operation, on the rising edge of this input PORT PORT...
  • Page 266: Errors

    Point-to-Point (PtP) communications 8.8 Errors Errors Return values of PtP instructions Each PtP instruction has three outputs that provide the completion status: Parameter Data type Default Description DONE Boolean FALSE TRUE for one scan indicates that the last request completed without errors. ERROR Boolean FALSE...
  • Page 267 Point-to-Point (PtP) communications 8.8 Errors Transmit configuration errors Event / error ID Description 0x80B0 The specific protocol does not exist 0x80B1 The specific baud rate does not exist 0x80B2 The specific parity does not exist 0x80B3 The specific number of data bits does not exist 0x80B4 The specific number of stop bits does not exist 0x80B5...
  • Page 268 Point-to-Point (PtP) communications 8.8 Errors Event / error ID Description 0x80D1 The receiver issued a flow control request to suspend an active transmission and never re-enabled the transmission during the specified wait time This error is also generated during hardware flow control when the receiver does not assert CTS within the specified wait time 0x80D2 The transmit request was aborted because no DSR signal is received from the...
  • Page 269: Online And Diagnostic Tools

    Online and diagnostic tools Status LEDs The CPU and the I/O modules use LEDs to provide information about either the operational status of the module or the I/O. The CPU provides the following status indicators: ● STOP/RUN – Solid orange indicates STOP mode –...
  • Page 270: Going Online And Connecting To A Cpu

    Online and diagnostic tools 9.2 Going online and connecting to a CPU The CPU also provides two LEDs that indicate the status of the PROFINET communications. Open the bottom terminal block cover to view the PROFINET LEDs. ● Link (green) turns on to indicate a successful connection ●...
  • Page 271: Setting The Ip Address And Time Of Day

    Online and diagnostic tools 9.3 Setting the IP address and time of day You can then access the data on the target system in the online or diagnostics view using the "Online tools" task card. The current online status of a device is indicated by an icon to the right next to the device in the project navigation.
  • Page 272: Cpu Operator Panel For The Online Cpu

    Online and diagnostic tools 9.4 CPU operator panel for the online CPU CPU operator panel for the online CPU The "CPU operator panel" task card displays the operating mode (STOP or RUN) of the online CPU: The panel also shows whether the CPU has an error or if values are being forced.
  • Page 273: Watch Tables For Monitoring The User Program

    Online and diagnostic tools 9.7 Watch tables for monitoring the user program The first entry contains the latest event. Each entry in the diagnostic buffer contains the date and time the event was logged, and a description. The maximum number of entries is dependent on the CPU.
  • Page 274 Online and diagnostic tools 9.7 Watch tables for monitoring the user program To create a watch table: 1. Double-click "Add new watch table" to open a new watch table. 2. Enter the tag name to add a tag to the watch table. The following options are available for monitoring tags: ...
  • Page 275 Online and diagnostic tools 9.7 Watch tables for monitoring the user program Using a trigger when monitoring or modifying PLC tags Triggering determines at what point in the scan cycle the selected address will be monitored or modified. Trigger Type Description Permanent Continuously collects the data...
  • Page 276 Online and diagnostic tools 9.7 Watch tables for monitoring the user program Enabling outputs in STOP mode The watch table allows you to write to the outputs when the CPU is in STOP mode. This functionality allows you to check the wiring of the outputs and verify that the wire connected to an output pin initiates a high or low signal to the terminal of the process device to which it is connected.
  • Page 277 Online and diagnostic tools 9.7 Watch tables for monitoring the user program Startup The clearing of the I memory area is not ① While writing Q memory to the physical affected by the Force function. outputs, the CPU applies the force value as the outputs are updated.
  • Page 278 Online and diagnostic tools 9.7 Watch tables for monitoring the user program S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 279: Technical Specifications

    ● EC Directive 94/9/EC (ATEX) "Equipment and Protective Systems Intended for Use in Potentially Explosive Atmosphere – EN 60079-15:2005: Type of Protection 'n' The CE Declaration of Conformity is held on file available to competent authorities at: Siemens AG IA AS RD ST PLC Amberg Werner-von-Siemens-Str. 50 D92224 Amberg...
  • Page 280  Canadian Standards Association: CSA C22.2 Number 142 (Process Control Equipment) NOTICE 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.
  • Page 281 Maritime approval The S7-1200 products are periodically submitted for special agency approvals related to specific markets and applications. Consult your local Siemens representative if you need additional information related to the latest listing of exact approvals by part number. Classification societies: ●...
  • Page 282 Technical specifications A.1 General Technical Specifications Electromagnetic Compatibility - Immunity per EN 61000-6-2 EN 61000-4-6 150 kHz to 80 MHz, 10 V RMS, 80% AM at 1kHz Conducted disturbances EN 61000-4-11 AC systems Voltage dips 0% for 1 cycle, 40% for 12 cycles and 70% for 30 cycles at 60 Hz Electromagnetic Compatibility - Conducted and Radiated Emissions per EN 61000-6-4 Conducted Emissions EN 55011, Class A, Group 1...
  • Page 283 Technical specifications A.1 General Technical Specifications Protection Class ● Protection Class II according to EN 61131-2 (Protective conductor not required) Degree of protection ● IP20 Mechanical Protection, EN 60529 ● Protects against finger contact with high voltage as tested by standard probe. External protection required for dust, dirt, water and foreign objects of <...
  • Page 284: Cpus

    Technical specifications A.2 CPUs CPUs A.2.1 CPU 1211C Specifications Technical Specifications Model CPU 1211C CPU 1211C CPU 1211C AC/DC/Relay DC/DC/Relay DC/DC/DC Order number (MLFB) 6ES7 211-1BD30-0XB0 6ES7 211-1HD30-0XB0 6ES7 211-1AD30-0XB0 General Dimensions W x H x D (mm) 90 x 100 x 75 Weight 420 grams 380 grams...
  • Page 285 Technical specifications A.2 CPUs Technical Specifications Model CPU 1211C CPU 1211C CPU 1211C AC/DC/Relay DC/DC/Relay DC/DC/DC 3 for HMI Connections  1 for programming device  8 for Ethernet instructions in the user program  3 for CPU-to-CPU  Data rates 10/100 Mb/s Isolation (external signal to PLC Transformer isolated, 1500 VDC...
  • Page 286 Technical specifications A.2 CPUs Technical Specifications Model CPU 1211C CPU 1211C CPU 1211C AC/DC/Relay DC/DC/Relay DC/DC/DC Cable length (meters) 500 shielded, 300 unshielded, 50 shielded for HSC inputs Analog inputs Number of inputs Type Voltage (single-ended) Range 0 to 10 V Full-scale range (data word) 0 to 27648 (refer to Analog input representation for voltage (Page 306) ) Overshoot range (data word)
  • Page 287 Technical specifications A.2 CPUs Technical Specifications Model CPU 1211C CPU 1211C CPU 1211C AC/DC/Relay DC/DC/Relay DC/DC/DC Pulse Train Output rate Not recommended 100 KHz max., (Qa.0 and Qa.2) 2 Hz min. Lifetime mechanical (no load) 10,000,000 open/close cycles Lifetime contacts at rated load 100,000 open/close cycles Behavior on RUN to STOP Last value or substitute value (default value 0)
  • Page 288 Technical specifications A.2 CPUs ① 24 VDC Sensor Power Out Figure A-2 CPU 1211C DC/DC/Relay (6ES7 211-1HD30-0XB0) ① 24 VDC Sensor Power Out Figure A-3 CPU 1211C DC/DC/DC (6ES7 211-1AD30-0XB0) S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 289: Cpu 1212C Specifications

    Technical specifications A.2 CPUs A.2.2 CPU 1212C Specifications Technical Specifications Model CPU 1212C CPU 1212C CPU 1212C AC/DC/Relay DC/DC/Relay DC/DC/DC Order number (MLFB) 6ES7 212-1BD30-0XB0 6ES7 212-1HD30-0XB0 6ES7 212-1AD30-0XB0 General Dimensions W x H x D (mm) 90 x 100 x 75 Weight 425 grams 385 grams...
  • Page 290 Technical specifications A.2 CPUs Technical Specifications Model CPU 1212C CPU 1212C CPU 1212C AC/DC/Relay DC/DC/Relay DC/DC/DC Data rates 10/100 Mb/s Isolation (external signal to PLC Transformer isolated, 1500 VDC logic) Cable type CAT5e shielded Power supply Voltage range 85 to 264 VAC 20.4 to 28.8 VDC Line frequency 47 to 63 Hz...
  • Page 291 Technical specifications A.2 CPUs Technical Specifications Model CPU 1212C CPU 1212C CPU 1212C AC/DC/Relay DC/DC/Relay DC/DC/DC Full-scale range (data word) 0 to 27648 (Refer to Analog input representation for voltage (Page 306) ) Overshoot range (data word) 27,649 to 32,511 (Refer to Analog input representation for voltage (Page 306) ) Overflow (data word) 32,512 to 32767 (Refer to Analog input representation for voltage (Page 306) ) Resolution...
  • Page 292 Technical specifications A.2 CPUs Technical Specifications Model CPU 1212C CPU 1212C CPU 1212C AC/DC/Relay DC/DC/Relay DC/DC/DC Number of Outputs On simultaneously Cable length (meters) 500 shielded, 150 unshielded Wiring Diagrams ① 24 VDC Sensor Power Out Figure A-4 CPU 1212C AC/DC Relay (6ES7 212-1BD30-0XB0) S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 293 Technical specifications A.2 CPUs ① 24 VDC Sensor Power Out Figure A-5 CPU 1212C DC/DC/Relay (6ES7 212-1HD30-0XB0) ① 24 VDC Sensor Power Out Figure A-6 CPU 1212C DC/DC/DC (6ES7 212-1AD30-0XB0) S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 294: Cpu 1214C Specifications

    Technical specifications A.2 CPUs A.2.3 CPU 1214C Specifications Technical Specifications Model CPU 1214C CPU 1214C CPU 1214C AC/DC/Relay DC/DC/Relay DC/DC/DC Order number (MLFB) 6ES7 214-1BE30-0XB0 6ES7 214-1HE30-0XB0 6ES7 214-1AE30-0XB0 General Dimensions W x H x D (mm) 110 x 100 x 75 Weight 475 grams 435 grams...
  • Page 295 Technical specifications A.2 CPUs Technical Specifications Model CPU 1214C CPU 1214C CPU 1214C AC/DC/Relay DC/DC/Relay DC/DC/DC Data rates 10/100 Mb/s Isolation (external signal to PLC Transformer isolated, 1500 VDC logic) Cable type CAT5e shielded Power supply Voltage range 85 to 264 VAC 20.4 to 28.8 VDC Line frequency 47 to 63 Hz...
  • Page 296 Technical specifications A.2 CPUs Technical Specifications Model CPU 1214C CPU 1214C CPU 1214C AC/DC/Relay DC/DC/Relay DC/DC/DC Range 0 to 10 V Full-scale range (data word) 0 to 27648 (Refer to Analog input representation for voltage (Page 306)) Overshoot range (data word) 27,649 to 32,511 (Refer to Analog input representation for voltage (Page 306) ) Overflow (data word) 32,512 to 32767 (Refer to Analog input representation for voltage (Page 306) )
  • Page 297 Technical specifications A.2 CPUs Technical Specifications Model CPU 1214C CPU 1214C CPU 1214C AC/DC/Relay DC/DC/Relay DC/DC/DC Behavior on RUN to STOP Last value or substitute value (default value 0) Number of Outputs On simultaneously Cable length (meters) 500 shielded, 150 unshielded Wiring Diagrams ①...
  • Page 298 Technical specifications A.2 CPUs ① 24 VDC Sensor Power Out Figure A-8 CPU 1214C DC/DC/Relay (6ES7 214-1HE30-0XB0) ① 24 VDC Sensor Power Out Figure A-9 CPU 1214C DC/DC/DC (6ES7 214-1AE30-0XB0) S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 299: Digital Signal Modules (Sms)

    Technical specifications A.3 Digital signal modules (SMs) Digital signal modules (SMs) A.3.1 SM 1221 Digital Input Specifications Technical Specifications Model SM 1221 DI 8x24VDC SM 1221 DI 16x24VDC Order number (MLFB) 6ES7 221-1BF30-0XB0 6ES7 221-1BH30-0XB0 General Dimensions W x H x D (mm) 45 x 100 x 75 Weight 170 grams...
  • Page 300 Technical specifications A.3 Digital signal modules (SMs) Wiring diagrams SM 1221 DI 8 x 24 VDC SM 1221 DI 16 x 24 VDC 6ES7 221-1BF30-0XB0 6ES7 221-1BH30-0XB0 S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 301: Sm 1222 Digital Output Specifications

    Technical specifications A.3 Digital signal modules (SMs) A.3.2 SM 1222 Digital Output Specifications Technical Specifications Model SM 1222 SM1222 SM1222 SM1222 DQ 8xRelay DQ 16xRelay DQ 8x24VDC DQ 16x24VDC Order number (MLFB) 6ES7 222-1HF30- 6ES7 222-1HH30- 6ES7 222-1BF30- 6ES7 222-1BH30- 0XB0 0XB0 0XB0...
  • Page 302 Technical specifications A.3 Digital signal modules (SMs) Wiring Diagrams SM 1222 DQ 8 x Relay SM 1222 DQ 8 x 24 VDC 6ES7 222-1HF30-0XB0 6ES7 222-1BF30-0XB0 SM 1222 DQ 16 x Relay SM 1222 DQ 16 x 24 VDC 6ES7 222-1HH30-0XB0 6ES7 222-1BH30-0XB0 S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 303: Sm 1223 Digital Input/Output Specifications

    Technical specifications A.3 Digital signal modules (SMs) A.3.3 SM 1223 Digital Input/Output Specifications Technical Specifications Model SM 1223 DI 8x24 SM 1223 DI 16x24 SM 1223 DI 8x24 SM 1223 DI 16x24 VDC, DQ 8xRelay VDC, DQ VDC, DQ 8x24 VDC, DQ16x24 16xRelay Order number (MLFB)
  • Page 304 Technical specifications A.3 Digital signal modules (SMs) Technical Specifications Model SM 1223 DI 8x24 SM 1223 DI 16x24 SM 1223 DI 8x24 SM 1223 DI 16x24 VDC, DQ 8xRelay VDC, DQ VDC, DQ 8x24 VDC, DQ16x24 16xRelay Isolation groups Current per common Inductive clamp voltage L+ minus 48 V, 1 W dissipation Switching delay...
  • Page 305 Technical specifications A.3 Digital signal modules (SMs) SM 1223 DI 8 x 24 VDC, DQ 8 x 24 VDC SM 1223 DI 16 x 24 VDC, DQ 16 x 24 VDC 6ES7 223-1BH30-0XB0 6ES7 223-1BL30-0XB0 S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 306: Analog Signal Modules (Sms)

    Technical specifications A.4 Analog signal modules (SMs) Analog signal modules (SMs) A.4.1 SM 1231, SM 1232, SM 1234 Analog Specifications Technical Specifications Model SM 1231 AI 4x13bit SM 1231 AI 8x13bit SM 1234 AI 4x13bit AQ 2x14bit Order number (MLFB) 6ES7 231-4HD30-0XB0 6ES7 231-4HF30-0XB0 6ES7 234-4HE30-0XB0...
  • Page 307 Technical specifications A.4 Analog signal modules (SMs) Technical Specifications Model SM 1231 AI 4x13bit SM 1231 AI 8x13bit SM 1234 AI 4x13bit AQ 2x14bit Diagnostics Overflow/underflow Short to ground (voltage mode only) Not applicable Not applicable Yes on outputs Wire break (current mode only) Not applicable Not applicable Yes on outputs...
  • Page 308 Technical specifications A.4 Analog signal modules (SMs) Analog input response time SM Analog Modules Step Response (ms) 0V to 10V measured at 95% Smoothing Selection Rejection Frequency 400 Hz 60 Hz 50 Hz 10 Hz None Weak Medium 1200 Strong 2410 Sample Rate 4 channels...
  • Page 309 Technical specifications A.4 Analog signal modules (SMs) Analog input representation for voltage System Voltage Measuring Range Decimal Hexadecimal ±10 V ±5 V ±2.5 V 0 to 10 V 32767 7FFF 11.851 V 5.926 V 2.963 V Overflow 11.851V Overflow 32512 7F00 Overshoot range Overshoot...
  • Page 310 Technical specifications A.4 Analog signal modules (SMs) Analog output representation for voltage System Voltage Output Range Decimal Hexadecimal ± 10 V 32767 7FFF See note 1 Overflow 32512 7F00 See note 1 Overshoot range 32511 7EFF 11.76 V 27649 6C01 27648 6C00 10 V...
  • Page 311 Technical specifications A.4 Analog signal modules (SMs) Wiring Diagrams SM 1231 AI 4 x 13 bit SM 1231 AI 8 x 13 bit 6ES7 231-4HD30-0XB0 6ES7 231-4HF30-0XB0 S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 312 Technical specifications A.4 Analog signal modules (SMs) SM 1232 AQ 2 x 14 bit SM 1232 AQ 4 x 14 bit 6ES7 232-4HB30-0XB0 6ES7 232-4HD30-0XB0 SM 1234 AI 4 x 13 Bit / AQ 2 x 14 bit 6ES7 234-4HE30-0XB0 S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 313: Signal Boards (Sbs)

    Technical specifications A.5 Signal boards (SBs) Signal boards (SBs) A.5.1 SB 1223 2 X 24 VDC Input / 2 X 24 VDC Output Specifications Digital signal board specifications Technical Data Model SB 1223 DI 2x24VDC, DQ 2x24VDC Order number (MLFB) 6ES7 223-0BD30-0XB0 General Dimensions W x H x D (mm)
  • Page 314 Technical specifications A.5 Signal boards (SBs) Technical Data Model SB 1223 DI 2x24VDC, DQ 2x24VDC Surge current 5 A for 100 ms max. Overload protection Isolation (field side to logic) 500 VAC for 1 minute Isolation groups Currents per common Inductive clamp voltage L+ minus 48 V, 1 W dissipation Switching delay...
  • Page 315: Sb 1232 1 Analog Output Specifications

    Technical specifications A.5 Signal boards (SBs) A.5.2 SB 1232 1 Analog Output Specifications Analog signal board specifications Technical Data Model SB 1223 AQ 1x12bit Order no. (MLFB) 6ES7 232-4HA30-0XB0 General Dimensions W x H x D (mm) 38 x 62 x 21 mm Weight 40 grams Power dissipation...
  • Page 316 Technical specifications A.5 Signal boards (SBs) SB 1232 1 x Analog Output wiring diagram S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 317: Communication Modules (Cms)

    Technical specifications A.6 Communication modules (CMs) Communication modules (CMs) A.6.1 CM 1241 RS485 Specifications Table A- 1 Communication Module CM 1241 RS485 Technical Data Order no. (MLFB) 6ES7 241-1CH30-0XB0 Dimensions and weight Dimensions 30 x 100 x 75 mm Weight 150 grams Transmitter and Receiver Common mode voltage range...
  • Page 318: Cm 1241 Rs232 Specifications

    Technical specifications A.7 SIMATIC memory cards A.6.2 CM 1241 RS232 Specifications Communication Module CM 1241 RS232 Technical Data Order no. (MLFB) 6ES7 241-1AH30-0XB0 Dimensions and weight Dimensions 30 x 100 x 75 mm Weight 150 grams Transmitter and Receiver Transmitter output voltage +/- 5 V min.
  • Page 319: Input Simulators

    Technical specifications A.8 Input simulators Input simulators Model 8 Position Simulator 14 Position Simulator Order number (MLFB) 6ES7 274-1XF30-0XA0 6ES7 274-1XH30-0XA0 Dimensions W x H x D (mm) 43 x 35 x 23 67 x 35 x 23 Weight 20 grams 30 grams Points Used with CPU...
  • Page 320: I/O Expansion Cable

    Technical specifications A.9 I/O expansion cable 14 Position Simulator ① 24 VDC sensor power out 6ES7 274-1XH30-0XA0 I/O expansion cable Technical Data Order no (MLFB) 6ES7 290-6AA30-0XA0 Cable length Weight 200 g The I/O expansion cable has a male and female connector. 1.
  • Page 321: Calculating A Power Budget

    Calculating a power budget The CPU has an internal power supply that provides power for the CPU itself, for any expansion modules, and for other 24 VDC user power requirements. There are three types of expansion modules: ● Signal modules (SM) are installed on the right-side of the CPU. Each CPU allows a maximum number of signal modules possible without regard to the power budget.
  • Page 322: Calculating A Sample Power Requirement

    Calculating a power budget B.2 Calculating a sample power requirement WARNING Connecting non-isolated M terminals to different reference potentials will cause unintended current flows that may cause damage or unpredictable operation in the PLC and connected equipment. Such damage or unpredictable operation could result in death, severe personal injury and/or property damage.
  • Page 323: Calculating Your Power Requirement

    Calculating a power budget B.3 Calculating your power requirement CPU power budget 5 VDC 24 VDC CPU 1214C AC/DC/Relay 1600 mA 400 mA Minus System requirements 5 VDC 24 VDC CPU 1214C, 14 inputs 14 * 4 mA = 56 mA 3 SM 1223, 5 V power 3 * 145 mA = 435 mA 1 SM 1221, 5 V power...
  • Page 324 Calculating a power budget B.3 Calculating your power requirement S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 325: Order Numbers

    Order numbers CPUs Order Number CPU 1211C CPU 1211C DC/DC/DC 6ES7 211-1AD30-0XB0 CPU 1211C AC/DC/Relay 6ES7 211-1BD30-0XB0 CPU 1211C DC/DC/Relay 6ES7 211-1HD30-0XB0 CPU 1212C CPU 1212C DC/DC/DC 6ES7 212-1AD30-0XB0 CPU 1212C AC/DC/Relay 6ES7 212-1BD30-0XB0 CPU 1212C DC/DC/Relay 6ES7 212-1HD30-0XB0 CPU 1214C CPU 1214C DC/DC/DC 6ES7 214-1AE30-0XB0 CPU 1214C AC/DC/Relay...
  • Page 326 Order numbers HMI devices Order Number KTP400 Basic (Mono, PN) 6AV6 647-0AA11-3AX0 KTP600 Basic (Mono, PN) 6AV6 647-0AB11-3AX0 KTP600 Basic (Color, PN) 6AV6 647-0AD11-3AX0 KTP1000 Basic (Color, PN) 6AV6 647-0AF11-3AX0 TP1500 Basic (Color, PN) 6AV6 647-0AG11-3AX0 Programming package Order Number STEP 7 Basic v10.5 6ES7 822-0AA0-0YA0 Memory cards, other hardware, and spare parts...
  • Page 327 Order numbers Documentation Order Number S7-1200 Programmable Controller System Manual German 6ES7 298-8FA30-8AH0   English 6ES7 298-8FA30-8BH0   French 6ES7 298-8FA30-8CH0   Spanish 6ES7 298-8FA30-8DH0   Italian 6ES7 298-8FA30-8EH0   Chinese 6ES7 298-8FA30-8KH0   S7-1200 Easy Book German 6ES7 298-8FA30-8AQ0...
  • Page 328 Order numbers S7-1200 Programmable controller System Manual, 11/2009, A5E02486680-02...
  • Page 329: Index

    Index Clock time-of-day clock, 50 Clock instructions, 134 read local time (RD_LOC_T), 134 Absolute value (ABS) instruction, 116 read system time (RD_SYS_T), 134 write system time (WR_SYS_T), 134 Inductive loads, 34 CM 1241 RS232 specifications, 318 Accessing the online help, 16 CM 1241 RS485 specifications, 317 Add (ADD) instruction, 113 Code block...
  • Page 330 Index communication interfaces, 238 Isolation guidelines, 33 Cycle time, 48 Lamp loads, 35 Discover, 71 Lost password, 53 HMI to CPU, 222 MAC address, 233 HSC (high-speed counter), 110 Network connection, 75 Industrial Ethernet port, 76, 217 online, 271 IP address, 76, 217 Operating modes, 39 PLC to PLC communication, 223 operating panel for online, 272...
  • Page 331 Index Inductive loads, 34 Event execution, 43 DEC (decrement) instruction, 115 Expanding the capabilities of the S7-1200, 12 Decode (DECO) instruction, 128 Expanding the online help window, 17 Designing a PLC system, 79, 80 DETACH interrupt instruction, 167 Device configuration, 69, 211 Add modules, 73 FB (function block), 84 Add new device, 70...
  • Page 332 Index Configuring the CPU, 72 Lamp loads, 35 Configuring the modules, 74 Mounting dimensions, 24 Discover, 71 Overview, 21 Ethernet port, 76, 217 Power budget, 22 Network connection, 75 Signal board (SB), 30 PROFINET, 76, 217 Signal module (SM), 27 Hardware flow control, 239 STEP 7, 14 Help, 16...
  • Page 333 Index MOD (modulo), 114 truncate (TRUNC), 123 move, 119 TSEND, 159 multiplex (MUX), 129 TSEND_C, 154, 225 multiply (MUL), 113 uninterruptible fill (UFILL_BLK), 121 NEG (negation), 115 uninterruptible move (UMOVE_BLK), 119 negative edge, 97 USS status codes, 186 normalize (NORM), 124 USS_DRV, 180 not OK, 113 USS_PORT, 182...
  • Page 334 Index Clearance, 22 Communication module (CM), 29 MAC address, 76, 217, 233 CPU, 26 Maritime approval, 281 Dimensions, 24 Master polling architecture, 247 Grounding, 33 Math instructions, 113 Guidelines, 21 MAX (maximum) instruction, 116 Inductive loads, 34 Maximum message length, 244 Isolation, 33 MB_COMM_LOAD, 187 Lamp loads, 35...
  • Page 335 Index Call, 42 IP address, 76, 217 configuring operation, 84 Network connection, 75 creating, 83 testing a network, 219 Function, 42 PROFINET interface multiple cyclic, 83 Ethernet address properties, 77, 218 Priority classes, 42 Time synchronization properties, 235 processing, 82 Program card, 66 Out-of-range instruction, 112 Program execution, 37...
  • Page 336 Index Ethernet port, 76, 217 Expanding the capabilities, 12 Queuing, 43 Grounding, 33 HMI devices, 19 Inductive loads, 34 installing a CM, 29 Rated voltages, 283 installing an SB, 30 RCV_CFG (receive configuration) instruction, 253 installing an SM, 27 RCV_PTP (receive Point-to-Point) instruction, 262 IP address, 76, 217 RCV_RST (receiver reset) instruction, 263 Isolation guidelines, 33...
  • Page 337 Index power requirements, 321 SM 1223 signal module, 303 Removal, 30 SM 1223 wiring diagram, 304 Signal board (SM) wiring diagrams: SM 1231, 1232, 1234, 311 Add new device, 70 SRT_DINT time delay interrupt instruction, 170 Signal handling errors, 267 Start conditions, 242 Signal module (SM) Start message character, 243...
  • Page 338 Index Ethernet port, 76, 217 USS protocol library, 177 Installation, 14 USS status codes, 186 Network connection, 75 USS_DRV instruction, 180 Portal view, 15 USS_PORT instruction, 182 PROFINET, 76, 217 USS_RPM instruction, 183 Project view, 15 USS_WPM instruction, 184 Time instructions, 132 Time of day, setting the online CPU, 271 Timer instructions, 99 TOF (off-delay) timer instruction, 99...

This manual is also suitable for:

Simatic s7-1200

Table of Contents