0% found this document useful (0 votes)
79 views116 pages

S7-1200 PLC Training Course Guide

modbus s71200

Uploaded by

hoangtung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views116 pages

S7-1200 PLC Training Course Guide

modbus s71200

Uploaded by

hoangtung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TIA PORTAL

Simatic S7-1200 Basis Training Course

Page 1 Unrestricted | © Siemens 2023


SIMATIC S7-1200 Basis Training Course
Agenda
Day Schedule Day Workflow Contents and Information
- Welcome & Introduces
13:00 – 13:30 - System Overview
- Engineering Software
- PLC Tags
13:30 - 13:45 - Using basic instructions with LAD, SCL
(logics, counters, timers, analog IO)
- FC,FB,DB concept
13:45 - 14:15

14:15 - 14:30 - Break - Get some fresh air

- Modbus TCP Server


14:30 – 15:00

15:00 – 15:30 - Modbus TCP Client

- Software Controller
15:30 – 16:00

- Q&A
16:00 – 16:30

Page 2 Unrestricted | © Siemens 2023


Overview

Engineered with TIA Portal


System performance

Advanced Controller
Software Controller
SIMATIC S7-1500 SIMATIC S7-1500

Distributed Controller
SIMATIC ET 200

Basic Controller
SIMATIC S7-1200

Application complexity

Page 4 Unrestricted | © Siemens 2023


Overview

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

Page 5 Unrestricted | © Siemens 2023


Use PTO to
select DC
Overview

S7-1200 : 6 DI, 4 DQ, 2 AI


CPU1211C 3 : HSC S7-1200 : CPU1212C

8 DI, 6 DQ, 2 AI

4 : HSC Type of DO

Type of DI

2 SM Type of Power Supply

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

Page 6 Unrestricted | © Siemens 2023


Overview
Hardware

Page 7 Unrestricted | © Siemens 2023


Overview
Indicator status

1. Yellow light indicates STOP operating state.


2. Green light indicates RUN operating state.
3. A flashing light indicates STARTUP operating
state.
4. ERROR LED for indicating errors and MAINT
LED for indicating that maintenance is required.

Page 8 Unrestricted | © Siemens 2023


Overview
SD Card

1. Transferring a program to multiple CPUs


2. Firmware update of CPUs, signal modules
(SMs) and Technology and Communication
modules (CMs)
3. Easy replacement of the CPU

Page 9 Unrestricted | © Siemens 2023


Overview
RUN/STOP CPU

1. In the STOP operating state, the CPU is not


executing the program and you can download a
project.
2. In the STARTUP operating state, the CPU is
starting up.
3. In the RUN operating state, the program is
cyclically executed.

Page 10 Unrestricted | © Siemens 2023


Engineering Software

Page 11 Unrestricted | © Siemens 2023


TIA Selection tool

TIA Selection Tool Cloud


Quick, easy, smart configuration

Page 12 Unrestricted | © Siemens 2023


Overview
Engineering framework

SIMATIC STEP 7 (TIA Portal) V18


TRIAL Download
Entry type: Download, Entry ID:

TIA 109807109, Entry date: 11/24/2020

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)

Page 14 Unrestricted | © Siemens 2023


Overview
Portal View | Project View

Page 15 Unrestricted | © Siemens 2023


Overview
Portal View

Selection window for


the selected action

Actions for the


Portals for various selected portal
tasks

Page 16 Unrestricted | © Siemens 2023


Overview
Project view

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)

Page 17 Unrestricted | © Siemens 2023


Overview
Device view

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

Supported modules (general rule)


• All HW modules that were being actively marketed on 2007-10-01 (in CA01) are supported with
STEP 7 Professional.

Page 18 Unrestricted | © Siemens 2023


Overview
Device view

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

Optimal control and easy interconnection in the network view

Page 19 Unrestricted | © Siemens 2023


Instructions (Logics)

Page 20 Unrestricted | © Siemens 2023


Instructions
Bit logic operations

