Phone +420 774 723 123 Cart · 0 · empty
IN STOCK
TEKNIHA-S71200G2-CZ, TECHNOLINE, SIMATIC S7-1200 G2, textbook: parameters, connection and programming (online)

TEKNIHA-S71200G2-CZ, TECHNOLINE, SIMATIC S7-1200 G2, textbook: parameters, connection and programming (online)

Cat. no.: TEKNIHA-S71200G2-CZ
Manufacturer: TECHNOLINE
In stock 49 pcs
Our price excl. VAT
0,41 €
incl. VAT 21 %
0,50 €
Weight 0.12 kg
HS Code (Taric) 49019900
Country of origin CZ

Description

S7-1200 G2: complete free online PLC textbook | TIA Portal, PROFINET, LAD, SCL

Skip to content

 
Home › PLC textbook › SIMATIC S7-1200 G2
Practical Czech textbook · freely available

SIMATIC S7-1200 G2: from the first cable to your own PLC application

A complete guide for CPU 1212C and 1214C G2: hardware selection, wiring, PROFINET, TIA Portal V21+, LAD, FBD, SCL, block architecture, Modbus, OPC UA, HMI, diagnostics, Motion Control, PID and practical projects.

Updated: 16. 9. 2026 Reference firmware: V4.1 STEP 7: V21+ Contents: beginner → advanced
Chapter 0

How to use this textbook

If you are new to PLCs, go through chapters 1–16 in order. If you already know S7-1200, start with migration, communication or diagnostics, depending on your specific problem.

The textbook is written as a combination of explanation, reference manual and practical lab exercises. Each example separates the principle from the specific hardware settings. This is important because exact addresses, available technology functions and limits depend on the CPU, order number, firmware and configuration in TIA Portal.

Safety at work
A PLC program does not replace the safety functions of a machine. Work on 120/230 V AC, switchboards and safety circuits may only be carried out by a suitably qualified person. For a training bench, a 24 V DC supply, circuit protection and separation from hazardous machine parts are advisable.

What to prepare for lab training

PLCCPU 1212C or 1214C G2, ideally the 24V DC variant for lab training.
EngineeringPC with TIA Portal / STEP 7 in a version supporting the firmware of the CPU used.
NetworkEthernet cable, or a small industrial switch.
24 V componentsPush buttons, indicator lights, sensors or an input simulator.
Chapter 1

What SIMATIC S7-1200 G2 is and how it differs from the original S7-1200

S7-1200 G2 is the new hardware generation of Siemens compact PLCs. It brings higher performance and memory, a two-port PROFINET interface, NFC diagnostics, extended Motion Control, more modern security and a new I/O portfolio.

Siemens positions S7-1200 G2 as a Basic Controller for small and medium-complexity machines. The standard portfolio currently consists mainly of CPU 1212C and 1214C; also available are the fail-safe versions 1212FC and 1214FC. G2 is not just a “faster old 1200”: it has different hardware, dimensions and expansion modules.

Performance and memoryHigher computing performance and separate program and data memory.
PROFINETOne X1 interface with two RJ45 ports and an internal switch; up to 31 PROFINET devices according to Siemens portfolio data.
MotionTechnology objects for simple and coordinated axes and basic kinematics.
DiagnosticsNFC, web server, Web API, trace and extended online diagnostic functions.
Important: Siemens states that S7-1200 G2 is not hardware-compatible with the older generation S7-1200. The program can be migrated in many cases, but the hardware and configuration must be redesigned.

When G2 makes sense

  • new single-purpose machines, conveyors, packaging and assembly applications,
  • smaller process units with HMI and distributed I/O,
  • applications with integrated Motion Control without the need for S7-1500,
  • machines requiring OPC UA, web diagnostics or more modern security.
Chapter 2

CPU 1212C and 1214C G2: parameters, variants and selection

CPU 1212C is suitable for smaller applications; CPU 1214C has more integrated I/O, larger memory and more reserve for expansion. For fast pulse outputs choose the DC/DC/DC transistor variant; for universal load switching the relay variant may be suitable.

Parameter CPU 1212C DC/DC/DC CPU 1214C DC/DC/DC
Order number 6ES7212-1AG50-0XB0 6ES7214-1AH50-0XB0
Firmware in the reference data V4.1 V4.1
Engineering STEP 7 V21 or higher STEP 7 V21 or higher
Supply 20.4–28.8 V DC 20.4–28.8 V DC
Integrated DI 8 × 24 V DC 14 × 24 V DC
Integrated DO 6 × 24 V DC transistor 10 × 24 V DC transistor
Program memory 150 kB 250 kB
Data memory 500 kB 750 kB
Retentive memory 20 kB 20 kB
Integrated load memory 8 MB 8 MB
Analogue I/O on the CPU 0 / 0 0 / 0
PROFINET 1 interface, 2 ports, 100 Mbit/s 1 interface, 2 ports, 100 Mbit/s
Max. number of modules in the system 6 10
Max. CM 3 3
Width 70 mm 80 mm

The parameters above correspond to the listed MLFBs and reference firmware V4.1. When buying, always check the current datasheet of the specific variant.

Standard CPU variants

CPU Varianta MLFB When to consider it
1212C AC/DC/RLY 6ES7212-1BG50-0XB0 AC-supplied CPU, relay outputs.
1212C DC/DC/DC 6ES7212-1AG50-0XB0 24 V DC, fast transistor outputs, the usual choice for a modern machine.
1212C DC/DC/RLY 6ES7212-1HG50-0XB0 24 V DC supply, relay outputs.
1214C AC/DC/RLY 6ES7214-1BH50-0XB0 More I/O, AC supply, relay outputs.
1214C DC/DC/DC 6ES7214-1AH50-0XB0 More I/O and performance, 24 V DC, transistor outputs.
1214C DC/DC/RLY 6ES7214-1HH50-0XB0 More I/O and performance, 24 V DC, relay outputs.

