π Master Siemens S7-1200 PLC Programming
The Ultimate Guide for Industrial Automation Professionals
πΌ Professional Level
β Updated 2024
π Table of Contents
π° Introduction: Why Choose S7-1200?
The Siemens S7-1200 has become the #1 choice for small to medium automation projects worldwide. But why?
π‘ Key Advantages
- β Compact Design β Fits anywhere, perfect for space-constrained installations
- β Integrated Ethernet β Programming, HMI, and network connectivity out of the box
- β Scalable β Start small, expand as your needs grow
- β TIA Portal β Modern development environment for all Siemens devices
- β Global Support β 24/7 technical assistance in 50+ countries
βοΈ Hardware Configuration Deep Dive
Letβs break down the S7-1200 family and help you choose the right CPU for your project.
| CPU Model | Digital I/O | Memory | Best For | Price Range |
|---|---|---|---|---|
| CPU 1211C | 6 DI / 4 DO | 50 KB | π― Beginners | $250-300 |
| CPU 1212C | 8 DI / 6 DO | 75 KB | π― Small Projects | $300-350 |
| CPU 1214C β | 14 DI / 10 DO | 100 KB | π― Most Popular | $400-450 |
| CPU 1215C | 14 DI / 10 DO + 2 AQ | 125 KB | π― Advanced | $550-600 |
π‘ Pro Tip: Start with CPU 1214C
For 90% of projects, the CPU 1214C offers the best balance of price and performance. It has enough I/O and memory for most applications while keeping costs reasonable.
π» Programming with TIA Portal
π¦ Required Software
π§ Step-by-Step Setup
Create New Project
Open TIA Portal β Create new project β Name it β Save
Add Device
Select PLC β Choose your CPU model β Confirm
Configure IP Address
PROFINET β Set IP (e.g., 192.168.1.10) β Subnet mask
Write Your First Program
Open OB1 β Drag LAD contacts β Assign addresses β Save
π Advanced Programming Techniques
β±οΈ Using Timers (TON, TOF, TP)
// TON (Timer On-Delay) // When I0.0 turns ON, Q0.0 turns ON after 5 seconds I0.0 ---[TON T#5S]---( )--- Q0.0 // TOF (Timer Off-Delay) // When I0.1 turns OFF, Q0.1 stays ON for 3 seconds I0.1 ---[TOF T#3S]---( )--- Q0.1 // TP (Pulse) // Generates a 2-second pulse when triggered I0.2 ---[TP T#2S]---( )--- Q0.2
π’ Using Counters (CTU, CTD, CTC)
// CTU (Count Up) // Counts to 10, then sets output I0.3 ---[CTU C#10]---( )--- Q0.3 // CTD (Count Down) // Counts down from preset value I0.4 ---[CTD C#5]---( )--- Q0.4
π οΈ Real-World Project: Conveyor Control
π― Project: Bottle Filling Station
π₯ Inputs
- I0.0 β Start Button
- I0.1 β Stop Button
- I0.2 β Bottle Sensor
- I0.3 β Level Sensor
- I0.4 β Emergency Stop
π€ Outputs
- Q0.0 β Conveyor Motor
- Q0.1 β Filling Valve
- Q0.2 β Capper
- Q0.3 β Reject Solenoid
- Q0.4 β Alarm Light
π Sample Logic
// Main Control Logic Network 1: Start/Stop Latch I0.0 (Start) ---[S]--- Q0.0 (Motor) I0.1 (Stop) ---[R]--- Q0.0 Network 2: Bottle Detection & Filling I0.2 (Bottle) AND Q0.0 (Motor Running) ---[TON T#2S]--- Q0.1 (Fill) Network 3: Level Check I0.3 (Full) AND Q0.1 (Filling) ---[=]--- Q0.0 (Stop Motor)
π§ Troubleshooting Common Issues
β Canβt Go Online
β Check IP addresses (must be same subnet)
β Verify Ethernet cable
β Disable Windows Firewall
β οΈ PLC Stuck in STOP
β Check diagnostic buffer in TIA Portal
β Look for fatal errors
β Reset to factory defaults if needed
π‘ Outputs Not Working
β Verify 24V power supply
β Check wiring connections
β Confirm PLC is in RUN mode
π¦ Ready to Start Your Project?
We stock all S7-1200 CPU models with fast worldwide shipping.
π Last Updated: April 2024 | ποΈ 15,000+ Views | β Helpful? Rate this article

