Tải bản đầy đủ (.ppt) (28 trang)

giáo trình s7200 dịch chuyển timer và bài tập s7200

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (716.66 KB, 28 trang )

Phép toán số

M0.0

IW0
IW2

CMP ==I

Q 9.7

IN1
IN2

T4
S_ODT

I0.7

Q

S

S5T#35s
I0.5

SIMATIC S7
Siemens AG 1999. All rights reserved.

TV
R



BI
BCD

Q8.5
MW0
QW12

Date:
File:

29.10.15
PRO1_07E.1

Information and Training Center
Knowledge for Automation


Dạng số (16 Bits)
PG

CPU
Sign (+)

BCD

W#16#296

15


14

13

12

6

11 10

9

8

7

6

5

4

3

2

1

0


0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0
+296

Sign (-)

BCD

9

0 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0

Các số dương

INTEGER

2

28

25

=
256 +

=
=
32 + 8 = 296

4


23

1

3

W#16#F413
1 1 1 1 0 1 0 0 0 0 0 1 0 0 1 1

Các số âm
15

14

13

12

11 10

9

8

7

6

5


4

3

2

1

0

1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1
INTEGER

28 27

-413

= =
256+ 128 +

24 23 22
= = =
16+8+ 4 = 412

- (412 + 1) = - 413

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:

File:

29.10.15
PRO1_07E.2

Information and Training Center
Knowledge for Automation


Dạng số (32 Bits)
Sign (+)

BCD
DW#16#296

0

0

0

0

2

9

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0
31


DINT

30

29

28

27 26

25

24

23

22

21

20 19

18

17

16 15

14


13

12

11 10

9

8

7

6

5

4

3

2

1

0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0

+296


Integer (32 Bit) =
REAL
+0.75
or
+7.5 E-1

6

28

25

23

=
256 +

=
=
32 + 8 = 296

General Format of a Real Number = (Sign) • (1.f) • (2 e-127)
Sign of
Real No
31

30

f = Mantissa (23 Bit)


e = Exponent (8 Bit)
29

28

27 26

25

24

23

22

21

20 19

18

17

16 15

14

13

12


11 10

9

8

7

6

5

4

3

2

1

0

0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27 26 25 24 23 22 21 20 2-1 2-2 2-3 2-4 .....

2-23

Real No = +1,5 * 2 126-127 = 0,75


SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.3

Information and Training Center
Knowledge for Automation


Nạp và truyền dữ liệu (1)
LAD

FBD

MOVE

5

MOVE

EN

ENO

IN


OUT

Examples
of Load

SIMATIC S7
Siemens AG 1999. All rights reserved.

STL

EN

MB5

5

OUT

IN

MB5

L

+5

T

MB5


ENO

L +5

//

16-bit constant (Integer)

L L#523123

//

32-bit constant (Double
Integer)

L B#16#EF

//

byte in hexadecimal form.

L 2#0010 0110 1110 0011

//

16-bit binary value

L 3.14

//


32-bit constant (Real)

Date:
File:

29.10.15
PRO1_07E.4

Information and Training Center
Knowledge for Automation


Nạp và truyền dữ liệu (2)
Content of
ACCU1

Programm

:
:
L W#16#CAFE

L W#16#AFFE
:
:
:

SIMATIC S7
Siemens AG 1999. All rights reserved.


Content of
ACCU2

X

X

X

X

X

X

X

X

Y

Y

Y

Y

Y


Y

Y

Y

0

0

0

0

C
0

A
0

F
0

E
0

X

X


X

X

X

X

X

X

0

0

0

0

A
0

F
0

F
0

E

0

0

0

0

0

C

A

F

E

Date:
File:

29.10.15
PRO1_07E.5

Information and Training Center
Knowledge for Automation


Nạp vào truyền dữ liệu (3)
Contents of ACCU1

Program

L MB 0

31

23

L MW 0

23

15

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31

L MD 0

7

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31

Load

15

23


MB0

MB0
7

MB0
15

MB1

0

0

MB1
7

MB2

0

MB3

T QD 4
QD 4

Transfer

T QW 4
QW 4


T QB 4
QB 4

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.6

Information and Training Center
Knowledge for Automation


Timers: Định thời gian cho S5 trong STEP 7
102

Format for time specifications

X

X

