-
VB
上位组态与
ABPLC
通过
RSlinx
之间通信
p>
OPC
是一个工业标准,它是由一些世界上著名的自动化系统和硬件
、软件公司和
Microsoft(
微软
)
紧密合作而建立的。
O
代表
OLE(
对象链接和嵌入
)
< br>,
P (process
过程
)
,
C (control
控制
)
。
OLE
已从面向对
象重新定义为基于对象并更名为
Active X
。
OPC
的使用是作为一个
DCOM
在使用,所以
OPC
客户端可以网络上任一计算机运行
,但你必须配置
DCOM
的访
问权限,
如果你不想费神,
把服务器与客户端都用相同的用户名与密码登
录就成了。
如果想
配置
DCOM
,请参看
DCOM
的配置。
< br>RSlinx
集成的
OPC(OLE for
process control)
服务器使
得过程数据可由其
它应用程序
(OPC
客户机
)
访问。在安装
RSlinx
时提供了
OPC
的客户端控
件
:
Rockwell
Software
OPC
Automation(C:Program
FilesCommon
)
本例就是
用
VB
通过对这个控件进行操作,
来实
现对
RSLogix
5000
内存标签的读写访问。
第一部分:
PLC
< br>部分的设置
1
,
RSlogix Emulate 5000
在第二槽中添加
Emulate 5000
的仿真
CPU
。
2
,
RSLogix 5000
程序的建立
a
:
I/O
配置
b
.程序编写
3
,
RSlinx
的设置
在
rslinx
中建立
OP
C
服务器,名字为“
qin
”
,如图所示。
4:
OP
C
的结构
第二部分
VB
的设置
1
,
OPC
与
VB
的连接方式
2
,在
VB
中引用
OPC Automation
3,OPC
的连接,定义全局变量
4
,连接
O
PCSERVER
和
OPC GROUPS
Private Sub OPCServerConnect()
Dim ConnectedServerName As String
Dim ConnectedNodeName As Variant
Dim opcserverName As String
Dim OPCNodename As String
opcserverName =
OPCNodename
=
' Test to see if the User
has entered or selected an OPC server name yet if
not post a
message
If
InStr(opcserverName,
'Set error
handling for OPC Function
'Create a new
OPC Server object
Set
ConnectedOPCServer = New OPCServer
'Load the selected server name to start
the interface
ConnectedServerName =
opcserverName
'Load the node name of the
connected server. The node name should be entered
'without the use of forward slashes .
ConnectedNodeName = OPCNodename
'Attempt to connect with the server
t ConnectedServerName,
ConnectedNodeName
'
Throughout this example you will see a lot of code
that simply enables
' and disables
the various controls on the form.
The purpose of these
'
actions is to demonstrate and insure the proper
sequence of events when
' making an OPC
connection.
' If we successfully
connect to a server allow the user to disconnect
p>
'****************************************
*******************
'**************
*********************************************
'Prepare to add a group to the current
OPC Server
-
-
-
-
-
-
-
-
-
上一篇:电脑开机蓝屏解决步骤
下一篇:Android 所有权限