NO - Normally Open

NC - Normally Close

AND

OR

Set

Ptrig | Ntrig

Page 21 Unrestricted | © Siemens 2023


Instructions
Bit logic operations: NO | NC | Coil

Symbolic | absolute display

Pump1

Absolute address

Symbolic address

Page 22 Unrestricted | © Siemens 2023


Instructions
Bit logic operations: P trig | N trig

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

If %I0.0 is ON, %Q0.0 is ON, then


%I0.0 is OFF, %Q0.0 is still ON

Unstil, Reset coil with %Q0.0 is


call, then %Q0.0 is OFF

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.

Page 25 Unrestricted | © Siemens 2023


Exercise 5
A simple latch circuit

Page 26 Unrestricted | © Siemens 2023


Memories

Page 27 Unrestricted | © Siemens 2023


Instructions
Data Type

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

BYTE 3 BYTE 2 BYTE 1 (1 byte data) BYTE 0


IB3 IB2 IB1 IB0
WORD 2 (2 bytes data) WORD 0
IW2 IW0
(4 bytes data) DWORD 0
ID0

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

Page 28 Unrestricted | © Siemens 2023


Instructions
Memory

CPU 1211C / 1212 C


I
➢ I : 0…1023 (1024 bytes)
➢ Q : 0…1023 (1024 bytes)
➢ M : 0…4095 (4096 bytes)
Memory Q
CPU 1214C / 1215C / 1217C
➢ I : 0…1023 (1024 bytes)
M ➢ Q : 0…1023 (1024 bytes)
➢ M : 0…8191 (8192 bytes)

Page 29 Unrestricted | © Siemens 2023


Instructions ( Counters, Timers)

Page 30 Unrestricted | © Siemens 2023


Instructions
On delay timer - TON
Fixed terms for PT
PT = 700ms ➔ T#700ms
PT = 5 Sec ➔ T#5s
PT = 10 Minute ➔ T#10m
PT = 8 Hour ➔ T#8h
PT = 5 Day ➔ T#5d

Page 31 Unrestricted | © Siemens 2023


Instructions
Off delay timer - TOF
Fixed terms for PT
PT = 700ms ➔ T#700ms
PT = 5 Sec ➔ T#5s
PT = 10 Minute ➔ T#10m
PT = 8 Hour ➔ T#8h
PT = 5 Day ➔ T#5d

Page 32 Unrestricted | © Siemens 2023


Instructions
Counter up - CTU

You can use the "Count up" instruction to


increment the value at output CV. When the
signal state at the CU input changes from
"0" to "1" (positive signal edge), the
instruction is executed and the current
counter value at the CV output is
incremented by one. The counter value is
incremented each time a positive signal
edge is detected, until it reaches the high
limit for the data type specified at the output
CV. When the high limit is reached, the
signal state at the CU input no longer has
an effect on the instruction

Page 33 Unrestricted | © Siemens 2023


Exercise 7
Calculate the pump hours worked and the pump times worked

Use Timer, Counter to calculate the pump hours worked and the pump times worked.
Output of them, can be display on screen.

Page 34 Unrestricted | © Siemens 2023


Exercise 7
Calculate the pump hours worked and the pump times worked

Page 35 Unrestricted | © Siemens 2023


SIMATIC S7-1200
Q&A

Question 1: Question 2: Question 3:

Answer: Answer: Answer:

Page 36 Unrestricted | © Siemens 2023


Instructions ( Analog Input & Output)

Page 37 Unrestricted | © Siemens 2023


Instructions
Processing of analog value
Simatic analog signal module will read the values from the input or output with a range of:
Voltage: ±10V, ±5V, ±2.5V | Current: 0 – 20mA, 4 – 20mA.

But in TIA Portal, the soft-range value is from 0 to 27,648.

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)

Page 38 Unrestricted | © Siemens 2023


Instructions
Processing of analog value

Page 39 Unrestricted | © Siemens 2023