X

Time value (BCD code)


X

X

Time base

ACCU contents after “L T...”

X

100

X

Time base

Timer cell in system data memory

101

X

X

X

Time value (Binary number)

X


X

Time value (Binary number)
102

ACCU contents after “LC T...”

X

SIMATIC S7

100

X

Time base

Siemens AG 1999. All rights reserved.

101

Date:
File:

29.10.15
PRO1_07E.7

Time value (BCD code)

Information and Training Center

Knowledge for Automation


Timers: Đóng chậm (ON Delay SD)

I0.7
S5T#35s
I0.5

LAD

FBD

T4
S_ODT

T4
S_ODT

S

Q

TV

BI

R

BCD


Q8.5
MW0

I0.7
S5T#35s

QW12

I0.5

Data type
“S5TIME”

0,01s <-0,1s <-1s <-10s <--

MW0

S

BI

TV

BCD

R

Q


RLO at S
RLO at R

Example

STL

Timer
operation

QW12
Q8.5
=

A
L
SD
A
R
L
T
LC
T
A
=

I0.7
S5T#35s
T4
I0.5

T4
T4
MW0
T4
QW12
T4
Q8.5

Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.8

0
0
1
1

0
1
0
1

Time value: 0 . . . 999


Information and Training Center
Knowledge for Automation


Timers: Đóng chậm có nhớ (Stored ON Delay SS)

I0.7
S5T#35s
I0.5

LAD

FBD

T4
S_ODTS
Q
S

T4
S_ODTS

TV
R

BI
BCD

Q8.5

MW0

I0.7
S5T#35s

QW12

I0.5

STL

S

BI

TV

BCD

R

Q

MW0
QW12
Q8.5
=

A
L

SS
A
R
L
T
LC
T
A
=

I0.7
S5T#35s
T4
I0.5
T4
T4
MW0
T4
QW12
T4
Q8.5

RLO at S
RLO at R

Example

Timer
operation
Q


SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.9

Information and Training Center
Knowledge for Automation


Timers: Mở mạch chậm (OFF Delay SF)

I0.7
S5T#35s
I0.5

LAD

FBD

T4
S_OFFDT
Q
S

T4

S_OFFDT

TV
R

BI
BCD

Q8.5
MW0

I0.7
S5T#35s

QW12

STL

S

BI

TV

BCD

R

Q


I0.5

MW0
QW12
Q8.5
=

A
L
SF
A
R
L
T
LC
T
A
=

I0.7
S5T#35s
T4
I0.5
T4
T4
MW0
T4
QW12
T4
Q8.5


RLO at S
RLO at R
Thời gian
Chạy

Ví dụ
Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.10

Information and Training Center
Knowledge for Automation


Timers: Tạo xung (Pulse SP)
LAD

FBD

T4
S_PULSE
Q

S

I0.7
S5T#35s
I0.5

TV
R

BI
BCD

T4
S_PULSE

Q8.5
MW0

STL

I0.7
S5T#35s

QW12

I0.5

S

BI


TV

BCD

R

Q

MW0
QW12
Q8.5
=

A
L
SP
A
R
L
T
LC
T
A
=

I0.7
S5T#35s
T4
I0.5

T4
T4
MW0
T4
QW12
T4
Q8.5

RLO at S
RLO at R

Ví dụ

Timer
operation
Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.11

Information and Training Center
Knowledge for Automation



Timers: Tạo xung có nhớ (Extended Pulse SE)

I0.7
S5T#35s
I0.5

LAD

FBD

T4
S_PEXT
Q
S

T4
S_PEXT

TV
R

BI
BCD

Q8.5
MW0

I0.7
S5T#35s


QW12

I0.5

STL

S

BI

TV

BCD

R

Q

MW0
QW12
A8.5
=

A
L
SE
A
R
L
T

LC
T
A
=

I0.7
S5T#35s
T4
I0.5
T4
T4
MW0
T4
QW12
T4
Q8.5

RLO at S
RLO at R

Example

Timer
Operation
Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:

File:

29.10.15
PRO1_07E.12

Information and Training Center
Knowledge for Automation


Timers: theo lệnh Bit
LAD

FBD

STL

Network 1:

I0.0

T4
T4

&

I0.0

SD

SD

S5T#5s

S5T#5s

TV

