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

lập trình cho s7 300

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 (714.39 KB, 27 trang )

Chửực naờng vaứ caực khoỏi chửực naờng

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.1

Information and Training Center
Knowledge for Automation


Giới thiệu

Biến / dữ liệu toàn cục
(có hiệu lực toàn chương trình)

• PII / PIQ
• I/ O
•M/T/C
• các vùng DB

Biến / dữ liệu cục bộ
(có hiệu lực trong một khối)
Biến tạm thời

Biến cố đònh


• bò xoá sau khi khối

• vẫn còn sau khi khối

được gọi

được gọi

• lưu trữ tạm thời ơ ûngăn xếp L

• lưu trữ cố đònh trong DB

• dùng trong OB / FC / FB

• chỉ dùng trong FB

Tuyệt đối

Ký hiệu
Truy xuất

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.2


Information and Training Center
Knowledge for Automation


Bieán taïm thôøi

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.3

Information and Training Center
Knowledge for Automation


Kích thước ngăn xếp dữ liệu cục bộ
Độ lớn:
Độ lớn:

1.5
1.5Kbyte
Kbyte

(CPU 313..316)
(CPU 313..316)
với S7-300:


Điều hành

Cấp ưu tiên

Khởi động (thi hành một lần)

27

Thi hành theo chu kỳ

1

Điều khiển thời gian

Điều hành

SIMATIC S7
Siemens AG 1999. All rights reserved.

kích thướùc
ngăn xếp L

256 bytes

Ngắt thời gian ngày

2

256 bytes


Ngắt thời gian trì hoãn

3

256 bytes

Ngắt theo chu kỳ

12

256 bytes

Ngắt phần cứng

16

256 bytes

Xử lý lỗi trong khởi động

28

Xử lý lỗi trong chu kỳ quét

26

Date:
File:


29.10.15
STOE_03VN.4

256 bytes

Information and Training Center
Knowledge for Automation


Số byte một khối cần trong ngăn xếp dữ liệu cục bộ

rechts

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.5

Information and Training Center
Knowledge for Automation


Hoạt động của ngăn xếp dữ liệu cục bộ
Hệ thống
làm việc
1


FC 1

biến
tạm thời

2

7

Bước

1

2

Diễn biến
trong ngăn
xếp L

3
4

FC 2

biến
tạm thời

5


FC 3

6

biến
tạm thời

3

4

FC2
OB1

SIMATIC S7
Siemens AG 1999. All rights reserved.

5

6

7

256 Bytes

OB 1

FC3

FC1


FC1

FC1

FC1

FC1

OB1

OB1

OB1

OB1

OB1

Date:
File:

29.10.15
STOE_03VN.6

OB1

Information and Training Center
Knowledge for Automation



Bài tập: sử dụng biến tạm thời

Thay bằng biến tạm thời
“số thùng"

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.7

Information and Training Center
Knowledge for Automation


Ví dụ về hiển thò thông báo lỗi trong quá trình xử lý
Sự việc

lỗi
Nhận biết
Tình trạng
bộ nhớ
LED
Đề nghò cách
giải quyết


Tình trạng bộ nhớ
Edge Mem. Bit
Ngõ vào lỗi

RS

Acknowl.

R

P

S

Q

&

>=1

Tần số chớp.
Tình trạng
bộ nhớ
Ngõ vào lỗi

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:


29.10.15
STOE_03VN.8

&

Hiển thò
=

Information and Training Center
Knowledge for Automation


khối có thể cài đặt thông số
Khối không thể
cài đặt thông số

Khối có thể cài đặt thông số
Chương trình

gọi
FC 20

A I

1.2

A #Acknowledge

R M


40.0

R #Report Memory

A I

1.3

FP M

I 1.3

Ngõ vào lỗi

U #Disturb. input

I 1.2

Nhận biết

40.1

FP #Edge mem. bit

M 10.3

Tần số chớp.

S M


40.0

S #Report memory

M 40.0

Tình trạng bộ nhớ

A M

40.0

A #Report memory

A M

10.3

A #Flashing freq.

O

Edge
mem.bit
Hiển thò

M 40.1
A 8.3


O

ANM

40.0

AN #Reportmemory

A I

1.3

A #Disturb. input

=

8.3

=

Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

thông số hình thức
Thông số thực

#Display


Date:
File:

29.10.15
STOE_03VN.9

Information and Training Center
Knowledge for Automation


Khai báo tham số hình thức
Các thông số hình thức
Dạng thông số
thông số Input
thông số Output
thông số In/out

khai báo
in
out
In_out

Sử dụng
Chỉ đọc
Chỉ ghi
Đọc/ ghi

hiển thò
Bên trái khối
Bên phải khối

Bên trái khối

Bảng khai báo khối FC 20

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.10

Information and Training Center
Knowledge for Automation


Soạn thảo một khối có thể cài đặt thông số

Ví dụ: trước đó chỗ này là một khối không thể
cài đặt thông số FC:
• đòa chỉ tuyệt đối :
I1.3
• đòa chỉ ký hiệu :
“phía dưới bên trái"

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:

File:

29.10.15
STOE_03VN.11

Information and Training Center
Knowledge for Automation


Gọi khối có thể cài đặt thông số
Network 3: First Call
....

Tuyệt đối

“End left"
“Acknow.button"

Đòa chỉ

EN
Disturb.input

FC20
Edge mem. bit

Acknowledge

M10.3


Flash freq.

M40.0

Report memory

Display

M40.1
“Position
error"

ENO

Network 4: Second Call
A8.1

Ký hiệu

“End right"
“Acknow.button"

Bảng ký
hiệu
Ký hiệu toàn cục

SIMATIC S7
Siemens AG 1999. All rights reserved.

Ký hiệu


EN
Disturb.input
Acknowledge