Instructions
Processing of analog value

-10V -5V 0V 5V 10V


0mA 10mA 20mA Sensor
4mA 12mA 20mA Analog signal value

-27648 -13824 0 13824 27648 TIA


0 13824 27648 Soft-range value
0 13824 27648

Page 40 Unrestricted | © Siemens 2023


Instructions
Read analog input
Example: A temperature sensor: Hardware: Chanel 0: Voltage(4 – 20 mA)
- Measuring range: -20 …. 60 0C. %IW 128
- Output: 4 … 20 mA. Soft-range: 0-27648

0 -20.0
AI

27648 60.0

Depend on specification Depend on measuring


range of sensor

Page 41 Unrestricted | © Siemens 2023


Instructions
Reading analog input

NORMX SCALEX

1.0 1.0

MD18 (REAL) MD18 (REAL)

0.0 0.0

10 27648 0 -2.0 60.0

Voltage signal %IW128 (INT) MD22 (REAL)


4..20mA 0-27648 -20..60 oC
0 Read Analog Input

Page 42 Unrestricted | © Siemens 2023


Instructions
Write analog output
Example: A Variable Speed Drive: Hardware: Chanel 0: Voltage(±10V DC)
- Control frequency: 0 – 60 Hz. %QW 80
- Analog Input: 0 – 10 VDC. Soft-range: 0 – 27468

AQ

Depend on control Depend on specification


range of devices

Page 43 Unrestricted | © Siemens 2023


Instructions
Write analog output

NORMX SCALEX

1.0 1.0

MD26 (REAL) MD26 (REAL)

0.0 0.0

60.0 0.0 0 27648 10

%MD30 (REAL) %QW80 (INT) Voltage signal


0-10V DC
Write Analog Output 0

Page 44 Unrestricted | © Siemens 2023


Instructions
Diagnostic in Analog modules

Overflow diagnostics in analog signal modules

Page 45 Unrestricted | © Siemens 2023


Instructions
Processing of analog value

-10V -5V 0V 5V 10V


0mA 10mA 20mA Sensor
4mA 12mA 20mA Analog signal value

-27648 -13824 0 13824 27648 TIA


0 13824 27648 Soft-range value
0 13824 27648

Page 46 Unrestricted | © Siemens 2023


Exercise 9
Calculate machine times worked | machine hours worked

Read Analog Input from Potentiometer

0-10V DC

Potentiometer Simatic S7-1200


Page 47 Unrestricted | © Siemens 2023
Exercise 9
Calculate machine times worked | machine hours worked
Write Analog Output to Voltmeter

0-10V DC

Simatic S7-1200 DC Voltmeter


Page 48 Unrestricted | © Siemens 2023
SIMATIC S7-1200
Q&A

Question 1: Question 2: Question 3:

Answer: Answer: Answer:

Page 49 Unrestricted | © Siemens 2023


FB, FC, DB

Page 50 Unrestricted | © Siemens 2023


Programming Concept
Overview of the block types

Block type Brief description


Organization blocks (OB) Organization blocks define the structure of the user program.

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.

Page 51 Unrestricted | © Siemens 2023


Programming Concept
Organization Blocks

Start event Possible OB Default system


numbers reaction
Startup routine
ON (Run)
OB 100 Warm restart Startup 100,  123 Ignore

Cyclic program 1,  123 Ignore
Time-of-day interrupt 10 to 11 -
Cyclic
program processing Interrupt-driven Update interrupt 56 Ignore
Cycle OB 1 program processing
OB 40 … Scan cycle monitoring time 80 Ignore
exceeded once
Interruption Scan cycle monitoring time 80 STOP
Interrupt exceeded twice
Diagnostic interrupt 82 Ignore

Interruption Error handling


Error OB 80
OB 82

Operating system

Page 52 Unrestricted | © Siemens 2023


Programming Concept
Create new FB

Choose FB
Place the name
Click OK

Double- Programming
click Add language
new block