A I0.0
L S5T#5s
SD T4

Network 2:

T4

Q 8.0

Q 8.0
T4

&

=

A
=

T4
Q 8.0

A

R

I0.1
T4

Network 3:

I0.1

T4

T4
I0.1

R

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.13

&

R

Information and Training Center

Knowledge for Automation


Bài tập

T4
S_PULSE

I 0.7
S5T#5s
I 0.5

S
TV
R

BI
BCD
Q

I 0.7
I 0.5
Q 8.0

5s

T4
S_PEXT

I 0.7

S5T#5s
I 0.5

S
TV
R

BI
BCD
Q

I 0.7
I 0.5
Q 8.0

T4
S_ODT

I 0.7
S5T#5s
I 0.5

S
TV
R

BI
BCD
Q


S
TV
R

BI
BCD
Q

I 0.5
Q 8.0

S
TV
R

BI
BCD
Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

Q8.0
I 0.7
I 0.5

Q 8.0

T4
S_OFFDT


I 0.7
S5T#5s
I 0.5

Q8.0
I 0.7

T4
S_ODTS

I 0.7
S5T#5s
I 0.5

Q8.0

Q8.0
I 0.7
I 0.5

Q 8.0

Q8.0
Date:
File:

29.10.15
PRO1_07E.14


Information and Training Center
Knowledge for Automation


Bộ đếm S5 trong STEP 7
LAD

FBD

C5

C5

S_CUD

I 0.4
CU

S_CUD

Q 8.3
Q
Q

STL

I 0.4

CU


CD

I 0.5

CD

S

I 0.3

S

C#20

PV

I 0.5
I 0.3

C#20

PV

CV

MW 4

CV
CV_BCD


MW 4
QW 12
Q 8.3

I 0.7
R

SIMATIC S7
Siemens AG 1999. All rights reserved.

CV_BCD

QW 12

I 0.7

Date:
File:

R

29.10.15
PRO1_07E.15

Q
Q

=

A

CU
A
CD
A
L
S
A
R
L
T
LC
T
A
=

I0.4
C5
I0.5
C5
I0.3
C#20
C5
I0.7
C5
C5
MW4
C5
QW12
C5
Q8.3


Information and Training Center
Knowledge for Automation


Counters: Câu lệnh bit
LAD

FBD

Network 1:

I0.0

STL

C5
I0.0

C5
SC

C#20

C#20

SC
CV

A

L
S

I0.0
C#20
C5

Network 2:

I0.1

C5

C5
I0.1

CU

CU

A I0.1
CU C5

C5

A I0.2
CD C5

Network 3:


I0.2

C5
CD

I0.2

CD

Network 4:

C5

Q 4.0

Q 4.0
C5

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.16

=

A

=

C5
Q 4.0
Information and Training Center
Knowledge for Automation


Counters: Biểu đồ chức năng
CU

CD

S

R

5
4

Count

3
2
1
0

Q

SIMATIC S7

Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.17

Information and Training Center
Knowledge for Automation


Bài tập: Chương trình cho hệ thống làm đầy chai
(Chu kỳ làm đầy và đếm chai)

Plant ON/OFF:
I 0.0 = Start (NO contact, mom-cont. switch)

Main
container

I 0.1 = Stop (NC contact)
Manual/Automatic mode:
I 0.4 = Manual /Automatic
I 0.5 = Adopt mode
I 0.2 = Jog forwards
I 0.3 = Jog backwards
Bottle
sensor
I 16.6 (I 8.6)


Bottle sensor
I 16.5 (I 8.5)

Q 9.0 (Q 5.0)
Filling funnel

Bottle sensor
I 16.7 (I 8.7)

M
Q 20.5 (Q 8.5) Conveyor forwards
Q 20.6 (Q 8.6) Conveyor backwards

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.18

Information and Training Center
Knowledge for Automation


Phép toán chuyển đổi BCD <-> Integer
Số BCD được
nhập vào


0 81 5

Số được hiển
thị dạng BCD

0 2 4 8

Chuyển đổi
BCD->Integer

Nhiệm vụ
Chuyển đổi
BCD<-Integer

LAD

FBD

BCD_I

IW4

EN

ENO

IN

OUT


IN

SIMATIC S7
Siemens AG 1999. All rights reserved.

OUT

STL

