Welcome to the Industrial Automation website!

NameDescriptionContent
HONG  KANG
E-mail  
Password  
  
Forgot password?
  Register
当前位置:

SIEMIENS S7-1200/1500 Controller TIA Portal Programming Guide

来源: | 作者:FAN | 发布时间 :2025-11-24 | 9 次浏览: | 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.

image.png

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 IS220PDOAH1A 336A4940CSP2 Discrete Output Module
  • GE VMIVME-4150 Analog Output Module
  • GE WESDAC D20 PS Industrial Power Module
  • GE 369B1860G0031 servo drive module
  • GE 369B1859G0021 Input/Output Module
  • GE 208D9845P0008 Motor Management Relay
  • GE IS420UCSCH1A-F.V0.1-A Independent Turbine Controller
  • GE D20EME10BASE-T 820-0474 Ethernet Interface Module
  • GE DS200DCFBG2BNC MRP445970 DC Feedback Board
  • GE IC800SSI228RD2-EE servo motor controller
  • GE IS200JPDMG1ACC S1AT005 Digital Input/Output (I/O) Module
  • GE IS200TSVCH1AED servo input/output terminal board
  • GE IS200TTURH1CCC S1DF00Z Terminal Turbine Plate
  • GE IS200TSVCH1ADC S1CX01H servo input-output board
  • GE IS200TRPGH1BDD S1C5029 Trip Solenoid Valve Control Board
  • GE IS220YAICS1A L Analog Input/Output Module
  • GE UCSC H1 IS420UCSCH1A-F-VO.1-A Controller Module
  • GE UCSC H1 IS420UCSCH1A-B Communication Processing Module
  • GE IC697VDD100 Digital Input Module
  • GE V7768-320000 3509301007768-320000A0 Controller Module
  • GE IS410TRLYS1B Relay Output Module
  • GE IS415UCVGH1A V7666-111000 VME Control Card
  • GE IC800SSI216RD2-CE servo motor controller
  • GE VMIVME-5565-010000 332-01565-010000P Reflective Memory
  • GE IC695ALG508-AA Analog Input Module
  • GE IC660EPM100J Power Monitoring and Control Module
  • GE RS-FS-9001 362A1052P004 Redundant Fan System Module
  • GE IS220UCSAH1AK independent processor module
  • GE 369-HI-0-M-0-0-0-E Motor Management Relay
  • GE CIFX50-C0 interface board
  • GE SR469-P5-H-A20-T Motor Management Relay
  • GE WES5120 2340-21005 power module
  • GE WES5120 2340-21003 Control Module
  • GE D20MIC10BASE-T 820-0756 Ethernet Module
  • GE WES13-3 5167-001-0210 Mechanical Relay Output Module
  • GE WES13-3 2508-21001 Control Board Module
  • GE D20ME 526-2005-216943 Input/Output Module
  • GE D20EME 0526-21170-1 PLC module
  • GE 2400-21004 2010-3101-0442 Sensor
  • GE DS200DCFBG2BNC MRP569662 Analog Input/Output Board
  • GE DS200DCFBG2BNC MRP569662 DC Feedback Board
  • GE IC695CPE400-ABAB Controller
  • GE DS200DCFBG2BNC MRP433745 Drive Control Board
  • GE DS200DCFBG2BNC MRP420024 DC Feedback Board
  • GE IS200PPPBH2CAA power module
  • GE IS210MACCH2AGG Compact Controller
  • GE IS200AEPAH1AFD Printed Circuit Board
  • GE IS200AEPAH1ACB redundant power module
  • GE IS200WREAS1ADB Relay Output Module
  • GE IS200AEPAH1AHD Printed Circuit Board
  • GE IS200WEMAH1AEA Wind Energy Main Assembly
  • GE IS210MACCH1AGG Turbine Control Module
  • GE IS230TNRLH1B Terminal Base Station Relay Module
  • GE DS200PCCAG1ACB Power Connection Card
  • GE DS200SI0CG1AEA Instant Overcurrent Card
  • GE DS200SHVMG1AGE servo valve interface module
  • GE DS200SI0CG1A6A Input/Output Module
  • GE DS200RT8AG3AHC Programmable Logic Controller
  • GE VMICPCI-7632-03310 IS215UCCAH3A 350-657362-003310J Rack mounted Input/Output Module
  • GE WEA13-13 2508-21001 Embedded Digital Module
  • GE WES5120 2340-21004 Controller Main Module
  • GE WES5120 2340-21006 on-site control host
  • GE WESDAC D20ME 18-MAR-13 Excitation Control Module
  • GE D20 EME 27-APR-13 Input/Output Module
  • GE D20 EME 2400-21004 Substation Controller
  • GE SR745-W2-P1-G1-HI-A-L-R-E Transformer Protection Relay
  • GE SR745-W2-P1-G1-HI-A-L-R Transformer Management Relay
  • GE IS230TNDSH2A Independent Output Relay Module
  • GE IS200TDBSH2ACC Terminal Module
  • GE PMC-0247RC-282000 350-93750247-282000F Disk Drive
  • GE VMIVME-5576 high-speed fiber optic reflective memory
  • GE 760-P1-G1-S1-LO-A20-R-E feeder management relay
  • GE 760-P1-G1-S1-LO-A20-R 760 Series Management Relay
  • GE 760-P5-G5-S5-HI-A20-R-E Motor Management Relay
  • GE IS200AEPAH1BKE IS215WEPAH2BB Printed Circuit Board
  • GE IS210BPPCH1AEC Programmable Monitoring System
  • GE WESDAC D20ME II Remote Terminal Unit (RTU) Main Processor Card
  • GE IC693DSM302-AE Discrete Output Module
  • GE IS220PRTDH1A 336A4940CSP6 temperature sensor input module
  • GE IS420ESWBH3AX Ethernet Switch
  • GE EVPBDP0001 EVPBDP032 output module
  • GE V7668A-131000 350-93100076668-131000 B Control Module
  • GE IS200SPROH1AAB MRP663860 Turbine Protection Relay
  • GE VG5SK8I052311 PM0N2000 Digital Input Module
  • GE MVR1600-4601 air-cooled rectifier module
  • GE CT11T7F10PN1 PMC676RCTX V2.3 01 16 C1145 CR11 V2.X Network Interface Card
  • GE IS215UCVHM06A IS200PMCIH1ACC Controller
  • GE IC695CPU315-BB Programmable Logic Controller
  • GE WES5120 5120-1506 High Performance Field Controller
  • GE D20-PS LFDSC143-4000 processor
  • GE 8811-IO-DC 8811-IO-DC-01 Digital Input/Output Module
  • GE VMIVME-7750 VMIVMME-7750-834 350-02775-834 D Bus Interface Module
  • GE VMIVME-7750 VMIVMME-7750-760000 350-027750-76000 N Bus Processor
  • GE IS210BPPBH2BMD redundant power module
  • GE IS220PDIAH1A 336A4940CSP1 Discrete Input Module
  • GE IC698CMX016 VMIVME-5567-000 350-005567-000 Industrial Module
  • GE V7768-320000 350-9301007768-320000 A0 Controller Module
  • GE IS215VCMIH2CA IS200VCMIH2CAA Communication Interface Board
  • GE IS215UCVGM06A IS215UCVGH1A VMIVMME-7666-11000 Serial Communication Module
  • GE SR745-W3-P5-G5-HI Transformer Protection Relay
  • GE IS220PDIIH1B 336A5026ADP1 Input/Output Module
  • GE IS200SDIIH1ADB MRP683026 Contact Input Isolation Terminal Board
  • GE WESTEM D20 M++CNC System
  • GE SR745-W2-P1-G1-HI-E-H Generator Relay Protection Device
  • GE SR469-P5-HI-A20-H motor protection relay
  • GE IS200TDBTH6ACD gas turbine control system module
  • GE WESDAC D20 C Combination Module
  • GE IC698CMX016 Control Memory Switch Module
  • GE SRPE60A 40 rated plug
  • GE 94-164136-001 motherboard control board
  • ABB PCD237A101 3BHE028915R0101 excitation control module
  • ABB XZC826A102 3BHE036348R0102 control module
  • ABB SAFT183VMC Safety Monitoring and Control Module
  • ABB LD 810HSE EX 3BSE091722R1 fieldbus link equipment
  • ABB RED615 HCDCACADAAHC2BNN11E Line Differential Protection and Control
  • ABB UFC760BE41 3BHE004573R0141 Industrial Computer Board
  • ABB 1TGE120011R2200 Motor Feed Control Unit
  • ABB PM865 3BSE030193R1 Compact Programmable Controller
  • ABB MVR 0.44-10KA high-power motor control module
  • ABB AO810 Input/Output Module
  • ABB SPAU341C1-AA RS488003-AA numerical protection repeater
  • ABB DSTA131 2668180-48/2 Programmable Logic Controller
  • ABB COM00012RAA005844A0004J2RAA005696N Control Panel Module
  • ABB MR7557891MRS050640C power relay
  • ABB 2RCA025057A0001R safety relay
  • ABB 2RCA013892A0003H power relay
  • ABB 2RCA013655A0001H power relay accessories
  • ABB 07KT94-98 controller