Page 53 Unrestricted | © Siemens 2023


Programming Concept
Create new FB

Declare in/out tags and programming in your workspace

Page 54 Unrestricted | © Siemens 2023


Programming Concept
Create new FB

Page 55 Unrestricted | © Siemens 2023


Programming Concept
Create new FB

Page 56 Unrestricted | © Siemens 2023


Programming Concept
Use FB

Drag & Drop


Place name of
Instance DB

Page 57 Unrestricted | © Siemens 2023


Programming Concept
Use FB

Adding tags

M2

Page 58 Unrestricted | © Siemens 2023


Programming Concept
Data Blocks
Double-
click Add Choosenew
Create DB DB tags
new block Stick Retain
Place the name
if you
want to
Click OKretain last
value

Page 59 Unrestricted | © Siemens 2023


Programming Concept
Data Blocks
Timesworked_M1 and Timesworked_M2 is retained the last value whether the CPU is Stop or no power supply
While RunningTime_M1 and RunningTime_M2 is not.

Symbol: Timesworked_M1
You can enable DB_offset to show the absolute address of DB_tags Absolute: DB7.DBD0

Page 60 Unrestricted | © Siemens 2023


Exercise 10
Practice with FB,FC,DB
Create your FB with in/out tag as bellows:

Page 61 Unrestricted | © Siemens 2023


Exercise 10
Practice with FB,FC,DB
Create DataBlock and declare tags as bellow:

Open Main(OB1) and replace

Timesworked_M1 %MD28 Data.Timesworked_M1 %DB7.DBD0


Timesworked_M2 %MD44 Data.Timesworked_M2 %DB7.DBD4

Page 62 Unrestricted | © Siemens 2023


Q&A

Question 1: Question 2: Question 3:

Answer: Answer: Answer:

Page 63 Unrestricted | © Siemens 2023


Communications

Page 64 Unrestricted | © Siemens 2023


Technology and Communication
Industrial Ethernet Protocols

Page 65 Unrestricted | © Siemens 2023


Technology and Communication
Industrial network market shares 2022 – HMS Network

Page 66 Unrestricted | © Siemens 2023


Technology and Communication
S7-Connection

Ethernet Others

S7- Technology and Communication Modbus RTU


Open User Technology and PROFIBUS
Communication (OUC) Teleservices
Modbus TCP Mqtt Client, Sql Client
PROFINET IO Opc Ua, DNP3, IEC-104
PROFINET CBA
Page 67 Unrestricted | © Siemens 2023
S7-Connections

Page 68 Unrestricted | © Siemens 2023


Technology and Communication
Configuration of S7-Connection

Add Network connections Add S7-Connection

CPU_Station1 CPU_Station2
IP address : [Link] IP address : [Link]
Subnet mask: [Link] Subnet mask: [Link]

Page 69 Unrestricted | © Siemens 2023


Technology and Communication
Configuration of S7-Connection

Select S7-
Connection_1

Check Connection path


Local - Partner

Page 70 Unrestricted | © Siemens 2023


Technology and Communication
Permit access with PUT/GET Technology and Communication form remote partner

CPU_Station1

CPU_Station2

Page 71 Unrestricted | © Siemens 2023


Technology and Communication
Optimized block access

Optimized block access for all


DB interface

CPU_Station1 CPU_Station2
Get_Data [DB5] Put_Data [4] Send_Data [DB1] Receive_Data [3]

Page 72 Unrestricted | © Siemens 2023


Technology and Communication
PUT

CPU_Station1 : Active CPU P#DB3.DBX0.0 BYTE 12:


Input: In this example 12 bytes of data are stored in
- Enable_Put: request Put function. DB3 of the partner CPU starting at address 0
- ID: S7-Connection ID.
- Addr_1: Pointer to the area to be written to in the partner CPU. P#DB4.DBX0.0 BYTE 12:
- SD_1: Pointer to the area to be written to in your own CPU. In this example 12 bytes of data are stored in
DB4 of the local CPU starting at address 0