Fail-safe CPU

For safety applications there are 1212FC and 1214FC. Their use requires a correct design of the safety architecture, F-I/O, PROFIsafe and validation according to the relevant standards. This textbook explains standard PLC programming; safety programming is a separate discipline.

CPU 1212C DC/DC/DC
6ES7212-1AG50-0XB0
Show in our catalogue
CPU 1214C DC/DC/DC
6ES7214-1AH50-0XB0
Show in our catalogue
Chapter 3

Signal Board, Signal Module and communication expansion

Expand S7-1200 G2 according to the signal type and the required number of channels. Analogue I/O is not integrated in the standard CPUs 1212C/1214C so analogue measurement requires a suitable SB or SM.

SB – Signal BoardCompact addition of a few channels directly on the CPU. Suitable when you do not want to increase the width of the assembly.
SM – Signal ModuleExpansion module next to the CPU for a larger number of digital or analogue I/O.
CM/CP – communicationFor interfaces and protocols not available directly via the integrated PROFINET.
Memory CardOptional SIMATIC Memory Card according to the project, service and firmware requirements.

How to size the expansion

  1. List all physical signals: DI, DO, AI, AO, fast inputs, pulse outputs and communication.
  2. Add a service reserve. For I/O it is sensible to leave free channels for machine modifications.
  3. Check the electrical parameters of the channels: current, voltage, sensor type, referencing method and diagnostics.
  4. Verify the maximum number of modules and the backplane power budget for the specific CPU.
  5. In TIA Portal, build the device in exactly the same order as in the switchboard.
Do not choose an analogue module just by the number of channels. The voltage/current range, resolution, isolation properties, diagnostics, conversion speed and type of connected transducer are decisive.
Chapter 4

Power supply, digital inputs and outputs

First design the power supply and common potentials correctly, and only then deal with the program. Most “program” problems during initial commissioning are actually wiring errors, polarity, the common M or sensor supply.

4.1 CPU 24 V DC supply

In the DC/DC/DC and DC/DC/RLY variants, the CPU operates in the range 20.4–28.8 V DC. For a lab bench, use a stabilised 24V power supply with reserve for the PLC, sensors, HMI and output loads. It is often advisable to supply powerful actuators via separate circuit protection and, depending on the project, separate branches.

230 V AC ──[supply 24 V DC]── +24 V ──┬── PLC L+ ├── sensors ├── HMI └── protected output branch 0 V ────┴── PLC M

4.2 Digital input

A typical 24V sensor applies a logical “1” to the digital input. When diagnosing, measure the voltage directly between the input terminal and the corresponding reference potential. Do not rely only on the sensor LED.

4.3 Transistor vs. relay output

Property Transistor DO Relay DO
Speed High, also suitable for pulse functions on designated channels. Lower, mechanical switching.
Switching life No mechanical contact wear. Limited mechanical/electrical life.
Typical use 24V DC valves, relays, signals, pulses. More universal switching within the contact limits.
Motion / PTO Yes, only designated fast outputs. Not for fast pulses.
Inductive loads: contactor, relay and valve coils generate overvoltage when switched off. Design suitable spike suppression and follow the recommendations of the output and load manufacturers.

4.4 First lab wiring

For the first project, use START, STOP and one indicator light. The physical addresses here are only an example; take the actual addresses from Device configuration.

Signal Symbol Example address Meaning
START button StartPB %I0.0 Start request.
STOP button StopPB %I0.1 Stopping the process.
Indicator light RunLamp %Q0.0 Running indication.
Chapter 5

How to connect a PC to S7-1200 G2 via PROFINET

Connect the Ethernet cable to X1 P1 or X1 P2, set the laptop to the same IPv4 subnet, select the correct adapter in TIA Portal, find the PLC via Accessible devices and assign it a PROFINET device name and IP address.

Parameter CPU 1212C / 1214C G2
PROFINET interface 1 × X1
Physical ports 2 × RJ45, internal switch
Max. transmission rate 100 Mbit/s
Autonegotiation / autocrossing Yes
IP IPv4; DHCP supported
Role PROFINET IO Controller and IO Device
Other protocols TCP/IP, ISO-on-TCP, UDP, SNMP, DCP, LLDP and others depending on configuration.

5.1 Textbook network

Laptop S7-1200 G2 192.168.10.10/24 ───────── 192.168.10.20/24 Ethernet / PROFINET X1 P1 or X1 P2

Mask /24 corresponds to 255.255.255.0. In a lab network, no default gateway is needed for a direct connection. In a company network, always use the assigned addressing plan.

5.2 Procedure in TIA Portal

  1. Connect the cable and check the link LED.
  2. In the PC network card settings, choose a suitable static IP or the company configuration.
  3. In TIA Portal, open online access and select the physical Ethernet adapter to which the PLC is connected.
  4. Start the search for accessible devices. Verify the identity by the MAC address, CPU type or LED flashing, if this function is available.
  5. Set the PROFINET device name. The device name matters for PROFINET identification and must match the project.
  6. Set the IPv4 parameters according to Device configuration.
  7. Carry out the download and, after the CPU switches to RUN, check Online & diagnostics.

5.3 When TIA Portal cannot see the PLC

Industrial Ethernet / PROFINET cable
For PC ↔ PLC, switch and HMI
Choose a cable
Industrial Ethernet switch
For star topology and service network
Choose a switch
Chapter 6

