Sự khác biệt giữa Data Block và Instance Data Block trong SIMATIC Step7

Ngày đăng: 08:37:06 10-10-2014

Chắc chắn nhiều bạn sẽ nhức đầu với các khái niệm này, xin chia sẻ 1 vài kinh nghiệm.

Tóm tắt ngắn gọn như sau:

Organization Block (OB) : chương trình chính, chương trình đặc biệt chạy 1 lần, chương trình ngắt...

Function (FC): chương trình con.

Function Block (FB) : chương trình con có IDB riêng.

Shared Data Block (DB) : khối dữ liệu có thể được truy cập thay đổi bới OB, FC, FB. Mất điện mất dữ liệu.

Instance Data Block (IDB) :khối dữ liệu được khai báo riêng cho một FB riêng biệt. Dữ liệu trong IDB chỉ có thể được khai báo, truy cập thay đổi bởi FB riêng biệt. Mất điện dữ liệu ???

Data Type (UDT) : chưa rõ

Variable Table : khai báo địa chỉ biến , online rồi thay đổi giá trị của các biến. Dùng để cân chỉnh giá trị các biến.

---------------------------------------------------------------------------------------------------------------------------------------------------------------

Difference between global data blocks and instance data blocks

In the case of a global DB all the blocks (FBs, FCs and OBs) can read and write the data contained in the data block. The instance DB is assigned to a specific function block and contains local data for that assigned FB.

 

Table 1

Note

The STEP 7 program has equal read and write access to the global and instance DBs in the CPU.

Fig. 01

The data for different FBs can also be stored in one single instance DB (multi-instance). Fig. 02 shows an example of how the two function blocks FB5 and FB6 are called as multi-instances in FB1. The two FBs called deposit their data in the instance data block DB1 of the calling block FB1. In the declaration of FB1, the multi-instance block calls are stored as static variables.

Fig. 02

More information is available in the STEP 7 Online Help under