K-WANG

+086-15305925923
Service expert in industrial control field!
NameDescriptionContent
Adequate Inventory, Timely Service
pursuit of excellence 
Ship control system
Equipment control system
Power monitoring system
Current position:
新闻动态
newS
   
Brand

SIEMIENS S7-1200/1500 Controller TIA Portal Programming Guide

From: | Author:Wang | Time :2025-11-24 | 670 visit: | 🔊 Click to read aloud ❚❚ ▶ | Share:



SIEMIENS S7-1200/1500 Controller TIA Portal Programming Guide

Overview

The Siemens S7-1200/1500 Controller TIA Portal Programming Guide (V1.6 version) focuses on optimizing programming and covers the core innovations of the S7-1200/1500, such as optimization blocks, new data types VNet, direct machine code compilation, general programming specifications (block structure, symbol addressing, memory management), hardware independent programming methods, STEP 7 Safety programming points, and visual automatic generation solutions. It explicitly recommends using optimization blocks instead of non optimization blocks, symbol addressing instead of absolute addressing, and global data blocks instead of bit memory. At the same time, it provides a large number of performance optimization techniques (such as avoiding deep call hierarchy and using loop instructions reasonably), aiming to help users achieve standardized, efficient, and reusable automation program development.


S7-1200/1500 Core Innovation

1. Programming languages and compilation optimization

Language support differences:

Programming language S7-1200 S7-1500

Ladder diagram (LAD) ✅   ✅

Function Block Diagram (FBD) ✅   ✅

Structured Control Language (SCL) ✅   ✅

Statement Table (STL) ❌   ✅

Sequential Function Graph ❌   ✅

Compilation method: S7-1200/1500 generates machine code directly for all languages, without the intermediate step of "LAD/FBD → STL → machine code" for S7-300/400, ensuring consistent performance for all languages.

2. Optimize block technology (core innovation)

Optimized block vs non optimized block:

Feature optimization block (recommended) Non optimization block (only compatible)

Data storage is automatically sorted by data type, stored in declared order without gaps, and may have gaps

The addressing method can be either symbolic addressing or absolute addressing

Retention settings: A single label can be set to maintain the entire block or not to maintain it

Download feature supports uninitialized download (RUN mode update) not supported

Fast access speed (processor optimized storage) slow

Setting method: By default, "Optimize Block Access" is enabled for new blocks, which can be batch modified in the "Program Block" list; The optimization properties of instance DB inherit from the associated FB.

3. New data types

Core new type:

Data Type Applicable Controller Purpose Key Features

VARIANT S7-1500; S7-1200 (FW4.1+) dynamic pointer with type detection, replacing the ANY pointer, supporting symbol access

Date_Time_Long (DTL) both support timestamp storage containing year/month/day/nanosecond, with symbol accessible sub fields (such as DTL. Hour)

Both LReal and LReal support high-precision floating-point numbers of 64 bits and 15 decimal places, making them suitable for precise calculations

LTime only has a long-term storage range of ± 106751 days for S7-1500 and supports nanosecond level accuracy

WSRING only supports S7-1500 Unicode strings for multiple languages (such as Chinese and Latin), with a maximum of 16382 characters

4. Key instruction upgrade

MOVE series instructions:

Advantages of Instruction Usage

MOVE supports single value copying and complete copying of structures/arrays

MOVE_SLK array partial copy specifies the starting index and quantity, efficiently processing the array

MOVE_SLK_VARIANT Dynamic Type Copy Run Time Detect Data Types, Supports PLC Data Types/Arrays

The serialize/deserialize structure and byte array conversion are used for communication frame packaging/unpacking, supporting VNet input

Other instructions:

TypeOf(): detects the data type pointed to by VNet on the label (SCL only);

RUNTIME: measures program/block running time, supports performance optimization;

Multi assignment (V14+): such as # a:=# b:=# c:=0; Simplify initialization.

image.png

Universal Programming Specification

1. Program block structure

Core block type:

