AnsweredAssumed Answered

vrf Want example how to connect VEE to OPC server

Question asked by VRFuser on May 13, 2003
Bill -

> Does anyone out there know
> how to connect VEE to an OPC
> server?

Set server = CreateObject("OPCServer");

> If so could you share an
> example how to set up?

Now *there's* a loaded question

Seriously though - I'm sorry! I'm not familiar at all with this technology.
I just now looked it up, and I found that OPC means "OLE for Process
Control." It sounds like a great idea. The server is a COM+ data
"publisher/subscriber". The example I downloaded from NI, VBOPCAPI.ZIP from

looks pretty straightforward. You connect to a server, add a group, set the
group's update rate and mark it as subscribed. Then you setup string arrays
for read and write items (which I imagine one would have set to things like
motors and switches in a process control scenario) and call the Validate
method of the OPCItems property of the group passing the number of items,
the item array, and an array of int32 for error return. The length of the
return is unspecified, but in VEE probably 1 error per item would be

Provided there are no errors, you then call the AddItems method of the
group's OPCItems property with the number of items, an int32 array of who's
purpose I'm not sure, an int32 array for returned handles and the error

This Validate/AddItem deal must be done once for read items and once for
write items. I suppose a read item is incoming status data and a write item
is outgoing control data. In the case of write items, you set a global
OPCItem var for each write item added.

Then, you just wait for DataChange events from the group object (to receive)
and use the group object's Write method to change write items.

Man, this is simple! No more PITA SCADA. Bill, thanks for prompting me to
look this up.

You are currently subscribed to vrf as:
To subscribe send a blank email to "".
To unsubscribe send a blank email to "".
To send messages to this mailing list,  email "". 
If you need help with the mailing list send a message to "".