liminfo

Siemens TIA Portal Reference

Free reference guide: Siemens TIA Portal Reference

29 results

About Siemens TIA Portal Reference

The Siemens TIA Portal Reference is a practical quick-reference for automation engineers programming Siemens S7-1200/S7-1500 PLCs using TIA Portal. It covers the fundamental block architecture including Organization Blocks (OB1 main scan cycle, OB100 startup initialization, OB35 cyclic interrupt for PID), Function Blocks (FB with instance DB for stateful logic), Functions (FC for stateless calculations with return values), and Data Blocks (DB for structured global data storage with typed fields).

The programming language sections cover both STL (Statement List) and SCL (Structured Control Language). STL entries detail bit logic operations (A/AN for AND, O/ON for OR, S/R for Set/Reset latching, L/T for Load/Transfer of word data). SCL entries cover IF/ELSIF/CASE conditional statements, FOR/WHILE loops, data move operations, and #REGION code folding. System function blocks including TON (On-Delay timer SFB4), TOF (Off-Delay timer SFB5), CTU (Up counter SFB0), BLKMOV (SFC20 block move), and PID_Compact for built-in PID control with auto-tuning are documented with call syntax and parameter examples.

The reference also covers memory addressing (I inputs, Q outputs, M bit memory, DB data block access with both absolute DB1.DBW0 and symbolic "DB_Name".Value notation), communication protocols (PROFINET IO device configuration with IP and address mapping, PUT/GET for S7 CPU-to-CPU data exchange, TSEND_C/TRCV_C for TCP/UDP open user communication), and debugging tools (Trace oscilloscope function for real-time variable recording, Watch Table for online monitoring and value forcing, S7-GRAPH sequential function chart programming).

Key Features

  • Organization Block reference: OB1 main cycle, OB100 warm restart init, OB35 cyclic interrupt with PID call examples
  • FB/FC/DB block programming: Function Blocks with instance DB, Functions with return values, Data Blocks with typed STRUCT
  • STL bit logic instructions: A/AN (AND), O/ON (OR), S/R (Set/Reset latching), L/T (Load/Transfer) with working examples
  • SCL structured text: IF/CASE conditionals, FOR/WHILE loops, MOVE/BLKMOV data operations, #REGION code organization
  • System FB: TON/TOF timers with PT time values, CTU counter with PV preset, PID_Compact auto-tuning controller
  • Memory addressing: I/Q/M/DB areas with bit, byte, word, double-word access and symbolic DB notation
  • Communication: PROFINET IO device setup, PUT/GET inter-CPU exchange, TSEND_C/TRCV_C TCP/UDP sockets
  • Debugging: Trace oscilloscope with trigger and sampling, Watch Table monitoring/forcing, S7-GRAPH SFC steps

Frequently Asked Questions

What is the difference between OB1, OB100, and OB35?

OB1 is the main organization block that executes every PLC scan cycle and contains the primary program logic. OB100 runs once during warm restart for initialization (setting default values, clearing flags). OB35 is a cyclic interrupt block that executes at a fixed interval (default 100ms) regardless of the main scan cycle, making it ideal for time-critical tasks like PID control loops.

When should I use FB vs. FC in TIA Portal?

Use FB (Function Block) when you need persistent state between calls, such as valve control with timers or motor sequencing with step counters. Each FB instance gets its own DB to store internal variables. Use FC (Function) for stateless calculations like scaling analog values or computing formulas, where no data needs to persist between calls. FC can return a value directly.

How does the PID_Compact controller work in S7-1500?

PID_Compact is a built-in PID controller called from a cyclic OB (like OB35). Set Setpoint and Input (process variable), and it outputs the control value. Mode 3 is automatic operation. Use the TIA Portal Commissioning tool for auto-tuning, which automatically determines P, I, and D gains. It supports both heating and cooling modes and includes anti-windup.

What is the difference between STL and SCL programming?

STL (Statement List) is a low-level assembler-like language using mnemonics like A (AND), O (OR), S (Set), L (Load). It provides direct register-level control and is efficient for simple bit logic. SCL (Structured Control Language) is a high-level language similar to Pascal with IF/CASE/FOR/WHILE constructs, better suited for complex algorithms, mathematical calculations, and structured programming.

How do I address memory in Siemens PLCs?

Inputs use I (I0.0 for bit, IW64 for analog word), outputs use Q (Q0.0, QW80), internal memory uses M (M0.0, MW100, MD0 for REAL). Data blocks use absolute addressing (DB1.DBX0.0 bit, DB1.DBW0 word, DB1.DBD0 double word) or symbolic access ("DB_Name".VariableName). Word (W) is 2 bytes, Double word (D) is 4 bytes.

How do I set up PROFINET IO communication?

In TIA Portal Hardware Configuration, add a PROFINET IO system with the CPU as controller. Add IO devices (like ET200SP) with their IP addresses. Map I/O addresses for each module slot. The controller automatically handles cyclic data exchange. Device names must be assigned via DCP protocol before communication starts. Diagnostics are available through OB82.

What is the difference between PUT/GET and TSEND_C/TRCV_C?

PUT/GET (S7 communication) is a simple method for CPU-to-CPU data exchange using S7 protocol. The server CPU must have PUT/GET access enabled. TSEND_C/TRCV_C provides TCP/UDP open user communication for connecting to non-Siemens devices or custom protocols. TSEND_C handles connection management and data transmission in one block with persistent TCP connections.

How do I use Watch Table and Trace for debugging?

Watch Table lets you monitor variables in real-time, modify values temporarily, or force values to a fixed state (overriding the program). Trace works like an oscilloscope: configure variables to record, set sampling rate (down to 1ms on S7-1500), define a trigger condition (e.g., rising edge on M10.0), and record for a specified duration. Access both through TIA Portal Online menu.