Key features of block type functionality

Organizational block (OB) operating system call, management program execution including loop OB (OB1), interrupt OB (OB40 hardware interrupt), etc; S7-1200 up to 100 cycles/start OB, S7-1500 supports clock interrupt OB

Function (FC) has no state block and no independent storage temporary label. Only the current call is valid, and data needs to be passed through parameters; Support direct participation of return values in SCL formulas

Function block (FB) has a status block that requires the instance DB static label to maintain its value; The instance DB structure is defined by FB and cannot be modified separately

Data Block (DB) stores data in a global DB for all blocks to access; Instance DB is only associated with FB usage

Block Reuse Techniques:

Multiple instances: FB calls other FBs to store data in their own instance DB, reducing the number of instance DBs;

Typeization block: Store FB/FC/PLC data types in the global library, supporting cross project reuse and batch updates.

2. Memory management

Memory type and access speed (from fast to slow):

Optimize the temporary labels, FC/FB parameters, and non persistent static labels of the block;

Optimize the retention labels of blocks and optimize the global database;

Non optimized blocks;

Array access for runtime calculation index (such as # Array [# i]);

Indirect memory access (such as pointer operations);

Data replication between optimized and non optimized blocks.

Key recommendations:

Replace bit memory with global DB (M-zone): The size of M-zone varies depending on the controller, while global DB is more flexible and supports optimized storage;

Use temporary tag caching for frequently accessed I/O tags to reduce the number of I/O accesses;

Retention setting: Only the necessary labels need to be set to hold (such as process parameters) to reduce the cost of saving power-off data.

3. Addressing method

Symbol addressing (mandatory recommendation):

Advantages: The tag name is descriptive (such as # Motor1_Run) and automatically updates when the address changes, reducing errors;

Operation: Simply enter the symbol name in the instruction input box, right-click on "Define Label" to quickly create it.

Indirect access scheme:

Indirect array access: Replace pointers with # Array [# Index], such as # Temp:=# MotorSpeed [# i];;

Slice access: Directly access the bits/bytes of Byte/Word/DWord, such as # WordVar.% X0 (bits), # DWordVar.% W1 (words).

4. Performance optimization techniques

Disable the ENO evaluation (LAD/FBD) of blocks to reduce runtime detection;

Avoid deep level calling (≤ 8 layers), otherwise TIA Portal will compile alarms and increase protection code overhead;

FOR loop: Do not manipulate the loop counter (compiler optimized times), use EXIT to interrupt the loop;

Reduce unnecessary IF instructions, such as # Motor:=# On1 AND # On2; Replace IF # On1 AND # On2 THEN # Motor:=TRUE;  ELSE #Motor:=FALSE;  END_IF;。


Hardware independent programming

1. Data type compatibility

Only use EN 61131-3 standard data types (such as INT/DINT/REAL/BOOL), avoiding S7-300/400 specific types (such as S5TIME);

The timer/counter of S7-1200/1500 uses IEC standard blocks (such as TON/CUTU) and is integrated through multiple instances to avoid absolute addresses (such as T37).

2. Clock signal replacement

Do not use hardware clock memory (such as M0.5), use programming clock generation block instead:

Example: SCL writes FB, sets the frequency through the # Frequency parameter, # Q outputs pulses, and # Countdown outputs the remaining time;

Advantage: The clock frequency can be flexibly adjusted without relying on hardware configuration.

STEP 7 Safety Programming

1. Core components

F operation group: the execution unit of safety programs, including 1 fault safety OB and 1 main safety block, with a maximum of 2 created;

F-signature: a unique identifier for each F-component (F-I/O, F-block) used to detect configuration/programming changes;

Security Management Editor: Manage F run groups, F signatures, access permissions, and set security program passwords.

2. Key specifications

Data exchange: Standard programs and security programs only interact through two standard DBs, avoiding direct access to the security DB;

Performance optimization:

Avoid using TP/TON/TOF instructions (add protection code);

Disable the JMP/Label structure (resulting in additional system protection blocks);

Loop call hierarchy ≤ 8 layers;

Test restriction: The security program can only force testing when the security mode is disabled, with a maximum of 5 F-I/O forced at a time.


 Visual automatic generation (SiVArc)

1. Basic requirements

Tools: TIA Portal V14++SiVArc Options Package;

Prerequisite: The program is modularized (such as motor control FB, conveyor belt FB), and the visualization library includes standard image templates.

2. Control mode

Network comment: Add a tag (such as "SiVArc: Generate=True") when calling the network on FB. The SiVArc rule triggers generation through Contains (Block. NetworkComment, "Generate=True");

SiVArc variable: Define a variable in the "Plugin" label of the block (such as Location="Bottling_Test"), and the rule filters the generated range based on the variable value.


  • GE 369B1860G0026 MPU50 Nexus Controller
  • GE IS420ESWBH3A Industrial ESWB Ethernet Switch
  • GE IS420ESWBH2A Mark VIe IONet Network Switch
  • GE IS200SRTDH2ACB RTD Terminal Board Mark VI
  • GE SR469-P5-HI-A20 Motor Protection Relay
  • GE VMIVME-7750 Pentium III VME CPU Module
  • GE IS215UCVEH2AE VMIVME-7614-132 VME Controller Card
  • GE MVDL800-47931101-A Liquid-Cooled Delta Module for MV3000 Medium Voltage Drive Systems
  • ABB BRC410 SPBRC410 Harmony Bridge Controller
  • ABB PFCL201CE-50kN 3BSE006699D0005 Pressductor PillowBlock Load Cell
  • ABB 5SHY3545L0009 3BHB013085R0001 IGCT Module
  • Wika IPT10 - Process Pressure Transmitter
  • Omron SK20-C1DT-D - Programmable Controller PLC Unit
  • Foxboro Eckardt (Schneider) AE214 - Field Indicator Digital Display Meter
  • Omron CJ1W-OD232 - Transistor Output Unit PLC Module
  • Jetter JX2-IO16 - Digital Input Output Module PLC
  • SEFI ACS 48.6A-NS - Power Supply Unit
  • Schneider (Telemecanique) XBTF011110 - Magelis Membrane Keyboard Overlay
  • Siemens 6ES5246-4UA41 - Simatic S5 Positioning Module
  • Siemens 6SL3120-2TE13-0AA3 - Sinamics S120 Dual Motor Module Inverter
  • SEW Eurodrive MAS51A005-503-50 - Movidyn Servo Drive Controller
  • Record ATE 20 - Automatic Door Brake Motor
  • Record ATE STA 21 - Automatic Door Brake Motor
  • Sanyo Denki R2AA06040FXP02 - AC Servo Motor
  • Omron NX-ID4442 - DC Digital Input Unit PLC Module
  • Schneider (Telemecanique) XBTGT2330 - Magelis Advanced Touch Panel HMI
  • ABB DX561-A1 - AC500 Digital Input Output PLC Module
  • SEW Eurodrive MC07B0004-2A3-4-00 - Movitrac B AC Frequency Inverter Drive
  • Schneider (Telemecanique) FT20CBCL030 - Connection Communication Cable
  • Visions AXFR 600601 - Gap Control Side Board PCBA
  • Allen Bradley 1797-CEC-A-C01 - Flex Ex Communication Interface Adapter
  • Siemens 6ES5095-8MC03 - Simatic S5 Programmable Controller CPU
  • Tectrol / Pitney Bowes TC53S-1392 - Power Supply Unit
  • Bronkhorst P-702C-FAC-88-Z - Digital Mass Flow Controller
  • Allen Bradley 1757-SRM - ControlLogix Redundancy Module
  • Neste 0635-107 - Control Board for SLX Automatic Sliding Door
  • RSF Elektronik MS 2x.x4 MO - Linear Encoder Sensor
  • Pro-face GP37W2-BG41-24V - Graphic Terminal Operator Panel HMI
  • Allen Bradley 2711P-RP1 - PanelView Plus Logic Module HMI
  • ABB (Asea Brown Boveri) GNT0144700R0004 - Power Supply Electronic Board Module
  • SEW Eurodrive MC-LTE-B-0008-2B1-1-40 - Movitrac LTE AC Frequency Inverter Drive
  • Siemens 3RK1301-0AB10-0AA4 - Direct Starter Modular Motor Starter
  • Yaskawa SGDB-15VD - Servopack Servo Drive Amplifier
  • National Instruments NI 9421 - 8-Channel C Series Digital Input Module
  • Yaskawa SGDB-10VD - Servopack Servo Drive Amplifier
  • National Instruments NI 9476 - 32-Channel C Series Source Digital Output Module
  • Pitney Bowes R782000 - Turbojet Controller Board PCBA
  • Lika IT65-Y-1000BND2 - Incremental Encoder Sensor
  • Came 002ZT6 - Control Panel Board for Gear Motors
  • Desin HS-300/7500 - Multivariable Process Controller Unit
  • Pilz PNOZ mc1p - Modular Safety Relay Controller
  • Innovative Robotics PTNR2-2-NES - Controller Interface Board Module
  • Schneider Electric (Telemecanique) TSXCB4020 - Printer Communication Link Cable
  • Wika IPT10 - Process Pressure Transmitter
  • Schneider Electric (Modicon) TSXDMF342A - Extension Digital Analog Module for TSX17 PLC
  • Omron F150-KP - Vision System Cursor Key Pack Console
  • National Instruments BNC-2110 - Shielded Connector Block Accessory
  • Bosch Rexroth (Indramat) CSH01.2C-SE-EN2-EN2-CCD-NN-S-FW - Servo Drive Control Panel Interface Module
  • GHM / Gefran / Baumer GHM510573A/1000 - Incremental Encoder Sensor
  • National Instruments NI 9425 - 32-Channel C Series Digital Input Module
  • Schneider (Telemecanique) STBDDO3705 - Digital Output Module STB
  • Siemens 6EP1436-1SH01 - Regulated Power Supply Unit
  • Schneider Electric (Modicon) TSXFPP20 - Fipway PCMCIA Communication Board
  • April QMB 3202 - PLC Output Card Module with Parameter Surveillance
  • Siemens 6ES5240-1AA12 - Simatic S5 Communication Processor Module
  • Midi Engineering MI907A - Stepper Motor Midi Amplifier Driver
  • Schneider Electric (Telemecanique) TSXAEZ414 - TSX Series Analog Input Module
  • Schneider (Telemecanique) TSX17-20 - TSX17 Compact PLC Controller Unit
  • Siemens 6ES5955-3LC14 - Simatic S5 Modular Power Supply Unit
  • Schneider (Telemecanique) ATV66U72N4 - Altivar 66 AC Frequency Inverter Drive
  • Omron NX-OD4256 - Transistor Output Unit PLC Module
  • Yaskawa / Omron SGDH-04AE-OY - Sigma II Servo Drive 400W
  • RSF Elektronik MS 20.04-2M - Linear Encoder Scale Sensor
  • ITT GMW (Metrosx) DAA288-240 A - LED Message Display Board
  • Allen Bradley 1757-SRM - ControlLogix Redundancy Module
  • Sensorex Alpha-LSE - Display Inclinometer Indicator
  • Omron NX-DA3603 - Analog Output Unit PLC Module
  • Grundig Electronic NRP 02 - Power Supply Control Unit Module
  • ProSoft Technology RLX-FHES-F - RadioLinx Industrial Wireless Hotspot Router
  • Omron NX-EIC202 - EtherCAT Coupler Unit PLC Module
  • Omron NX-TS3201 - Temperature Sensor Input Unit PLC Module
  • Omron CQM1-CPU41-V1 - Sysmac CQM1 PLC CPU System
  • April CPU5001 - PLC CPU Processing Unit
  • Yaskawa JZDP-D008-020-E - Linear Servo Motor Actuator
  • Bronkhorst P-702C-FAC-88-Z - Digital Mass Flow Controller
  • Allen Bradley 2711-K3A17L - PanelView 300 Operator Terminal HMI
  • Schneider (Telemecanique) TSXAEM411 - TSX Series Analog Input Module
  • Schneider Electric (Telemecanique) XBTGT5330 - Magelis Advanced Touch Panel HMI
  • Siemens 6ES5928-3UA12 - Simatic S5 Central Processing Unit PLC
  • Schneider (Telemecanique) TSXSUP65 - Power Supply Module
  • Schneider (Telemecanique) TSXLES61 + TSXLES60 - TSX Series Fine Line Box Local Module
  • Siemens 6SE6440-2AD23-0BA1 - Micromaster 440 AC Frequency Inverter Drive
  • National Instruments NI 9205 - 32-Channel C Series Analog Input Module
  • Yaskawa CIMR-PCC42P2 - Varispeed AC Frequency Inverter Drive
  • ABB PM554-T-A1 - AC500 PLC CPU Module
  • National Instruments cDAQ-9178 - 8-Slot CompactDAQ USB Chassis Backplane
  • Allen Bradley 1786-RPA - ControlNet Repeater Adapter Module
  • Allen Bradley 1770-KFD - DH-485 Communication Interface Module
  • Grundig Electronic NSP 02 - Power Supply Control Unit Module
  • Teq Q07.K3S.002A - Control Panel Logic Board
  • Allen Bradley 1300-ITSSC - Signal Converter Interface Module
  • Omron CQM1H-CPU51 - CQM1H Modular PLC System
  • ProSoft Technology 4207-DFNT-MCM - ProLinx Industrial Gateway Module
  • Schneider Electric TSXSCP114 - RS485 PCMCIA Communication Board
  • Grundig NGE 01 - Power Supply Unit
  • Grundig NZP 03 - Power Supply Unit
  • Siemens 6ES5246-4UA41 - Simatic S5 Positioning Module
  • Danaher / Atlas Copco / Socapel SAM-PA-400-30-E - Servo Power Supply Controller Unit
  • Klöckner Moeller EM4-101-DD1 - Easy Control Relay Module
  • Bosch Rexroth DKC-10.3-012-3-MGP-01VRS - Indramat Digital Servo Controller Drive
  • Schneider (Telemecanique) XBTGT2110 - Magelis Touch Panel HMI with Cutter
  • Berger Lahr (Sig Positec) WD3-004.1802 - Stepper Motor Controller Driver
  • ProSoft Technology MVI56-WA-EIP - ControlLogix Wireless EtherNet/IP Communication Module
  • Allen Bradley 1794-ACNR15 - Flex I/O ControlNet Adapter Module
  • Fanuc A06B-6096-H201 - Servo Amplifier Module
  • Panasonic MSDA083A1 - AC Servo Driver Amplifier
  • Teq Q07.K3P.003B - Control Panel Logic Board
  • Schneider (Telemecanique) XBTH002010 - Magelis Operator Terminal HMI
  • Wika IPT10 - Process Pressure Transmitter
  • Teq Q07.A4P.001A - Control Panel I/O Module Board
  • Teq Q07.A3L.003A - Control Panel Module I/O Board
  • Siemens 6ES5246-4UA31 - Simatic S5 Positioning Module
  • Mitsubishi / Harmonic Drive HC-KFS43 - AC Servo Motor with Harmonic Reducer
  • Mitsubishi HC-KFS43 - AC Servo Motor
  • SES Store Electronic Systems 37120/120 - VLF Radio Transmitter Label System
  • Siemens 6SE9213-6BA40 - Micromaster AC Frequency Inverter Drive
  • Rosemount 1151DP5S22 - Differential Pressure Transmitter
  • Siemens 6FM1470-4AA20 - Simatic FM 470 Positioning Module Processor