Page 73 Unrestricted | © Siemens 2023


Technology and Communication
GET

CPU_Station1 : Active CPU P#DB1.DBX0.0 BYTE 6:


Input: In this example 6 bytes of data are stored in
- Enable_Get: request Get function. DB1 of the partner CPU starting at address 0
- ID: S7-Connection ID.
- Addr_1: Pointer to the area to be read in the partner CPU. P#DB5.DBX0.0 BYTE 6:
- RD_1: Pointer to the area in your own CPU in which the read In this example 6 bytes of data are stored in
data is stored. DB5 of the local CPU starting at address 0

Page 74 Unrestricted | © Siemens 2023


Modbus TCP

Page 75 Unrestricted | © Siemens 2023


Technology and Communication
Overview

▪ Modbus được Modicon phát triển năm 1979


▪ Tiêu chuẩn thông dụng trong lĩnh vực tự động hóa và là giao thức miễn phí.
▪ Modbus hoạt động với cơ chế Master – Slave hoặc Client – Server.

Page 76 Unrestricted | © Siemens 2023


Technology and Communication
Modbus overview

Các giao thức truyền thông phổ biến:


▪ Modbus ASCII

▪ Modbus RTU

▪ Modbus TCP

Page 77 Unrestricted | © Siemens 2023


Technology and Communication
Modbus overview

Các giao thức truyền thông phổ biến:


▪ Modbus ASCII
Giao thức ASCII được mã hóa theo hexa, sử dụng đặc tính 4 bit

▪ 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

Page 78 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP

Modbus TCP là một giao thức mở


Truyền thông Modbus TCP có thể được cấu hình hoặc lập trình thông qua các
kết nối:
➢PROFINET
➢ETHERNET
Các tham số kết nối được gán thông qua một cấu trúc (SDT)
➢TCON_IP_v4
➢TCON_Configured
Modbus TCP chiếm các tài nguyên truyền thông với OUC Communication
Resources
Modbus TCP sử dụng “well-known” port 502
Modbus TCP sử dụng thư viện có sẵn MB_Server và MB_Client

Page 79 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP

Một số quy định chung về Modbus cần biết:

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

Tương ứng với PLC S7-1200/1500:


• Ouput coil = PLC Output
• Input coil = PLC Input
• Holding register = PLC memory/data block area
• Input register = PLC analog input

Page 80 Unrestricted | © Siemens 2023


Modbus TCP Server

Page 81 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

Modbus TCP Server – thường là thiết bị trường, nơi chứa dữ liệu


Trong TIA Portal, được cấu hình thông qua block MB_Server

Modbus Client

MB Master
MB Server

RTU devices
Page 82 Unrestricted | © Siemens 2023
Technology and Communication
Modbus TCP Server

Các thông số quan trọng:

• Disconnect: Ngắt kết nối tính năng Modbus Server


• MB_Hold_Reg: Pointer trỏ đến datablock/memory
area. Chỉ khai báo Holding register
• Connect: Bộ thông số kết nối

Page 83 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

Page 84 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

Bộ thông số MB_Hold_Reg:
Được tạo trong Datablock, chọn kiểu dữ liệu Array[1..10] of Int

Page 85 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

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.

Các Status cần biết:

Page 86 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

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

IP: [Link] Modbus TCP/IP


Port: 502

Page 87 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

Connection setup Red/Write Definition

Page 88 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

Page 89 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Server

LIVE DEMO
Modbus Client
• Create new Data block

MB Master • Create & Configure Connect parameter


MB Server
• Create Holding register
• Create & Configure MB_Server
• Download & Testing with Modbus Pool

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

MB Master • Create & Configure Connect parameter


MB Server
• Create Holding register
• Create & Configure MB_Server
• Download & Testing with Modbus Pool

RTU devices
Page 91 Unrestricted | © Siemens 2022 | DI FA S SUP HMI
Modbus TCP Client