First project in TIA Portal step by step

A good first project starts with an exact choice of CPU MLFB and firmware, continues with Device configuration and symbolic PLC tags, and only then the program in OB1.

  1. Create a new project and add the device according to the order number on the side of the CPU.
  2. Choose the firmware matching the physical PLC. If the device catalogue does not know the version, first verify support in the installed TIA Portal version.
  3. In Network/Device view, set the PROFINET device name and IPv4 address.
  4. Add expansion modules in the same order as in the actual assembly.
  5. Create a PLC tag table for the physical I/O. Do not write absolute addresses directly into the logic unless there is a good reason.
  6. V Main [OB1] create a simple program.
  7. Compile → fix errors → download → switch the CPU to RUN → monitor the logic online.

First program: indicator light controlled by a push button

|----[ StartPB ]----------------------------( RunLamp )----|

This is a deliberately trivial program. It checks the entire chain: electrical wiring → input address → program → output address → load.

Exercise: add a second push button and create the condition StartPB AND EnablePB. Then write the same task in LAD, FBD and SCL.
Chapter 7

Compile, download, RUN/STOP and working with firmware

Compile the project before every download. Distinguish between a program change, a hardware configuration change and a firmware update – each operation has a different impact and a different risk.

Compile

Compilation reveals syntax and configuration errors. Do not ignore warnings mechanically; decide whether it is an expected state or a real problem in the project.

Download

During download, watch the list of changes. On a running machine, even a “small” change can cause the CPU to go to STOP or restart technology parts, depending on the type of change and the configuration.

Firmware

Update firmware only according to a documented procedure, with verified compatibility of TIA Portal, the project and the modules. Before servicing, have a project backup and record the firmware version of the CPU and I/O.

Force: forcing I/O is a service function that can bypass the normal program conditions. After testing, always check that no force values remain active.
Chapter 8

How a PLC executes the program: scan cycle, process image and memory

The PLC repeatedly processes organisation blocks and related tasks. For normal logic, the key is to understand that values are read, evaluated and the outputs updated within one cycle, according to the configuration and access type.

Read inputs → OB1 and called blocks → calculations/states → outputs ↑ │ └──────────────── next scan ────────────────────────┘

Why the scan cycle matters

  • A short pulse may be shorter than normal sampling and require HSC/interrupt.
  • The same variable should not be written by several parts of the program in an uncontrolled way.
  • Timers and technology objects have their own timing behaviour, which is not the same as manually counting scans.

Retentivity

Retentive data survive certain restart scenarios depending on the configuration. Use retentivity only for data that really must survive a power failure – for example a production counter. A machine's state machine, on the other hand, often has to be safely initialised after power-up.

Chapter 9

PLC tags, data types, UDTs and naming convention

Good variable names describe the meaning in the process, not the wire address. Symbolic programming is the basis of a readable project, diagnostics and later HMI connection.

Type Applications Example
BOOL Yes/no state GuardClosed
BYTE / WORD / DWORD Bit fields, communication data StatusWord
INT / DINT Integers PieceCount
REAL / LREAL Physical quantities, calculations PressureBar
TIME Duration T#2s
DATE_AND_TIME / DTL Timestamps depending on the type used LastFaultTime
STRING Text data RecipeName
UDT Custom structured type UDT_Motor

Recommended naming style

StartPB            // physical command
Motor1_RunCmd      // internal request
Motor1_Running     // confirmed state
Motor1_Fault       // fault
Motor1_SpeedSet    // setpoint
Motor1_SpeedAct    // actual value

Avoid names such as M1, bit17 or DB12.DBX4.3 as the main meaning of the logic. An absolute address is an implementation detail, not a description of the machine's function.

Chapter 10

LAD: ladder diagram from the basics to serviceable logic

LAD is best where it is important to see binary conditions quickly: enables, interlocks, limit switches, start/stop and simple sequences.

NO and NC contacts in the program

A program “NO contact” tests for TRUE, an “NC contact” tests for FALSE. Do not automatically confuse this with a physical NO/NC contact on the terminals. Physical wiring and logical interpretation are two different layers.

Start/stop latching

|----[/ StopPB ]----+----[ StartPB ]--------( MotorCmd )----| | | | +----[ MotorCmd ]--------| |----[ MotorCmd ]----[ GuardClosed ]----[/ Fault ]----( MotorOut )----|

For a real machine it is better to separate the request (MotorCmd) from the physical output (MotorOut). This allows interlocks, modes, safe conditions and diagnostics to be inserted between them.

Reset priority

In command logic, decide what takes precedence when START and STOP are pressed at the same time. For machines, it is usually desirable for stopping to have a higher priority than starting.

Exercise: create a conveyor that can only be started when GuardClosed, stops on Fault and does not restart by itself after the fault is reset.
Chapter 11

FBD: logic and data processing as data flow

FBD is suitable for combining Boolean logic, comparators, conversions and analogue functions. The signal flow is often more readable than an extensive ladder diagram.

Typical task

PumpReady = AutoMode AND LevelLow AND NOT Fault AND GuardClosed

In FBD, it can be built from logic blocks while also connecting diagnostic bits, analogue value comparators or a timer.

FBD is neither “better” nor “worse” than LAD. Choose the language according to how readably it expresses the given problem and which language the service team knows.
Chapter 12

SCL: conditions, CASE, loops, calculations and structured code

Use SCL for algorithms, calculations, arrays, structures and state machines. Keep the code deterministic, readable and free of unnecessarily complex constructs.

IF / ELSIF / ELSE

IF StopPB OR Fault THEN
    MotorCmd := FALSE;
