TEKNIHA-S71200G2-CZ, TECHNOLINE, SIMATIC S7-1200 G2, textbook: parameters, connection and programming (online)
- Our price excl. VAT
- 0,41 €
- incl. VAT 21 %
- 0,50 €
Description
S7-1200 G2: complete free online PLC textbook | TIA Portal, PROFINET, LAD, SCL
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.
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.
What to prepare for lab training
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.
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.
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.
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.
How to size the expansion
- List all physical signals: DI, DO, AI, AO, fast inputs, pulse outputs and communication.
- Add a service reserve. For I/O it is sensible to leave free channels for machine modifications.
- Check the electrical parameters of the channels: current, voltage, sensor type, referencing method and diagnostics.
- Verify the maximum number of modules and the backplane power budget for the specific CPU.
- In TIA Portal, build the device in exactly the same order as in the switchboard.
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.
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. |
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. |
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
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
- Connect the cable and check the link LED.
- In the PC network card settings, choose a suitable static IP or the company configuration.
- In TIA Portal, open online access and select the physical Ethernet adapter to which the PLC is connected.
- Start the search for accessible devices. Verify the identity by the MAC address, CPU type or LED flashing, if this function is available.
- Set the PROFINET device name. The device name matters for PROFINET identification and must match the project.
- Set the IPv4 parameters according to Device configuration.
- Carry out the download and, after the CPU switches to RUN, check Online & diagnostics.
5.3 When TIA Portal cannot see the PLC
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.
- Create a new project and add the device according to the order number on the side of the CPU.
- 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.
- In Network/Device view, set the PROFINET device name and IPv4 address.
- Add expansion modules in the same order as in the actual assembly.
- 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.
- V
Main [OB1]create a simple program. - Compile → fix errors → download → switch the CPU to RUN → monitor the logic online.
First program: indicator light controlled by a push button
This is a deliberately trivial program. It checks the entire chain: electrical wiring → input address → program → output address → load.
StartPB AND EnablePB. Then write the same task in LAD, FBD and SCL.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.
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.
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.
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.
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
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.
GuardClosed, stops on Fault and does not restart by itself after the fault is reset.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.
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;
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.
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
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.
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
- set the outputs for the state,
- evaluate interlocks,
- check completion,
- check timeout,
- 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;
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.
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.
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.
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
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;
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.
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.
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.
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.
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
- Define the data model: what is status, command, measurement, alarm.
- Enable and configure OPC UA in the CPU.
- Set users, certificates and security policy according to the environment.
- Make only the necessary variables accessible.
- Test reading, writing and subscription in the client.
- 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.
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.
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.
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.
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
- Is the CPU powered and not in STOP/ERROR?
- Is the physical network OK?
- Do the device name, IP and project match?
- Is the hardware configuration free of mismatches?
- What does the diagnostic buffer say?
- What are the actual inputs to the problematic block?
- 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.
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.
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
- Communication with the drive and telegram.
- Axis Technology Object.
- Enable / disable and safe state.
- Homing.
- Jog.
- Absolute move.
- Relative move.
- Velocity mode.
- 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.
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.
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.
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.
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
- Inventory of the old project: CPU, firmware, modules, signal boards, CM, HMI, drives.
- List of instructions and technology objects used.
- New hardware bill of materials for G2.
- Check of the physical terminals and switchboard.
- Migration/upgrade of the project in a supported TIA Portal version.
- Compile and remove incompatibilities.
- 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.
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.
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. |
Check test and answers
- Why do two RJ45 sockets not mean two independent PROFINET interfaces?
- Why is it not enough to look at the number of I/O when choosing a CPU?
- What is the difference between an FB and an FC?
- What does the PROFINET device name solve?
- Why is R_TRIG important when counting button presses?
- What is the difference between a permissive and a fault?
- Why must the raw analogue range be verified in the module datasheet?
- Why can a REAL in Modbus look wrong even with the correct registers?
- What should be checked before PID autotuning?
- Why is it not advisable to expose the PLC web server to the internet?
Short answers
- The P1/P2 ports are part of one X1 interface with an internal switch.
- Memory, expansion, fast functions, communication, output type and technology requirements are decisive.
- An FB has its own instance state; an FC has no instance memory of its own.
- Identification of the device in the PROFINET configuration.
- So that one physical event creates one program pulse instead of TRUE for several scans.
- A permissive is a precondition/enable; a fault is a diagnosed failure with a defined response.
- The ranges differ depending on the module and channel mode.
- Because of the word/byte order (endianness).
- Scaling, control polarity, limits, process dynamics and safe conditions.
- Because of cyber risk; it should be in a segmented OT network with controlled remote access.
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.
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.
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.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.
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.
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.
- Siemens – SIMATIC S7-1200 G2
- Siemens Industry Mall – CPU 1212C DC/DC/DC
- Siemens Industry Mall – CPU 1214C DC/DC/DC
- Siemens Industry Online Support – manuals, updates and product support
- Google Search Central – AI features and your website
- Google Search Central – optimizing for generative AI features
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.
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ód | TEKNIHA-S71200G2-CZ |
|---|---|
| Výrobce | TECHNOLINE |
Downloads
Ask about this product
Related products
6ES7822-0AE25-0YA5, Siemens, SIMATIC STEP 7 Basic V21, programming software (Floating License, download)
6ES7822-0AE25-0YA5
316,39 €
excl. VAT · 382,84 € incl. VAT
6ES7822-1AE25-0YA5, Siemens, SIMATIC STEP 7 Professional V21, programming software (Floating License, download)
6ES7822-1AE25-0YA5
2 002,89 €
excl. VAT · 2 423,49 € incl. VAT