M10.3

Flash freq.

M40.2

Report memory

FC20
Edge mem. bit
Display

M40.3
Q9.4

ENO

Ký hiệu cục bộ -->thông số hình thức

Date:
File:

29.10.15
STOE_03VN.12


Information and Training Center
Knowledge for Automation


Sử dụng EN / ENO cho khối được gọi
LAD/FBD

STL

FC 1
Gọi không điều kiện

Gọi có điều kiện

?? . ?

EN

ENO

Q 9.0

FC 1
EN
ENO

I 0.1

=
_001:


Ví dụ

FC 1
?? . ?

SIMATIC S7
Siemens AG 1999. All rights reserved.

EN

FC 2

ENO

EN

Date:
File:

ENO

29.10.15
STOE_03VN.13

CALL
FC
NOP 0

1


A
JNB
CALL
A
=

0.1

I
_001
FC
BR
Q

1
9.0

FC 3
EN

ENO

=

Information and Training Center
Knowledge for Automation


Bài tập: tạo một khối có thể cài đặt thông số FC

1.

Bảng khai báo của khối FC 20

Khối không thể A I
cài đặt thông số R M
A I
FP M
S M
A M
A M
O
AN M
A I
= Q

SIMATIC S7
Siemens AG 1999. All rights reserved.

Khối có thể cài đặt A #Acknowledge
thông số FC 20
R #Report memory
A #Disturb. ...
2.
:
:
:
:
:
:

:
:

1.2
40.0
1.3
40.1
40.0
40.0
10.3
40.0
1.3
9.3(Q5.3)

Date:
File:

29.10.15
STOE_03VN.14

Information and Training Center
Knowledge for Automation


Bài tập: gọi một khối có thể cài đặt thông số FC
FC 20
I 1.3
Cài đặt thông số của
FC 20 ở lần gọi thứ nhất


Disturb. input

Edge mem. bit
Display
Acknowledge

I 1.2
M 10.3

M 40.1
Q 9.3 (Q 5.3)

Flash freq.
Report memory

M 40.0

FC 20
I 1.4
Cài đặt thông số của
FC 20 ở lần gọi thứ hai

Disturb. input

Edge mem. bit
Display
Acknowledge

I 1.2
M 10.3


SIMATIC S7

Q 9.4 (Q 5.4)

Flash freq.
Report memory

M 40.2

Siemens AG 1999. All rights reserved.

M 40.3

Date:
File:

29.10.15
STOE_03VN.15

Information and Training Center
Knowledge for Automation


khối chức năng (FB)
OB 1
DB 2
FB 2
EN
Disturb. input

Acknowledge

Display

Flash freq.

ENO
Bảng khai báo của khối chức năng

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.16

Information and Training Center
Knowledge for Automation


Hiển thò thông báo ở khối chức năng

Bảng khai báo
của khối chức năng

Khối dữ liệu
tức thời


SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.17

Information and Training Center
Knowledge for Automation


Tạo khối dữ liệu
1. Tạo DB bằng gọi FB

SIMATIC S7
Siemens AG 1999. All rights reserved.

2. Tạo một DB mới

Date:
File:

29.10.15
STOE_03VN.18

Information and Training Center
Knowledge for Automation



Khối DB hợp
Kiểu DB đơn lẻ
OB 1
Call FB20, DB10
Disturb._Input:=
Acknowledge:=
Flash_Freq:=
Display:=
Call FB20, DB11
Disturb._Input:=
Acknowledge:=
Flash_Freq:=
Display:=

Call FB20, DB12
Disturb._Input:=
Acknowledge:=
Flash_Freq:=
Display:=

SIMATIC S7
Siemens AG 1999. All rights reserved.

Kiểu DB hợp
DB10

OB 1
Call FB100, DB100


FB20

FB 100

DB11

stat

Dist_1

FB20

stat

Dist_2

FB20

Call Dist_1
Disturb._Input:=
Acknowledge:=
Flash_Freq:=
Display:=

FB20

DB12

Call Dist_2
Disturb._Input:=

Acknowledge:=
Flash_Freq:=
Display:=

FB20

Date:
File:

29.10.15
STOE_03VN.19

DB100
Các thông số và
biến cố đònh trong
lần đầu gọi FB20

Các thông số và
biến cố đònh trong
lần thứ hai gọi FB20

Information and Training Center
Knowledge for Automation


Cheøn/ xoùa tham soá khoái

löu

SIMATIC S7

Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.20

Information and Training Center
Knowledge for Automation


Chỉnh sửa khối sau khi gọi
Khi khối được gọi đã mở :

Nhắp phím phải chuột

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.21

Information and Training Center
Knowledge for Automation



Bài tập : soạn thảo một khối chức năng
1.

2.

Bảng khai báo của khối FB 20

một phần chương trình
của FB 20

SIMATIC S7
Siemens AG 1999. All rights reserved.

A #Acknowledge
R #Report memory
A #Disturb. ...
:
:

Date:
File:

29.10.15
STOE_03VN.22

Information and Training Center
Knowledge for Automation


Bài tập : gọi và thử một khối chức năng


(Q 5.3)

(Q 5.3)

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.23

Information and Training Center
Knowledge for Automation


Chuyeồn moọt FC thaứnh moọt FB duứng chửụng trỡnh nguon (1)

SIMATIC S7
Siemens AG 1999. All rights reserved.

Date:
File:

29.10.15
STOE_03VN.24

Information and Training Center

Knowledge for Automation


Chuyeồn moọt FC thaứnh moọt FB duứng chửụng trỡnh nguon (2)

:
:

SIMATIC S7
Siemens AG 1999. All rights reserved.

:
:

Date:
File:

29.10.15
STOE_03VN.25

Information and Training Center
Knowledge for Automation


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×