ELSIF StartPB AND GuardClosed THEN
    MotorCmd := TRUE;
END_IF;

MotorOut := MotorCmd AND GuardClosed AND NOT Fault;

CASE for a state machine

CASE State OF
    0: // Idle
        Valve := FALSE;
        Pump  := FALSE;
        IF StartCycle THEN
            State := 10;
        END_IF;

    10: // Fill
        Valve := TRUE;
        IF LevelHigh THEN
            Valve := FALSE;
            State := 20;
        END_IF;

    20: // Process
        Pump := TRUE;
        IF ProcessDone THEN
            Pump := FALSE;
            State := 30;
        END_IF;

    30: // Finish
        IF ResetCycle THEN
            State := 0;
        END_IF;

    ELSE
        // recovery from invalid state
        Valve := FALSE;
        Pump := FALSE;
        State := 0;
END_CASE;

FOR

FOR i := 0 TO 9 DO
    AnyAlarm := AnyAlarm OR AlarmArray[i];
END_FOR;
Loops must have a predictable maximum number of iterations. The PLC program runs in real time; uncontrolled or very long loops can extend the scan and cause a watchdog problem.
Chapter 13

OB, FC, FB and DB: how to build a clean project architecture

The OB determines the execution context, an FC is suitable for stateless logic, an FB for an object with its own state and a DB for data. OB1 should coordinate blocks, not contain the whole machine in one monolith.

OBOrganisation block. The CPU starts it according to the event or cycle type.
FCA function without its own instance memory. Good for calculations and auxiliary logic.
FBFunction block with instance data. Ideal for repeated objects.
DBGlobal or instance data, parameters, recipes, device status.

Block interface

  • Input: the block reads the value.
  • Output: the block provides the value to the outside.
  • InOut: the block works with the passed variable in both directions.
  • Static: FB state stored in the instance.
  • Temp: temporary data valid for the current execution.

Recommended tree architecture

OB1 ├── FC_ModeManager ├── FB_Conveyor_1 ├── FB_Conveyor_2 ├── FB_Tank ├── FB_AlarmManager └── FC_OutputMapping
Chapter 14

TON, TOF, TP, counters and edge detection

TON delays switching on, TOF delays switching off and TP creates a pulse. Counters count events, and edge detection converts a continuous state into a one-off event.

