Phép toán nhị phân
I0.0
I0.1
Q 8.0
(MCRA)
Q 8.1
I 0.0
( MCR< )
I 1.0
I 1.1
Q 8.0
( )
M0.0
I1.2
S
SR
Q 9.3
Q
I1.3
R
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.1
Information and Training Center
Knowledge for Automation
Tiếp điểm thường mở, thường đóng, cảm biến, ký hiệu
Xử lý
Cảm biến
là ...
NO
contact
cảm biến bị ...
Xử lý kỹ thuật lập trình PLC
Có điện áp
tại cổng vào
không
Tình trạng Kiểm tra tình trạng tín
Tín hiệu
hiệu “1”
cổng vào
Ký hiệu/
Kết quả
Câu lệnh
kiểm tra
Tác động
LAD:
1
Yes
“Yes“
1
“NO contact”
Không
Tác động
No
0
FBD:
NC
contact
No
0
Không
Tác động
Yes
1
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.2
LAD:
“No”
0
FBD:
STL:
Kết quả
kiểm tra
“No”
0
“Yes”
1
&
“No”
0
A I x.y
SIMATIC S7
Ký hiệu/
Câu lệnh
“NC contact”
&
Tác động
Check for
signal state “0”
“Yes”
1
“Yes”
1
STL:
AN I x.y
“No”
0
Information and Training Center
Knowledge for Automation
Bài tập
Yêu cầu của bài tập: Trong cả 3 ví dụ thì đèn sáng khi tác động S1 và không tác động S2
Hardware
S1
S2
II1.0
1.0
S1
II1.1
1.1
II1.0
1.0
Programmable controller
II1.1
1.1
Programmable controller
Q 4.0
I 1.0
I 1.1
S2
II1.0
1.0
II1.1
1.1
Programmable controller
Q 4.0
Light
Software
S1
S2
Q 4.0
Light
I1.0
Q 4.0
I1.1
Light
Q 4.0
I1.0
I1.1
Q 4.0
LAD
I 1.0
FDB
&
Q 4.0
I1.1
STL
SIMATIC S7
Siemens AG 1999. All rights reserved.
&
I1.0
Q 4.0
I1.1
....... I1.0
....... I1.1
....... Q 4.0
....... I1.0
....... I1.1
....... Q 4.0
Date:
File:
I1.0
29.10.15
PRO1_06E.3
&
Q 4.0
I1.1
....... I1.0
....... I1.1
....... Q 4.0
Information and Training Center
Knowledge for Automation
Địa chỉ của các module S7 300
Slot No.
1
2
4
5
Modules
PS
CPU
SM
SM
6
SM
7
8
9
10
SM
SM
SM
SM
Address 0.0
Address 0.7
Address 1.0
Address 1.7
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.4
Information and Training Center
Knowledge for Automation
Địa chỉ DI/DO trong cấu hình đa tầng
PS
Rack
3
(Receive)
PS
Rack
2
IM
(Receive)
PS
Rack
1
PS
Rack
0
Slot
IM
1
CPU
2
SIMATIC S7
Siemens AG 1999. All rights reserved.
96.0
to
99.7
100.0
to
103.7
104.0
to
107.7
108.0
to
111.7
112.0
to
115.7
116.0
to
119.7
120.0
to
123.7
124.0
to
127.7
64.0
to
67.7
68.0
to
70.7
72.0
to
75.7
76.0
to
79.7
80.0
to
83.7
84.0
to
87.7
88.0
to
91.7
92.0
to
95.7
52.0
to
55.7
56.0
to
59.7
60.0
to
63.7
32.0
to
(Receive)
35.7
36.0
to
39.7
40.0
to
43.7
44.0
to
47.7
48.0
to
51.7
(Send)
0.0
to
3.7
4.0
to
7.7
8.0
to
11.7
12.0
to
15.7
16.0
to
19.7
3
4
5
6
IM
IM
Date:
File:
29.10.15
PRO1_06E.5
7
8
20.0
to
23.7
9
24.0
to
27.7
10
28.0
to
31.7
11
Information and Training Center
Knowledge for Automation
Các liên kết nhị phân: AND, OR
LAD
Circuit Diag.
FBD
STL
S1 (I 0.0)
I0.0
I0.1
Q 8.0
&
I 0.1
S2 (I 0.1)
AND
I 0.0
Q 8.1
=
Q 8.1
L1
(Q 8.0)
A
A
=
=
I0.0
I0.1
Q 8.0
Q 8.1
O
O
=
I0.2
I0.3
Q 8.2
L2
(Q 8.1)
S3
(I 0.2)
I0.2
S4
(I 0.3)
OR
Q 8.0
=
Q 8.2
I 0.2
I 0.3
I0.3
>=1
Q 8.2
=
L3 (Q 8.2)
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.6
Information and Training Center
Knowledge for Automation
Liên kết nhị phân: Exclusive OR (XOR)
LAD
I0.4
I0.5
FBD
I 0.4
Q 8.0
I0.4
I0.5
&
I 0.5
I 0.4
>=1
I 0.5
I 0.5
Siemens AG 1999. All rights reserved.
Q 8.0
=
&
I 0.4
SIMATIC S7
STL
Date:
File:
29.10.15
PRO1_06E.7
XOR
Q 8.0
=
A
AN
O
AN
A
=
I0.4
I0.5
X
X
=
I0.4
I0.5
Q8.0
I0.4
I0.5
Q8.0
Information and Training Center
Knowledge for Automation
Kết quả liên kết, kiêm tra lần đầu, ví dụ
I 1.0
0
1
1
AN I 1.1
0
1
0
A
M 4.0
0
1
1
=
Q 8.0
=
Q 8.1
A
I 2.0
0
1
0
A
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.8
Kiểm tra lần đầu
kết quả liên kết
Kết quả kiểm tra
Trạng thái tín hiệu
Ví dụ 3
Kiểm tra lần đầu
kết quả liên kết
Kết quả kiểm tra
Trạng thái tín hiệu
Ví dụ 2
Kiểm tra lần đầu
kết quả liên kết
Kết quả kiểm tra
Trạng thái tín hiệu
Ví dụ 1
Information and Training Center
Knowledge for Automation
Kết quả, Setting, Resetting
LAD
I 1.0
I 1.1
FBD
Q 8.0
( )
Kết quả
I 1.0
&
I 1.3
Q 8.1
(S )
Set
I 1.2
&
SIMATIC S7
Siemens AG 1999. All rights reserved.
A I 1.0
A I 1.1
= Q 8.0
A I 1.2
A I 1.3
S Q 8.1
Q 8.1
(R)
Reset
Q 8.1
S
I 1.3
I 1.4
Q 8.0
=
I 1.1
I 1.2
STL
I 1.5
I 1.4
I 1.5
Date:
File:
29.10.15
PRO1_06E.9
>=1
Q 8.1
R
O I 1.4
O I 1.5
R Q 8.1
Information and Training Center
Knowledge for Automation
Setting / Resetting một Flip Flop
LAD
M0.0
I1.2
Ưu tiên
Reset
FBD
S
SR
I1.2
S
SR
Q9.3
I1.3
I1.3
R
Ưu tiên
Set
M0.0
Q 9.3
Q
STL
R
M0.0
I1.3
R
RS
I1.3
R
RS
Q9.3
I1.2
I1.2
S
SIMATIC S7
Siemens AG 1999. All rights reserved.
=
M0.0
Q 9.3
Q
Q
Date:
File:
29.10.15
PRO1_06E.10
S
Q
=
A
S
A
R
A
=
I 1.2
M 0.0
I 1.3
M 0.0
M 0.0
Q 9.3
A
R
A
S
A
=
I 1.3
M 0.0
I 1.2
M 0.0
M 0.0
Q 9.3
Information and Training Center
Knowledge for Automation
Connector
LAD
I 1.0
I 1.1
STL
M0.0
I 2.0
I 2.1
( )
NOT
M 1.1
Q 4.0
( )
( )
FBD
I 1.0
&
M0.0
I 1.1
&
I 2.0
M1.1
I 2.1
SIMATIC S7
Siemens AG 1999. All rights reserved.
Q 4.0
A
I
A
I
=
M
A
M
A
I
A
I
NOT
=
M
A
M
=
Q
1.0
1.1
0.0
0.0
2.0
2.1
1.1
1.1
4.0
=
Date:
File:
29.10.15
PRO1_06E.11
Information and Training Center
Knowledge for Automation
Những lệnh ảnh hưởng đến RLO
LAD
I0.0
NOT
FBD
Q8.0
I0.1
( )
NOT
&
I0.0
I0.1
STL
Q8.0
=
A I0.0
A I0.1
NOT
= Q8.0
CLR
not available
not available
CLR
SET
not available
not available
SET
I1.6
SAVE
( SAVE )
Q8.1
BR
BR
( )
15
Siemens AG 1999. All rights reserved.
BR
SAVE
Q8.1
=
A BR
= Q 8.1
8
Status word
SIMATIC S7
&
I1.6
A I1.6
SAVE
BR
Date:
File:
29.10.15
PRO1_06E.12
1
RLO
Information and Training Center
Knowledge for Automation
Chức Master Control Relay
LAD
FBD
MCRA
MCRA
// Activated
&
MCR<
A I0.0
MCR(
// Enable MCR
// Open MCR
&
Q8.5
=
A I0.7
= Q8.5
= M0.6
// NO Contact
// Output Coil
// Output Coil
Q16.0
S
A I0.4
S Q16.0
// NO Contact
// Set Output
MCR>
)MCR
// Close MCR
M69.0
=
AN M5.5 // Emerg.Contact
AN I4.7 // Emerg.Contact
= M69.0 // Output Coil
( MCRA )
I0.0
( MCR< )
A0.0
Q8.5
I0.7
( )
A0.7
M0.6
=
M0.6
( )
Q16.0
I0.4
( S)
&
A0.4
( MCR> )
M5.5
I4.7
M69.0
( )
M5.5
I4.7
&
( MCRD )
SIMATIC S7
Siemens AG 1999. All rights reserved.
STL
MCRD
Date:
File:
29.10.15
PRO1_06E.13
MCRD
// Deactivate
Information and Training Center
Knowledge for Automation
Lệnh nhảy Jump (không phụ thuộc vào RLO)
LAD
Network 1
FBD
NEW1
( JMP )
Network 2
:
:
:
:
Network x
NEW1
JMP
....
Network 2
:
:
:
:
Network x
Network 1
JU NEW1
Network 2
:
:
:
:
Network x
NEW1
NEW1
M5.5
Network 1
STL
I4.7
SIMATIC S7
Siemens AG 1999. All rights reserved.
M69.0
( )
M5.5
I 4.7
Date:
File:
&
M69.0
=
29.10.15
PRO1_06E.14
NEW1:
AN M5.5
AN I4.7
=
M69.0
Information and Training Center
Knowledge for Automation
Nhảy có điều kiện (phụ thuộc vào RLO)
LAD
Jump if
RLO=1
Jump if
RLO=0
I 0.0
I 0.2
SIMATIC S7
Siemens AG 1999. All rights reserved.
I 0.1
I 0.3
FBD
NEW1
I0.0
(JMP)
I0.1
I0.2
NEW2
(JMPN)
Date:
File:
I0.3
29.10.15
PRO1_06E.15
&
&
STL
NEW1
JMP
A I0.0
A I0.1
JC NEW1
NEW2
JMPN
A I0.2
A I0.3
JCN NEW2
Information and Training Center
Knowledge for Automation
Nhận biết RLO
LAD
I1.0
I1.1
FBD
M1.0
M8.0
P
I1.0
I1.1
M1.1
N
I1.0
&
I1.1
M8.1
I1.0
I1.1
&
STL
M1.0
M8.0
P
=
M1.1
M8.1
N
=
A
A
FP
=
I1.0
I1.1
M1.0
M8.0
A
A
FN
=
I 1.0
I 1.1
M1.1
M8.1
OB1-Cycle
I1.0
I1.1
RLO
Example
M1.0
M1.1
M8.0
M8.1
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.16
Information and Training Center
Knowledge for Automation
Nhận biết sườn tín hiệu Signal
LAD
I1.0
I1.1
POS
M1.0
I1.0
M1.0
I1.1
POS
M_BIT
M1.1
I1.1
NEG
M_BIT
M8.0
Q
M_BIT
I1.1
NEG
M1.1
FBD
M8.1
Q
M_BIT
I1.0
I1.1
Example
I1.0
STL
&
M8.0
=
I1.0
&
M8.1
=
A
A
A
FP
M1.0
)
=
M8.0
A
A
A
FN
M1.1
)
=
M8.1
I1.0
(
I1.1
I1.0
(
I1.1
M1.0
M1.1
OB1-Cycle
M8.0
M8.1
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.17
Information and Training Center
Knowledge for Automation
Bài tập: Lập trình cho hệ thống làm đầy chai (chọn chế độ)
Hệ thống ON/OFF:
Chế độ tay/tự động:
I 0.0 = Start (Tiếp điêm NO)
I 0.4 = Tay/tự động (công tắc)
I 0.5 = Thay đổi chế độ (tiêp điểm NO)
I 0.1 = Stop (Tiếp điểm NC)
I 0.2 = Chạy thuận (M-C sw., NO funct.)
I 0.3 = Chạy ngược (M-C sw., NO func.)
Cảm biến
I 16.6 (I 8.6)
M
Q 20.5 (Q 8.5) Băng tải chạy thuận
Q 20.6 (Q 8.6) Băng tải chạy ngược
SIMATIC S7
Siemens AG 1999. All rights reserved.
Date:
File:
29.10.15
PRO1_06E.18
Information and Training Center
Knowledge for Automation