Page 92 Unrestricted | © Siemens 2023


Technology and Communication
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

Các thông số quan trọng:

• Req: gửi yêu cầu đọc/ghi dữ liệu tới MB Server


• Disconnect: Ngắt kết nối tính năng Modbus Client
• MB_Mode: 0: Read, 1:Write
• MB_Data_Addr: Địa chỉ thanh ghi cần kết nối
• MB_Data_Len: Số lượng thanh ghi cần kết nối bắt
đầu từ MB_Data_Addr.
• MB_Data_PTR: Nơi lưu trữ dữ liệu đọc/ghi
• Connect: Bộ thông số kết nối

Page 94 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

Page 95 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

Bộ thông số MB_Data_PTR:
Được tạo trong Datablock, chọn kiểu dữ liệu Array[1..10] of Int

Page 96 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

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.

Các Status cần biết:

Page 97 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

Go online và nhập thông số như hình bên dưới:

Page 98 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

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

IP: [Link] Modbus TCP/IP


Port: 502

Page 99 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

Connection setup Red/Write Definition

Page 100 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

Page 101 Unrestricted | © Siemens 2023


Technology and Communication
Modbus TCP Client

LIVE DEMO
To SCADA
• Create new Data block
• Create & Configure Connect parameter
Modbus Client
• Create Holding register
• Create & Configure MB_Client

Modbus TCP/IP • Download & Testing with Modbus Slave

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 TCP/IP • Download & Testing with Modbus Slave

Modbus Server
Page 103 Unrestricted | © Siemens 2022 | DI FA S SUP HMI
Q&A

Question 1: Question 2: Question 3:

Answer: Answer: Answer:

Page 104 Unrestricted | © Siemens 2023


Online & Diagnostics

Page 105 Unrestricted | © Siemens 2023


Online & Diagnostics
Go online

Select Online
access

Select PC/PG
interface

Click Go online

Page 106 Unrestricted | © Siemens 2023


Online & Diagnostics
Online diagnostics

OK
Online and
offline
different

Different in
lower-level
component

Page 107 Unrestricted | © Siemens 2023


Online & Diagnostics
Online diagnostics

subordinate defect
o.K.
Differences Online/Offline
Defect
only Online
Maintenance
only Offline
Page 108 Unrestricted | © Siemens 2023
Online & Diagnostics
Online monitor

Go online & Monitor on/off Run/Stop CPU


offline command

Page 109 Unrestricted | © Siemens 2023


Online & Diagnostics
Diagnostics buffer

CPU Events

Details on event

Page 110 Unrestricted | © Siemens 2023


Online & Diagnostics
Set time

PG/PG time

CPU time

Sync time

Page 111 Unrestricted | © Siemens 2023


Online & Diagnostics
Firmware update

Online data

Firmware loader

Run update

Page 112 Unrestricted | © Siemens 2023


Online & Diagnostics
Factory reset

Select Retain or
Delete IP address

Click Reset

Page 113 Unrestricted | © Siemens 2023


Online & Diagnostics
Add new CPU from accessible devices ( Option 2)
1
Double-click

3
Click OK to change to
2 Device view
Select your CPU
and specify the CPU
name

Page 114 Unrestricted | © Siemens 2023


Online & Diagnostics
Hardware detection

2
Select your network interface
Then click Start search

1
Click Detect

3
Select your target
devices
Then click Detect

10

Page 115 Unrestricted | © Siemens 2023


Q&A

Question 1: Question 2: Question 3:

Answer: Answer: Answer:

Page 116 Unrestricted | © Siemens 2023


THANK YOU FOR YOUR LISTENING!

Thuan, Ho Vinh (Mr)

Siemens Limited (VN)


RC-VN DI PR&TS SS-FA
SGN A
33 Le Duan Str, HCMC, VIET NAM
Mobile: +84 915 810 232
Mailto: [Link]@[Link]

Page 117 Unrestricted | © Siemens 2023

You might also like