Function What it does Typical task
TON Q is activated after the time PT if IN remains TRUE. Delayed fan start.
TOF After IN drops out, Q is held for the time PT. Extraction run-on.
TP Creates a time-limited pulse after an edge. Lubrication pulse.
CTU Counts up. Number of products.
R_TRIG Single-cycle pulse on a rising edge. Counting button presses.
// SCL: delay 2 s
DelayOn(IN := Sensor, PT := T#2s);
Output := DelayOn.Q;

An instance timer must have its own state. When used in an FB, a multi-instance structure can be used, which helps keep the project compact.

Chapter 15

State machines: robust sequences instead of a network of SET/RESET bits

For sequential machines, use an explicit state variable and clear transitions. Each state has defined outputs, a completion condition, a timeout and behaviour on fault.

A good step structure

  1. set the outputs for the state,
  2. evaluate interlocks,
  3. check completion,
  4. check timeout,
  5. go to the next or the fault state.
CASE State OF
    stIdle:
        IF StartCycle THEN
            StepTimer(IN := FALSE, PT := T#0s);
            State := stClamp;
        END_IF;

    stClamp:
        ClampValve := TRUE;
        StepTimer(IN := TRUE, PT := T#3s);

        IF ClampOK THEN
            StepTimer(IN := FALSE, PT := T#0s);
            State := stProcess;
        ELSIF StepTimer.Q THEN
            FaultCode := 101;
            State := stFault;
        END_IF;

    stFault:
        ClampValve := FALSE;
        ProcessEnable := FALSE;
END_CASE;
For large projects it is advantageous to use symbolic constants or an enum-like approach instead of “magic” numbers 10, 20, 30 without description.
Chapter 16

Practical reusable FB for a motor

A single well-designed FB can be used for dozens of motors. The instance holds its own state, timing, fault and diagnostics, while the interface stays the same.

Proposed interface

Direction Variable Meaning
IN Enable Global enable of the object.
IN StartCmd Run request.
IN Feedback Actual contactor/drive confirmation.
IN FaultIn External fault.
IN Reset Fault reset.
OUT RunOut Physical command.
OUT Ready Ready to start.
OUT Running Confirmed running.
OUT Fault Summary fault.
// FB_Motor concept
Ready := Enable AND NOT Fault;

IF Reset THEN
    Fault := FALSE;
END_IF;

IF FaultIn THEN
    Fault := TRUE;
END_IF;

RunOut := StartCmd AND Ready;

StartTimeout(IN := RunOut AND NOT Feedback, PT := T#3s);
IF StartTimeout.Q THEN
    Fault := TRUE;       // motor did not confirm start
END_IF;

Running := RunOut AND Feedback;

In practice, add Manual/Auto modes, local service, permissive/interlock data, fault code, running time, number of starts and an HMI structure. The exact model must be adapted to the drive type.

Chapter 17

Alarms, warnings, permissives and interlocks

Separate “why the equipment cannot start” from “what stopped it during operation”. Service then immediately knows whether an enable is missing, an interlock exists or a fault has occurred.

PermissiveCondition required before starting. E.g. air pressure OK.
InterlockCondition that can block or end operation. E.g. an open guard, depending on the function design.
WarningNotification without the need to stop.
FaultFault requiring a defined response and often a reset.

Fault code

Instead of dozens of anonymous bits, a fault code + individual diagnostic bits can be used. The HMI can display text according to the code, but the PLC must still have enough information for a safe response.

Chapter 18

Analogue inputs and outputs: 0–10 V, 4–20 mA and scaling

For S7-1200 G2 separate the module's raw value from the physical process value. Never take the exact raw range from another module; verify it in the datasheet and in the configuration of the specific channel.

General conversion

EU = (RAW - RAW_min) × (EU_max - EU_min) / (RAW_max - RAW_min) + EU_min

For example, a pressure transducer may physically measure 0–10 bar. If the transducer output is 4–20 mA, both the channel configuration and the cabling must correspond to current measurement.

What to deal with besides SCALE

  • wire-break and over/underrange diagnostics,
  • noise filtering,
  • a reasonable rate-of-change limit,
  • validity bit ValueValid,
  • substitute value on sensor error,
  • hysteresis for binary decisions.
// Analogue value validation concept
IF SensorValid THEN
    PressureUsed := PressureBar;
ELSE
    PressureUsed := SafeSubstitute;
    PressureFault := TRUE;
END_IF;
Analogue SB / SM for S7-1200 G2
Choose according to the U/I range and number of channels
Choose analogue I/O
Chapter 19

High Speed Counter, frequency and fast pulse outputs

Do not handle fast pulses by ordinary BOOL reading in OB1, if the pulse can be shorter than the scan. Use the integrated HSC technology functions or a corresponding technology object.

The current technical data of CPU 1214C DC/DC/DC list high-speed counters and selected high-speed transistor outputs up to 100 kHz. The exact channels and limits depend on the mode and the specific CPU.

Typical applications

  • conveyor encoder,
  • frequency measurement,
  • counting fast products,
  • PTO/PWM for compatible devices.
At high frequencies, cabling, shielding, common potentials and correct input filter configuration are critical. A software change alone will not fix a poor physical layer.
Chapter 20

PROFINET IO: distributed I/O, drives and topology

S7-1200 G2 can be both a PROFINET IO Controller and an IO Device. Connecting peripherals involves the device name, IP, GSDML/device in the catalogue, modular configuration and process data mapping.

Controller vs. Device

  • IO Controller: the PLC controls the connected PROFINET devices.
  • IO Device: the PLC behaves towards another controller as a device with defined I/O data.

The device name is as important as the IP

PROFINET also identifies devices by name. A device may have the correct IP, but if the expected PROFINET device name does not match, the configuration will not be correct.

Topology

Two ports on the CPU allow line connection, but this does not mean two independent IP interfaces. For a robust network architecture, design the topology, redundancy and service access according to the machine requirements.

Chapter 21

Open User Communication: TCP, ISO-on-TCP and UDP

Use OUC when you need your own data exchange with a PC, reader, camera or other Ethernet device and have no more suitable standardised protocol.

For CPU 1214C G2 the current product data list support for TCP/IP, ISO-on-TCP (RFC1006) and UDP. For TCP/ISO-on-TCP the maximum data length is 64 kB; for UDP 2 kB, with broadcast having a lower limit.

Design a protocol, not just a socket

  • header / magic bytes,
  • message version,
  • payload length,
  • sequence number,
  • CRC/checksum if needed,
  • timeout, retry, watchdog and connection status.
TCP provides a reliable byte stream, but does not preserve the boundaries of your application messages. The application must know how to recognise the start and end of a telegram.
Chapter 22

Modbus TCP a Modbus RTU v S7-1200 G2

Modbus TCP is suitable for simple interoperable exchange of registers over Ethernet. Modbus RTU works via serial communication and requires a suitable hardware interface.

Data map first

Register Meaning Application data type Note
40001 Command word WORD Bit commands.
40002 Status word WORD Device states.
40003–40004 Setpoint REAL / 2 registers Word/byte order must be defined.
40005–40006 Actual value REAL / 2 registers Same endianness convention.

Common mistake: register offset

The device documentation may say “40001”, while the API/block expects offset 0. Always check whether the supplier uses 0-based or 1-based addressing and whether the number 4xxxx indicates the register type or is part of the actual address.

Common mistake: REAL and endianness

Modbus registers have 16 bits. 32-bit REAL takes up two registers and different devices may use a different word order. Diagnose this using a known test value.

Exercise: create a Modbus TCP data map for a conveyor: start, stop, reset, speed, piece count, ready/running/fault and fault code.
Chapter 23

OPC UA Server: secure data integration

S7-1200 G2 supports OPC UA Server; according to current product data, the corresponding runtime licence is required. Publish only data that really should be available to clients.

Design procedure

  1. Define the data model: what is status, command, measurement, alarm.
  2. Enable and configure OPC UA in the CPU.
  3. Set users, certificates and security policy according to the environment.
  4. Make only the necessary variables accessible.
  5. Test reading, writing and subscription in the client.
  6. Measure the communication load and behaviour when the client fails.

Current CPU 1214C data list data access for read/write/subscribe and method call. Always verify the limits of sessions/subscriptions and the sampling interval for the specific CPU and firmware.

Do not use anonymous access in a production network just because it speeds up the first test. Security must be part of the design from the start.
Chapter 24

Web server, HTTPS and Web API

The integrated web server is suitable for diagnostics and selected service functions. The Web API allows more modern application integration; however, design access with authentication and network segmentation.

The current technical data of CPU 1214C G2 list HTTPS, Web API and user-defined web pages. This makes it possible to create a service dashboard outside the classic HMI – for example a page with diagnostics, production counters or the software version.

What is suitable for publishing

  • machine status and mode,
  • current sequence step,
  • alarm/fault code,
  • counters and basic KPIs,
  • PLC project version, firmware and build date.
Do not expose the PLC web server directly to the public internet. Use network segmentation, a firewall/VPN and controlled account management.
Chapter 25

How to design PLC data for the HMI

The HMI should use a stable PLC data interface. Do not bind screens to random internal bits in various blocks; create a clear structure for Commands, Status, Process, Alarms and Settings.

CommandsStart, Stop, Reset, Auto/Manual, service commands.
StatusReady, Running, Fault, mode, sequence step.
ProcessTemperatures, pressures, speeds, counts, times.
SettingsSetpoints, recipe and service parameters with limits.

An HMI command is not a physical push button

An HMI command is a communication bit. The design must deal with what happens on loss of communication, a frozen panel or a bit held for a long time. An edge/handshake is often more suitable than assuming the HMI will always send a perfectly short pulse.

SIMATIC HMI / Unified panel
Machine visualisation and operation
Choose an HMI
Chapter 26

Online diagnostics, watch table, diagnostic buffer and Trace

When looking for a fault, work from physics to program: power supply → LEDs → link → device name/IP → hardware configuration → diagnostic buffer → online values → process conditions.

26.1 Diagnostic tree

  1. Is the CPU powered and not in STOP/ERROR?
  2. Is the physical network OK?
  3. Do the device name, IP and project match?
  4. Is the hardware configuration free of mismatches?
  5. What does the diagnostic buffer say?
  6. What are the actual inputs to the problematic block?
  7. Is the fault in the command, permissive, interlock or feedback?

26.2 Watch table

For servicing, create topic-based watch tables: “Motor 1”, “PROFINET”, “Sequence”, “Analog”, “Safety interface”. This is faster than searching for variables across the whole project at every intervention.

26.3 Trace

Trace is essential for short and time-sensitive problems: fluctuation of an analogue value, signal sequences, control response or an occasional interlock. According to current technical data, CPU 1214C G2 supports configurable traces.

Chapter 27

PLC program testing, simulation and commissioning checklist

Test in layers: first an individual block, then the device, then the sequence and finally the whole machine including fault states. “Works in the normal cycle” is not enough.

Minimum test scenarios

  • normal start and stop,
  • loss of feedback at start,
  • fault during operation,
  • HMI/drive communication failure,
  • CPU restart,
  • boundary analogue values,
  • sequence timeout,
  • fault reset and prevention of unintended restart.

PLCSIM

Simulation is excellent for algorithms, state machines and HMI logic, but does not replace testing of the electrical wiring, real PROFINET devices, drive timing or the physical dynamics of the process.

Rule: every fixed bug should, if possible, create a new regression test so that it does not return after future changes.
Chapter 28

Motion Control: technology objects, axis, homing and positioning

Build motion in S7-1200 G2 using technology objects. First configure the drive and axis, then deal with enable, home, jog, absolute/relative movement and diagnostics.

Recommended learning sequence

  1. Communication with the drive and telegram.
  2. Axis Technology Object.
  3. Enable / disable and safe state.
  4. Homing.
  5. Jog.
  6. Absolute move.
  7. Relative move.
  8. Velocity mode.
  9. Coordinated axes and kinematics only after mastering single-axis.

According to current technical data, CPU 1214C G2 has extended Motion Control resources and supports basic kinematic functions. The actual number of axes depends on the type of technology objects and the Motion Control cycle.

A motion example without a specific drive, telegram, mechanics and safety concept is only didactic. Before the first movement, set limits and secure the machine area.
Chapter 29

PID control: from the process to PID_Compact

First define PV, SP and MV and verify the direction of the process. Only then tune the controller. The most common PID problem is not “wrong P/I/D” but a badly scaled value, saturation or an unsuitable sampling time.

PVProcess Value – the actual measured value.
SPSetpoint – the desired value.
MVManipulated Value – the control action.

Before autotuning

  • verify the correct control polarity,
  • verify the physical units and ranges,
  • set safe output limits,
  • ensure stable process conditions,
  • solve bumpless Manual ↔ Auto transfer.

For temperature, the dynamics may be in minutes; for pressure, in seconds or faster. Both the parameters and the control cycle must match the physics of the process.

Chapter 30

Industrial Security for S7-1200 G2

Do not connect the PLC directly to the internet. Segment the network, use user management, secure protocols, current firmware and controlled backups. Security is a continuous process, not a one-off checkbox.

Current product data of CPU 1214C G2 list user management, several levels of access protection, secure boot and, for PG/OP communication, preset TLS encryption 1.3. However, always verify the specific settings in the project.

Minimum checklist

  • separate the OT and IT networks,
  • restrict routing and permitted services,
  • do not use shared universal accounts,
  • back up the project and record changes,
  • monitor security advisories and firmware,
  • use VPN/jump host for remote service,
  • disable unnecessary services and diagnostic accounts.
Chapter 31

Migration from the original S7-1200 to S7-1200 G2

Migration is not a one-for-one replacement. The program may be largely transferable, but the hardware, I/O, dimensions, technology functions and available modules must be re-verified.

Procedure

  1. Inventory of the old project: CPU, firmware, modules, signal boards, CM, HMI, drives.
  2. List of instructions and technology objects used.
  3. New hardware bill of materials for G2.
  4. Check of the physical terminals and switchboard.
  5. Migration/upgrade of the project in a supported TIA Portal version.
  6. Compile and remove incompatibilities.
  7. FAT on the bench, then commissioning on the machine.

What to check in particular

  • integrated analogue I/O – older CPUs may have had it, the standard G2 1212C/1214C do not,
  • module addresses,
  • fast inputs/outputs,
  • communication blocks,
  • HMI tags,
  • mechanical dimensions and connection.
Chapter 32

8 practical projects for learning S7-1200 G2

The fastest way to learn PLCs is through small projects, each adding one new concept. Below is the recommended sequence from binary logic to communication and motion control.

P1 – Traffic light

Target: TON, state machine, transitions and reset. Create a green → amber → red cycle with parameters in a DB.

P2 – Conveyor with piece counter

Target: motor FB, sensor edge, CTU, interlock and “jam” alarm. Add a timeout between two sensors.

P3 – Tank

Target: analogue input, hysteresis, pump, valve, LL/HH alarm and a graph on the HMI.

P4 – Motor library

Target: reusable FB, UDT, multi-instance, start and running-hours statistics.

P5 – Pneumatic workstation sequence

Target: state machine with a timeout for each step, recover/retry and fault code.

P6 – Modbus TCP device

Target: holding register mapping, REAL over two registers, communication watchdog and diagnostics.

P7 – Web service dashboard

Target: publish read-only diagnostic data and the software version via a secure web interface.

P8 – One motion axis

Target: enable, home, jog, absolute/relative move, error acknowledge and HMI diagnostics.

Standard for every project: I/O list → state diagram → PLC tags → block architecture → program → test cases → fault injection → change documentation.
Chapter 33

Most common faults and quick diagnostics

Symptom First checks Typical cause
PLC not visible Cable, link, correct NIC in TIA, VPN, device name. Wrong adapter or network.
Input LED is on, program sees FALSE Tag address, hardware mapping, online instance. Tag points to a different channel.
Output TRUE in the program, device does not respond Output LED, output group supply, cabling. Missing load supply / common potential.
PROFINET device fault Device name, module configuration, cable, GSD. Project ↔ device mismatch.
Modbus returns a nonsensical REAL Registers and word order. Endianness / offset.
Motor starts by itself after reset Latched start request. Missing anti-restart logic.
Analogue value jumps Shielding, earth, filter, cable, channel type. EMC or wrong configuration.
Sequence occasionally gets stuck Trace of transitions and timeout. Short signal / missing timeout / race logic.
Chapter 34

Check test and answers

  1. Why do two RJ45 sockets not mean two independent PROFINET interfaces?
  2. Why is it not enough to look at the number of I/O when choosing a CPU?
  3. What is the difference between an FB and an FC?
  4. What does the PROFINET device name solve?
  5. Why is R_TRIG important when counting button presses?
  6. What is the difference between a permissive and a fault?
  7. Why must the raw analogue range be verified in the module datasheet?
  8. Why can a REAL in Modbus look wrong even with the correct registers?
  9. What should be checked before PID autotuning?
  10. Why is it not advisable to expose the PLC web server to the internet?

Short answers

  1. The P1/P2 ports are part of one X1 interface with an internal switch.
  2. Memory, expansion, fast functions, communication, output type and technology requirements are decisive.
  3. An FB has its own instance state; an FC has no instance memory of its own.
  4. Identification of the device in the PROFINET configuration.
  5. So that one physical event creates one program pulse instead of TRUE for several scans.
  6. A permissive is a precondition/enable; a fault is a diagnosed failure with a defined response.
  7. The ranges differ depending on the module and channel mode.
  8. Because of the word/byte order (endianness).
  9. Scaling, control polarity, limits, process dynamics and safe conditions.
  10. Because of cyber risk; it should be in a segmented OT network with controlled remote access.
Chapter 35

Glossary of S7-1200 G2 and TIA Portal

CPU
Central PLC unit executing the program and communication.
PLC
Programmable Logic Controller.
TIA Portal
Siemens engineering environment for configuration, programming and diagnostics.
STEP 7
Part of TIA Portal designed for programming SIMATIC PLCs.
PROFINET
Industrial Ethernet standard used for real-time I/O and communication.
Device name
Name of the PROFINET device used for its identification.
MLFB
Siemens order number that exactly identifies the product variant.
OB
Organization Block – a block executed by the CPU in a defined context.
FC
Function – a stateless program block.
FB
Function Block – a block with instance data.
DB
Data Block – structured data storage.
UDT
User Defined Type – a custom structured data type.
LAD
Ladder Diagram.
FBD
Function Block Diagram.
SCL
Structured Control Language – a text language for PLCs.
HSC
High Speed Counter – a fast hardware-supported counter.
PTO
Pulse Train Output – a pulse output for controlling compatible devices.
HMI
Human Machine Interface – an operator panel or visualisation.
OPC UA
Standard for secure, modelled exchange of industrial data.
Modbus TCP
Modbus application protocol carried over TCP/IP.
Trace
Recording of selected variables over time for diagnostics.
Retentivity
The ability of selected data to keep their value through a defined restart/power failure.
Chapter 36

Which products are typically used with S7-1200 G2

Product links in the textbook should be contextual: the CPU in the selection chapter, an analogue module with analogue signals, a cable with PROFINET and an HMI with visualisation. This is more useful for readers and for internal linking than a block of dozens of unrelated products.

Connection to your e-shop: since I do not have the domain or URLs of your products in the conversation, I am not inventing non-existent links. At the end of the HTML there is an object PRODUCT_LINKS. As soon as you insert real URLs into it, all CTAs in the textbook will automatically switch to your catalogue. For maximum SEO, I recommend also writing the links directly into the static HTML on the server once the URLs are filled in.
CPU 1212C DC/DC/DC
6ES7212-1AG50-0XB0
Product page
CPU 1212C DC/DC/RLY
6ES7212-1HG50-0XB0
Product page
CPU 1214C DC/DC/DC
6ES7214-1AH50-0XB0
Product page
CPU 1214C DC/DC/RLY
6ES7214-1HH50-0XB0
Product page
Fail-safe CPU 1212FC / 1214FC
For safety applications
Product category
STEP 7 / TIA Portal
Engineering software
Software
Digital I/O modules G2
Signal Modules / Signal Boards
Product category
Analogue I/O G2
AI / AO according to the application
Product category
24 V DC power supplies
Supply for PLCs and peripherals
Product category
PROFINET / Ethernet
Cables, connectors, switches
Product category
SIMATIC HMI
Operator panels
Product category
SIMATIC Memory Card
Service, load memory and project scenarios
Product category

How to link the textbook and products internally

  • link from a sentence that explains the specific use of the product,
  • the anchor text should describe the product, not “click here”,
  • the product page should link back to the relevant textbook chapter (“How to wire”, “How to set up”),
  • the S7-1200 G2 category should link to this textbook as a buying and technical guide,
  • do not add dozens of unrelated CTAs to every chapter.
Chapter 37

Frequently asked questions about S7-1200 G2

How do I connect a laptop to S7-1200 G2?

Use a standard Ethernet cable to X1 P1/P2, select the correct network adapter in TIA Portal, search for Accessible devices and set the device name and IP in the same subnet.

Which TIA Portal do I need for firmware V4.1?

Current product data of CPU 1212C and 1214C with firmware V4.1 list STEP 7 V21 or higher.

Does S7-1200 G2 have analogue inputs directly on the CPU?

According to current product data, the standard CPU 1212C and 1214C G2 have 0 analogue inputs and 0 analogue outputs. Use a suitable SB/SM.

What is the difference between 1212C and 1214C?

1214C has more integrated digital I/O, larger program and data memory and greater expandability. The choice also depends on communication and technology functions.

How many PROFINET devices does S7-1200 G2 support?

In its portfolio materials Siemens lists up to 31 PROFINET devices. Verify the specific design according to the CPU, firmware and communication load.

Is S7-1200 G2 hardware-compatible with the old S7-1200?

No. Siemens states that G2 is not hardware-compatible with the previous generation. The program can often be migrated, but the hardware must be selected again.

Does S7-1200 G2 support Modbus TCP?

Yes. Modbus TCP is supported. During integration, pay attention to the data map, registers, offsets and word order of 32-bit values.

Does S7-1200 G2 support OPC UA?

Yes, OPC UA Server is supported according to current technical data and requires the corresponding runtime licence.

Can it be programmed in LAD, FBD and SCL?

Yes. These languages are listed for the standard CPU S7-1200 G2 in current Siemens technical data.

What to do if the PLC is unreachable in TIA Portal?

Start with the physical link, then the correct network adapter, VPN/firewall, device name and IP. Only then deal with the program.

When to use an FB instead of an FC?

Use an FB for an object that must remember its own state – a motor, valve, sequence or device. An FC is suitable for stateless logic and calculation.

Which language is best for a beginner?

For binary logic, LAD is usually the most readable. SCL is suitable for calculations and state machines. In practice it pays to know both.

What is a PROFINET device name?

It is the name used by PROFINET to identify the device. Dealing only with the IPv4 address is not enough.

How is 4–20 mA scaled to a physical value?

You convert the module's raw value to engineering units with a linear function. However, take RAW_min and RAW_max from the documentation of the specific module and the channel configuration.

Is the Web API suitable for a custom dashboard?

Yes, G2 supports Web API. However, design the dashboard as a secure service integration in a segmented network, not as a public internet endpoint of the PLC.

Chapter 38

Sources, versions and editorial policy of the textbook

We verify technical parameters against primary Siemens sources and always tie them to a specific MLFB/firmware. For general programming principles, we separate the didactic example from the manufacturer's binding documentation.

Verification status: 16. 9. 2026. Reference system manual: S7-1200 G2 System Manual V4.1, 12/2025. Reference product data: CPU 1212C 6ES7212-1AG50-0XB0 and CPU 1214C 6ES7214-1AH50-0XB0.

Editorial rules

  • State parameters with MLFB, firmware and date of verification.
  • Do not rewrite old S7-1200 guides as G2 without verification.
  • For safety and Motion, state the boundary between a training example and a real project.
  • Update the date only when the content has actually been checked or changed.
  • Add your own experience: photos of switchboards, oscillation traces, typical commissioning errors and real procedures – it is precisely these elements that add value above a normal summary of the documentation.
SEO/AEO note: Google explicitly states that no special “AI schema” or llms.txt is needed for AI Overviews/AI Mode. The basis is indexable, useful, original content, good technical structure, crawlable links and structured data matching the visible content.

This textbook is not an official Siemens publication. SIMATIC, S7 and TIA Portal are designations of Siemens. When implementing a project, the current documentation of the manufacturer of the specific product always takes precedence.

SIMATIC S7-1200 G2 – complete online textbook · version 1.0 · 16. 9. 2026

Technical parameters

Objednací kódTEKNIHA-S71200G2-CZ
VýrobceTECHNOLINE

Downloads

Ask about this product

Ask us about technical parameters, compatibility with your equipment, availability or a price for larger quantities. It helps if you tell us what application you need the product for — if it does not fit, we will recommend a more suitable type.

Kód k opsání. Pokud ho nepřečtete, klikněte na Načíst nový kód.
The question relates to product TEKNIHA-S71200G2-CZ

By sending you agree to the processing of the data provided for the purpose of handling your question. We do not pass the data on to third parties.

Related products

Cookies on this website

We need technical cookies for the cart and checkout to work — these are always used. Analytics cookies show us which pages people look for and where they get lost, and help us improve the shop. We only use them if you allow it. More in the data processing policy.