MW20

L
IW4
BTI
T
MW20

QW12

L
MW10
ITB
T
QW12

BCD_I

MW20


IW4

I_BCD
EN
ENO
MW10

Sử dụng chương
Trình với thuật toán
số nguyên

EN

OUT

IN

ENO
I_BCD

QW12

MW10

Date:
File:

EN

OUT


IN

ENO

29.10.15
PRO1_07E.19

Information and Training Center
Knowledge for Automation


Phép toán chuyển đổi I -> DI -> REAL
Dữ liệu ở dạng số nguyên(16 bits)

Chuyển đổi số
nguyên 16 bit
sang số nguyên
32 bit

Nhiệm vụ

F
B
D

Chương trình
Tính toán
với số thực


Chuyển đổi số
nguyên 32 bit
sang số thực

AWL

I_DI

MW12

EN

OUT

IN

ENO

LAD

MD14

MD14

I_DI
EN
ENO
MW12

SIMATIC S7

Siemens AG 1999. All rights reserved.

IN

OUT

DI_R
EN

OUT

IN

ENO

MD26

L
MW12
ITD
DTR
T
MD26

DI_R
EN
ENO
MD14

MD14


Date:
File:

IN

29.10.15
PRO1_07E.20

OUT

MD26

Information and Training Center
Knowledge for Automation


Phép toán so sánh
LAD

M0.0

IW0
IW2

CMP ==I

IN1
IN2


FBD

STL

CMP ==I

Q 9.7

IW0

IN1

IW2

IN2
&

M0.0

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.21

Q9.7
=


A
A(
L
L
==I
)
=

M0.0
IW0
IW2
Q9.7

Information and Training Center
Knowledge for Automation


Các phép toán logic
WXOR_W
WOR_W
WAND_W
EN
IW0
W#16#5F2A

L

IW 0


L

W#16#5F2A

AW / OW / XOW

ENO

T

MW10

IN1
IN2

OUT

15

MW10
IW0 =
W#16#5F2A =

0

0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0
0 1 0 1 1 1 1 1 0 0 1 0 1 0 1 0

AND


SIMATIC S7
Siemens AG 1999. All rights reserved.

OR

XOR

MW10 after “AW”

0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0

MW10 after “OW”

0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 0

MW10 nach “XOW”

0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 0

Date:
File:

29.10.15
PRO1_07E.22

Information and Training Center
Knowledge for Automation


Những chức năng toán học cơ bản

LAD

Addition

MW4
MW10

Subtraction

MW5
MW11

Multiplication

MD6
MD12

Division

MD40
MD4

SIMATIC S7
Siemens AG 1999. All rights reserved.

ADD_I
EN ENO
IN1
IN2 OUT
SUB_I

EN ENO
IN1
IN2 OUT
MUL_R
EN ENO
IN1
IN2
DIV_R
EN ENO
IN1
IN2 OUT

FBD

MW4
MW6

MW10

MW5
MW7

MW11

ADD_I
EN OUT
IN1
IN2 ENO
SUB_I
EN OUT

IN1
IN2 ENO
MUL_R
EN OUT

MD6
MD66

MD12

MD40
MD32

Date:
File:

MD4

29.10.15
PRO1_07E.23

IN1
IN2

STL

MW6

MW7


MD66

ENO

DIV_R
EN OUT
IN1
IN2 ENO

MD32

L
L
+I
T

MW4
MW10

L
L
-I
T

MW5
MW11

L
L
*R

T

MD6
MD12

L
L
/R
T

MD40
MD4

MW6

MW7

MD66

MD32

Information and Training Center
Knowledge for Automation


Bài tập: Chương trình cho hệ thống làm đầy chai
(dữ liệu sản xuất)

SIMATIC S7
Siemens AG 1999. All rights reserved.


Chai rỗng

MW 100

Chai đầy

MW 102

Số chai hỏng

MW 104

Date:
File:

29.10.15
PRO1_07E.24

Information and Training Center
Knowledge for Automation


Bài tập : Lập trình cho hệ thống làm đầy chai
(Số thùng)

(QW 6)

Chương trình nhập dạng LAD


Chuyển đổi chương trình sang STL

Chương trình nhập dạng STL

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
PRO1_07E.25

Information and Training Center
Knowledge for Automation


×