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 | 411 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.


  • ABB PFSA240 Roll DC Supply Unit 3BSE073476R1 Industrial Stressometer Power Supply Module for Rolling Mill Systems
  • ABB PFSA107-Z42 DTU Stressometer Digital Transmission Unit High Precision Strip Tension Measurement Module
  • GE AT868-2-1-1 Ultrasonic Flow Transmitter AquaTrans AT868 Dual Channel Industrial Flow Meter
  • ABB SCC-C 23070-0-10232110 Industrial Control Module Automation System Communication Controller
  • APPLIED MATERIALS 0041-96185 - Heater Assy with 0150-45776 0190-60492 AMAT
  • APPLIED MATERIALS 0021-33426 - SHIELD INNER SINGLE 300MM NO COIL AMAT
  • APPLIED MATERIALS 0140-01905 - HARNESS ASSY DUAL IHC PRESS CONT ADAPTER 16798 AMAT
  • APPLIED MATERIALS 0051-01848 - LINE VAC EXHAUST CH Y LEAK CHECK PORT EPI AMAT
  • APPLIED MATERIALS 0010-02863 - P5000 150mm Teos Susceptor AMAT
  • APPLIED MATERIALS 0010-14056 - ASSY INJECT NOZZLE STANDARD AMAT
  • APPLIED MATERIALS 0020-34694 - LINER GDP R2 OXIDEGECO AMAT
  • APPLIED MATERIALS 0195-07416 - SYCAMORE-X CMP POLISHER I/O ASSEMBLY AMAT
  • APPLIED MATERIALS 0200-09036 - WAFER LIFT PIN AMAT
  • APPLIED MATERIALS 0021-39090 - FLANGE 10" CONFLAT ADAPTOR AMAT
  • APPLIED MATERIALS 0100-99011 - GAS INTERLOCK AMAT
  • APPLIED MATERIALS 0100-11002 - digital I/O card AMAT
  • APPLIED MATERIALS 0190-40000 - PNEUMATIC MANIFOLD CHAMBER 32903 AMAT
  • APPLIED MATERIALS 0021-39792 - PERF PLATE OX. 200 MM TEOS 21896 AMAT
  • APPLIED MATERIALS 0040-04896 - BELL JAR QUARTZ Q-KOTE 200MM AMAT
  • APPLIED MATERIALS 0020-20653 - BASE HEATER AMAT
  • APPLIED MATERIALS 0190-75057 - Lift Cylinder Assy AMAT
  • APPLIED MATERIALS 0010-70345 - Applied Materials 0042-01927
  • APPLIED MATERIALS 0100-91024 - PWBA PRE-ACCEL VENDOR I/F PCB 9500 IMPLANT AMAT
  • APPLIED MATERIALS 0041-56144 - HEATER PEDESTAL ASSEMBLY ENP FCVD EDGE AMAT
  • APPLIED MATERIALS 0090-00836 - SOURCE MOTOR ASSY 0040-24074 GFB5G10 FBLM5120W AMAT
  • MKS 0190-63631 - MASS FLOW VERIFIER MFVA-33168 AMAT
  • APPLIED MATERIALS 0100-35070 - ASSY PCB RF GENERATOR INTERFACE AMAT
  • APPLIED MATERIALS 0010-32221 - ASSEMBLY ROUGH THROTTLE VALVE DRIVE 300MM AMAT
  • SANYO DENKI 0190-14713 - P30B06040HXS8RM AC SERVO MOTOR BL SUPER AMAT
  • APPLIED MATERIALS 0190-14224 - FLEX DIST PANEL AMAT
  • APPLIED MATERIALS 0190-23897 - SPECIFICATION EXMP SYNCNET STAND ALON 14535 AMAT
  • APPLIED MATERIALS 0010-04542 - HEATER ASSY 200MM FC WXZPLUS OSCR 15607 AMAT
  • APPLIED MATERIALS 0190-51414 - AC SERVO DRIVER SGDV-OCA05AY890AA AMAT
  • APPLIED MATERIALS 0020-31747 - P5000 LOADLOCK LID WAFER TXR CHMBR 0020-32930 12573 AMAT
  • APPLIED MATERIALS 0620-01727 - CABLE ASSY SIGNAL RBN 50PIN DSUB EMI RES 17781 AMAT
  • APPLIED MATERIALS 0190-A9510 - IP POWER SUPPLY 33361 AMAT
  • APPLIED MATERIALS T1101-05-000-30 - CRYO TIGER COMPRESSOR AMAT
  • APPLIED MATERIALS 0040-13338 - LINK 1 UPPER 7.2 DEGREE OFFSET CR 300MM 38177 AMAT
  • APPLIED MATERIALS 0190-06926 - Cable SQS R/A TO SQS R/A #2 AMAT
  • APPLIED MATERIALS 0200-00705 - EDGE RING THIN 200MM AMAT
  • APPLIED MATERIALS 0190-01399 - INLINE O3 SNSR ULTRA FULL FLOW HI-CON 6627 AMAT
  • APPLIED MATERIALS 0190-21054 - RF MATCH CABLE ASSEMBLY PRECLEAN 2 AMAT
  • APPLIED MATERIALS 0041-12156 - REFLECTOR PLATE INJECT 300MM RADIANCE PLUS 29763 AMAT
  • MKS 0100-03680 - PCB CHMBR DIST 0090-09483 AS00363-16 35465 AMAT
  • APPLIED MATERIALS E11355460 - Plasma Detector E11355470 Rev.B AMAT
  • APPLIED MATERIALS 0021-33981 - LOWER SHIELD AMAT
  • APPLIED MATERIALS 0100-00583 - GAS PANEL CONTROLLER DIST AMAT
  • APPLIED MATERIALS 0010-54820 - IPC VALVE ASSEMBLY FM 1/2" INTER-PLATEN SPRAY AMAT
  • APPLIED MATERIALS 0020-31747 - P5000 LOADLOCK LID WAFER TXR CHMBR 0020-32930 12573 AMAT
  • APPLIED MATERIALS 0020-40566 - BLANK-OFF POSITION E-F ENP AMAT
  • APPLIED MATERIALS 0021-31023 - Flange Spacer Automatch Single RPS Producer SE AMAT
  • APPLIED MATERIALS 0020-21225 - WEIGHT RING 300MM TITAN PROFILER AMAT
  • APPLIED MATERIALS 0190-A9510 - IP POWER SUPPLY 33361 AMAT
  • APPLIED MATERIALS 0100-90618 - PCB H1 GROUND PDU MOTHER BOARD 0100-90036 AMAT
  • APPLIED MATERIALS 0010-04542 - HEATER ASSY 200MM FC WXZPLUS OSCR 15607 AMAT
  • APPLIED MATERIALS 0020-31658 - CLAMP VESPEL OX-MLR-NIT 200MM AMAT
  • APPLIED MATERIALS 0021-09974 - WINDOW SAPPHIRE PUMPING PLATE AMAT
  • APPLIED MATERIALS 0051-01849 - LINE VAC EXHAUST ELBOW CH Y FAC TRAY EPI 30 AMAT
  • APPLIED MATERIALS 0010-29842 - 300mm DBR High Temp Belt Wrist Titanium AMAT
  • APPLIED MATERIALS 1410-01166 - Heating Jacket AMAT
  • APPLIED MATERIALS 0620-01727 - CABLE ASSY SIGNAL RBN 50PIN DSUB EMI RES 17781 AMAT
  • APPLIED MATERIALS 0010-70345 - Applied Materials 0042-01927
  • APPLIED MATERIALS 0090-00836 - SOURCE MOTOR ASSY 0040-24074 GFB5G10 FBLM5120W AMAT
  • APPLIED MATERIALS 0190-46837 - INFRARED THERMOMETER COMM BOX RAYMI3COMM 30009 AMAT
  • APPLIED MATERIALS 0020-31886 - FLANGE INSULATION UNIBODY .400 THK AMAT
  • APPLIED MATERIALS 0010-05920 - CONTROLLER CCM PROD ETCH CS-PM CARD CAGE AMAT
  • APPLIED MATERIALS 0242-30292 - KIT 20 SCCM MFC W/HRDWR UNIBODY 6449 AMAT
  • APPLIED MATERIALS 0040-41061 - JIG FOUR PT LEVELING TOOL TXZ 300MM AMAT
  • APPLIED MATERIALS 0020-30287 - ADAPTER RING PUMPING PLATE 200MM COMMO AMAT
  • APPLIED MATERIALS 0041-12156 - REFLECTOR PLATE INJECT 300MM RADIANCE PLUS 29763 AMAT
  • APPLIED MATERIALS 0010-37866W - ASSY INT ISRM MODULE FULL SCAN SMG AMAT
  • APPLIED MATERIALS 0090-08137 - 300MM TXZ DLI HEATER CONTROLLER MODULE AMAT
  • APPLIED MATERIALS 0040-20006 - ARM WELDMENT SOURCE STD 8464 AMAT
  • APPLIED MATERIALS 0090-07392 - Dual RF filter AMAT
  • APPLIED MATERIALS 0190-06926 - Cable SQS R/A TO SQS R/A #2 AMAT
  • APPLIED MATERIALS 0020-70279 - LIFTER 150MM WAFER ORIENTER P5000 AMAT
  • APPLIED MATERIALS 0190-35652 - SERIPLEX MUX I/O PCB AMAT
  • APPLIED MATERIALS 0100-11002 - digital I/O card AMAT
  • APPLIED MATERIALS E11355460 - Plasma Detector E11355470 Rev.B AMAT
  • APPLIED MATERIALS 0010-19188 - ASSY COOLDOWN LIFT 34703 AMAT
  • APPLIED MATERIALS 0100-00975 - PCB STEPPER CONTROLLER 2 8099 AMAT
  • APPLIED MATERIALS 0190-16236 - MOTOR ENCODER ASSY ROBOT WRIST MIRRA CMP AMAT
  • APPLIED MATERIALS 0040-48671 - LEFT GUIDE 300MM L-DOOR 37961 AMAT
  • MKS 0100-03680 - PCB CHMBR DIST 0090-09483 AS00363-16 35465 AMAT
  • APPLIED MATERIALS 0190-01399 - INLINE O3 SNSR ULTRA FULL FLOW HI-CON 6627 AMAT
  • APPLIED MATERIALS 8330 - Pair Of Side viewport Panels AMAT
  • APPLIED MATERIALS 0190-75057 - Lift Cylinder Assy AMAT
  • APPLIED MATERIALS 0100-02016 - PCB ASSY ANALOG SYNC DETECT 904-125N AMAT
  • Abaco Systems 0090-08517 - VMICPCI-7326 PCB 38085 AMAT
  • APPLIED MATERIALS 0100-20069 - ASSY WAFER ORIENTER BOARD 0100-02797 AMAT
  • ELEKTRO-AUTOMATIK EA-PS 9036-070 - S01 POWER SUPPLY 625-795365 AMAT
  • APPLIED MATERIALS 3310-00139 - CAPACITANCE PIRANI GAUGE C-SEAL MOUNT 15-PIN AMAT
  • APPLIED MATERIALS 0010-00510 - ASSY BEARING STD 36806 AMAT
  • APPLIED MATERIALS 0041-13895 - FACEPLATE 26MIL CENTERHOLE RF CAP 300MM SACVD 13964 AMAT
  • APPLIED MATERIALS T1101-05-000-30 - CRYO TIGER COMPRESSOR AMAT
  • APPLIED MATERIALS 0050-10076 - WELDMENT DUAL HE MANF SACVD 20243 AMAT
  • MKS 0190-48179 - AS01294-05237-030 Hardened DeviceNet I/O Block AMAT
  • APPLIED MATERIALS 0240-75102 - 8" Transfer Blade 200mm End Effector AMAT
  • APPLIED MATERIALS 0110-90770 - Index Control PCB AMAT
  • APPLIED MATERIALS 0090-91209 - SOURCE SUPPRESSION CLAMPING BOX AMAT
  • APPLIED MATERIALS 0200-01427 - ISOLATOR CERAMIC CVD LOW K 300MM PROD AMAT
  • APPLIED MATERIALS 0021-03637 - FACEPLATE SILANE PRODUCER 200MM AMAT
  • APPLIED MATERIALS 0010-09837 - Wafer Lift Tungsten Precision 5000 AMAT
  • APPLIED MATERIALS 0101-57014 - PCB DEFLECTION-AMPLIFIER BOARD D-AMP 50-06 26296 AMAT
  • APPLIED MATERIALS 0190-36715 - PCB GP IO DISTRIBUTION AMAT
  • APPLIED MATERIALS 0660-00078 - PCB ASSY DNET ANALOG I/O CDN396 DIP-506-068 13392 AMAT
  • APPLIED MATERIALS 0190-B4670 - FIBER HARNESS DVD2-SBBI AMAT
  • APPLIED MATERIALS 1080-02356 - ACCELNET SINGLE AXIS SERVO DRIVE 800-2122 AMAT
  • APPLIED MATERIALS 0040-02937 - WATER MANIFOLD TXZ CIP 200 & 300MM AMAT
  • APPLIED MATERIALS 0040-08944 - LID ANNEAL ECP 200MM AMAT
  • SMC INOI-7134-111 - 4-PORT DEVICENET UPA MODULE Pressure Control AMAT
  • SMC INOI-7134-21 - 4-PORT DEVICENET UPA MODULE Pressure Control AMAT
  • APPLIED MATERIALS 0100-40024 - ASSY WPCBA LOADLOCK INTERCONNECT BOARD AMAT
  • APPLIED MATERIALS 0660-01635 - Chamber P2 Board A AMAT
  • APPLIED MATERIALS 0041-31945 - DOOR ENP ALUM SPD SLIT VALVE VITON LLK 3 AMAT
  • APPLIED MATERIALS 0040-48671 - LEFT GUIDE 300MM L-DOOR 37961 AMAT
  • APPLIED MATERIALS 0051-01849 - LINE VAC EXHAUST ELBOW CH Y FAC TRAY EPI 30 AMAT
  • APPLIED MATERIALS 0040-81661 - CATHODE FACILITY PLATE 35320 AMAT
  • APPLIED MATERIALS 0040-20006 - ARM WELDMENT SOURCE STD 8464 AMAT
  • APPLIED MATERIALS 0110-90770 - Index Control PCB AMAT
  • APPLIED MATERIALS 8330 - Pair Of Side viewport Panels AMAT
  • APPLIED MATERIALS 0040-81155 - LINER LOWER AMAT
  • APPLIED MATERIALS 0100-90618 - PCB H1 GROUND PDU MOTHER BOARD 0100-90036 AMAT
  • APPLIED MATERIALS 0040-47677 - FACEPLATE SIN XG DXZ DCVD AMAT
  • APPLIED MATERIALS 0020-31658 - CLAMP VESPEL OX-MLR-NIT 200MM AMAT
  • CTI-CRYOGENICS 0190-54040 - ON-BOARD IS CONTROLLER 34633 AMAT
  • APPLIED MATERIALS 0020-21665 - SHIELD AL/TI 8 INCH WAFER AMAT
  • APPLIED MATERIALS 0090-10397 - RF FILTER BOX AMAT