S7-1200 PLC Training Course Guide
S7-1200 PLC Training Course Guide
- Software Controller
15:30 – 16:00
- Q&A
16:00 – 16:30
Advanced Controller
Software Controller
SIMATIC S7-1500 SIMATIC S7-1500
Distributed Controller
SIMATIC ET 200
Basic Controller
SIMATIC S7-1200
Application complexity
Technology and
Switch- Power- Signal- Technology- Signal-
Communication- CPUs
module module modules modules boards
modules
CPU 1211C-1PN
CSM PM 13x CM / CP CPU 1212C-1PN 22x I/Q 2xTM 11x SB
CPU 1214C-1PN 1x CB
CPU 1215C-2PN 1x BB
CPU 1217C-2PN
CPU 1214FC
CPU 1215FC
8 DI, 6 DQ, 2 AI
4 : HSC Type of DO
Type of DI
14 DI, 10 DQ, 2 AI
S7-1200 : CPU1214C, CPU1215C, CPU1217C
6 : HSC
CPU1215C, CPU1217C
2 AQ
CPU1215C, CPU1217C
2 Ethernet ports
3 CM Board 8 SM
V18
Page 13 Unrestricted | © Siemens 2023
Overview
System requirements
Hardware/Software Requirements
Processor Intel Core i5-6440EQ, up to 3.4 GHz
RAM 16GB (min. 8GB, 32GB for large projects)
Hard Disk SSD with minimum 50GB free storage space
Network From 100 Mbit, 1Gbit for multi-user
Monitor 15.6” Full HD display (1920 x 1080 or more)
Operation system Windows 10 (64 bits) Windows 11 (64-bit)
• Windows 10 Professional Version 21H1 • Windows 11 Home Version 21H2
• Windows 10 Professional Version 21H2 • Windows 11 Professional Version 21H2
• Windows 10 Enterprise Version 2009/20H2 • Windows 11 Enterprise 21H2
• Windows 10 Enterprise Version 21H1
• Windows 10 Enterprise Version 21H2 Windows Server (64-bit)
• Windows 10 Enterprise 2016 LTSB • Windows Server 2016 Standard (full installation)
• Windows 10 Enterprise 2019 LTSC • Windows Server 2019 Standard (complete installation)
• Windows 10 Enterprise 2021 LTSC • Windows Server 2022 Standard (full installation)
Task Cards
(tools)
Menu bar and toolbar
Project
navigation Working area
(Project tree)
Reference
projects
Details
Inspector window
view
- Properties
- Info output Group
Task bar - Diagnostics opened editors
(opened editors)
Device view
• Photo-realistic representation of
controllers and modules
• Automatic filter function for
hardware catalog
• Module "parking space" for storage
of configured modules
• Clear, context-sensitive property
dialogs
Network view
• Clear representation of all devices
• Easy graphic or tabular configuration of
connection
• Support for all Technology and Communication
services: PROFIBUS, PROFINET, ASi, MPI,
etc. (exceptions: FMS and GD)
• Support for GSD, GSDML, Tool Calling
Interface (TCI)
• Support for I-slave, option handling with
ET 200S
• Topology editor
NO - Normally Open
NC - Normally Close
AND
OR
Set
Ptrig | Ntrig
Pump1
Absolute address
Symbolic address
State
Positive signal Negative signal
1
0
Timer
Page 23 Unrestricted | © Siemens 2023
Instructions
Bit logic operations: Set/Reset Coil When Set_BF is
active, 5 output
from %Q0.0 to Q0.4
set to ON
When Reset_BF is
active, 5 output
from %Q0.0 to Q0.4
Page 24 Unrestricted | © Siemens 2023 reset to OFF
Exercise 5
A simple latch circuit
Tag name Address
ON1 %I0.0
This pump is controlled by PLC S7-1200
OFF1 %I0.1
with the cabinet1 and HMI.
We can control this pump: M_ON1 %M0.1
- To start Pump: press ON1 button or M_OFF1 %M0.0
M_ON1 button.
Pump1 %Q0.0
- To stop Pump: press OFF1 button or
M_OFF1 button.
I3.7 I3.6 I3.5 I3.4 I3.3 I3.2 I3.1 I3.0 I2.7 I2.6 I2.5 I2.4 I2.3 I2.2 I2.1 I2.0 I1.7 I1.6 I1.5 I1.4 I1.3 I1.2 I1.1 I1.0 I0.7 I0.6 I0.5 I0.4 I0.3 I0.2 I0.1 I0.0
I0.7 I0.6 I0.5 I0.4 I0.3 I0.2 I0.1 I0.0 0 IB0 IW0 ID0
Memory I1.7 I1.6 I1.5 I1.4 I1.3 I1.2 I1.1 I1.0 1 IB1
I2.7 I2.6 I2.5 I2.4 I2.3 I2.2 I2.1 I2.0 2 IB2 IW2
I Q M I3.7 I3.6 I3.5 I3.4 I3.3 I3.2 I3.1 I3.0 3 IB3
I4.7 I4.6 I4.5 I4.4 I4.3 I4.2 I4.1 I4.0 4 IB4 IW4 ID4
0 0 0
I5.7 I5.6 I5.5 I5.4 I5.3 I5.2 I5.1 I5.0 5 IB5
1023 1023 xxx Bytes I6.7 I6.6 I6.5 I6.4 I6.3 I6.2 I6.1 I6.0 6 IB6 IW6
I7.7 I7.6 I7.5 I7.4 I7.3 I7.2 I7.1 I7.0 7 IB7 F FA
Use Timer, Counter to calculate the pump hours worked and the pump times worked.
Output of them, can be display on screen.
So, we use two blocks (Norm_X, Scale_X) to normalize and scale the soft-range value to the
engineering value.
4 mA
X Y
20 mA 27648 100%
(X – 0) (Y – 50) (X-0) * (100-50)
(27,648 – 0)
= (100 – 50)
Y = 50 +
(27,648-0)
0 -20.0
AI
27648 60.0
NORMX SCALEX
1.0 1.0
0.0 0.0
AQ
NORMX SCALEX
1.0 1.0
0.0 0.0
0-10V DC
0-10V DC
Functions (FC) Functions contain program routines for recurring tasks. They have no
"memory".
Function blocks (FB) Function blocks are code blocks that store their values permanently in
instance data blocks, so that they remain available even after the block
has been executed.
Instance data blocks (DB) Instance data blocks are assigned to a function block when it is called
for the purpose of storing program data.
Global data blocks (DB) Global data blocks are data areas for storing data that can be used by
any blocks.
Operating system
Choose FB
Place the name
Click OK
Double- Programming
click Add language
new block
Adding tags
M2
Symbol: Timesworked_M1
You can enable DB_offset to show the absolute address of DB_tags Absolute: DB7.DBD0
Ethernet Others
CPU_Station1 CPU_Station2
IP address : [Link] IP address : [Link]
Subnet mask: [Link] Subnet mask: [Link]
Select S7-
Connection_1
CPU_Station1
CPU_Station2
CPU_Station1 CPU_Station2
Get_Data [DB5] Put_Data [4] Send_Data [DB1] Receive_Data [3]
▪ Modbus RTU
▪ Modbus TCP
▪ Modbus RTU:
Giao thức RTU được mã hóa nhị phân. Phổ biến với RS232/RS485
Tốc độ truyền phổ biến 1200 .. 115200 bps. Phổ biến với 9600/19200
CM1242 RS232 1 Slave
CM1241 RS422: Upto 10 Slave
CM1241 RS485 Upto 32 Slave
▪ Modbus TCP
Giao thức TCP dựa trên nền tảng Industrial Ethernet
Chuyển đổi tên gọi Master-Slave sang Client-Server
Function Code
Description Size Modbus address Type
(FC)
01, 05, 15 Discrete output coil 1 bit 0x 1 … 9999 R/W
02 Read input status 1 bit 1x 10001 … 19999 R
03,06,16 Read holding register 16 bit 4x 40001 … 49999 R/W
04 Read input register 16 bit 3x 30001 … 39999 R
Modbus Client
MB Master
MB Server
RTU devices
Page 82 Unrestricted | © Siemens 2023
Technology and Communication
Modbus TCP Server
Bộ thông số Connect:
- Được tạo trong Datablock, chọn Datatype là TCON_IP_V4
Bộ thông số MB_Hold_Reg:
Được tạo trong Datablock, chọn kiểu dữ liệu Array[1..10] of Int
Gán tham số tương ứng cho khối MB_Server ở Chương trình Main (OB1)
Download và kiểm tra chương trình.
Dùng phần mềm Modbus Poll đóng vai trò Modbus Client để đọc/ghi dữ liệu
Link download tool: Download ([Link])
MB_Server MB_Client
LIVE DEMO
Modbus Client
• Create new Data block
RTU devices
Page 90 Unrestricted | © Siemens 2022 | DI FA S SUP HMI
Technology and Communication
Modbus TCP Server
HANDS ON in 15 min
Modbus Client
• Create new Data block
RTU devices
Page 91 Unrestricted | © Siemens 2022 | DI FA S SUP HMI
Modbus TCP Client
Modbus TCP Client – thường là Controller, Scada, nơi thu thập dữ liệu.
Trong TIA Portal, được cấu hình thông qua block MB_Client
To SCADA
Modbus Client
Modbus TCP/IP
Modbus Server
Page 93 Unrestricted | © Siemens 2023
Technology and Communication
Modbus TCP Client
Bộ thông số Connect:
- Được tạo trong Datablock, chọn Datatype là TCON_IP_V4
Bộ thông số MB_Data_PTR:
Được tạo trong Datablock, chọn kiểu dữ liệu Array[1..10] of Int
Gán tham số tương ứng cho khối MB_Server ở Chương trình Main (OB1)
Download và kiểm tra chương trình.
Dùng phần mềm Modbus Slave đóng vai trò Modbus Server để đọc/ghi dữ liệu
Link download tool: Download ([Link])
MB_Client MB_Server
LIVE DEMO
To SCADA
• Create new Data block
• Create & Configure Connect parameter
Modbus Client
• Create Holding register
• Create & Configure MB_Client
Modbus Server
Page 102 Unrestricted | © Siemens 2022 | DI FA S SUP HMI
Technology and Communication
Modbus TCP Client
HANDS ON in 15 min
To SCADA
• Create new Data block
• Create & Configure Connect parameter
Modbus Client
• Create Holding register
• Create & Configure MB_Client
Modbus Server
Page 103 Unrestricted | © Siemens 2022 | DI FA S SUP HMI
Q&A
Select Online
access
Select PC/PG
interface
Click Go online
OK
Online and
offline
different
Different in
lower-level
component
subordinate defect
o.K.
Differences Online/Offline
Defect
only Online
Maintenance
only Offline
Page 108 Unrestricted | © Siemens 2023
Online & Diagnostics
Online monitor
CPU Events
Details on event
PG/PG time
CPU time
Sync time
Online data
Firmware loader
Run update
Select Retain or
Delete IP address
Click Reset
3
Click OK to change to
2 Device view
Select your CPU
and specify the CPU
name
2
Select your network interface
Then click Start search
1
Click Detect
3
Select your target
devices
Then click Detect
10