Professional Documents
Culture Documents
PC Access and VB6 - DMT2
PC Access and VB6 - DMT2
PC Access and VB6 - DMT2
• OPC Item - một tag hay một biến dữ liệu được quản lý
bởi OPC Server - tức là một biến dữ liệu trong một PLC
VB hỗ trợ COM.
Tổ chức OPC hỗ trợ source code cho “Automation Wrapper”
DLL, các công ty cung cấp bản compiled.
Automation Wrapper kết nối VB đến OPC.
Add Remove
Group(s) Group(s)
Chương trình của chúng ta có thể
thêm/bới group, item ngay trong
lúc hoạt động, tùy vào thiết lập thế
Add Item(s) nào. Remove Item(s)
to Group(s) from Group(s)
Activate De-Activate
Groups & Items Groups & Items
Sample VB
từ KePware
kết nối S7-
200Server.
Sample VB
từ PC-Access
kết nối
KePServer.
Xây dựng ứng dụng
giao tiếp PC - PLC
với Visual Basic – PC Access và OPC
từ Siemens
Bước 1 – Thêm Reference
KePware
quick client
run.
KePServer
has 2 client
connect.
Bước 2 – Khai báo biến
Option Explicit
Option Base 1 ‘Makes all arrays start with an
index of 1 Khởi tạo đối tượng
OPCServer và
Dim MyOPCServer As OPCServer OPCGroup, những
Dim WithEvents newOPCServer As OPCServer
đối tượng này xem
Dim MyGroups As OPCGroups
Dim WithEvents MyGroup As OPCGroup như được định danh
với OPCServer cho
một phiên làm việc
mà client kết nối đến.
• Add/remove Item
' Add Items to the Group
Call MyItems.AddItems(2, ItemIDs, ItemClientHandles, MyItemServerHandles, Errors)
Thanks for
Attention