FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

OPC and VisualC

I'm trying to use OPC Server to communicate with several FP 1001 modules. Is it possible to write a OPC client in VC without any additional NI Software (ComponentWorks, LookOut...)? Exists any documentation / samples?
I've read the article: "How can I create an application in MSVC 6.0 to access my FieldPoint modules with CVI 5.0 libraries?" from last year. But maybe something has changed.

tia Rolf Behrens
0 Kudos
Message 1 of 5
(3,765 Views)
Rolf,

It is very possible to write your own OPC Client in Visual C using COM. The OPC Foundation, http://www.opcfoundation.org/ , provides the specifications for OPC and does have some source libraries that can be built into your code. Alternatively, an easier solution is to purchase a plug-in OPC client for Visual C so you are not having to re-invent the wheel so to speak. National Instruments DataSockets can act as an OPC client (take a look at App Note 139 for examples, the examples are Visual Basic oriented, but it is much the same in Visual C with different syntax). Other companies also offer add-ins. I believe that Matrikon offers a Visual C plug-in.

Regards,
Aaron
0 Kudos
Message 2 of 5
(3,766 Views)
Thanks Aaron,

I've downloaded the NI measurement studio evaluation yesterday. Maybe it's a solution for our application but we have to configure the FP components dynamically (e.g. channel configuration). Therfore we have to enumerate the OPC Items programmatically. The only way to enumerate the OPC-Server Items with DataSockects is SelectURL, but this invokes the user-interface. Is there any sourcecode available for a function like SelectURL?

tia
Rolf Behrens
0 Kudos
Message 3 of 5
(3,765 Views)
Rolf,

Personally, I do not use Measurement Studio/DataSockets all that often, so I do not know about availability of sourcecode for SelectURL, you may want to ask about that in the Measurement Studio Discussion Group.

I am not quite sure why you would need to be able to get at the source code though. The URL's for FieldPoint OPC items are very consistent, very predictable and do not change dynamically. Since you are able to very easily know what the full name/URL is, it is not all that difficult to define constants that are used by the DataSocket functions, they do not have to be dynamically created each time. The most common use case I have seen for this sort of application is for developers who deploy multiple different systems to create
a small application that uses the browsing functions, which then saves the various URL's into a file that is included with a specific application.

Also, please keep in mind that Attributes of channels and Channel Commands are dynamically changeable via the OPC Server but ranges are not. The reason that ranges are not currently dynamically configurable is that depending upon which FieldPoint network module is used, either the network module or the FieldPoint server has to do the scaling. Thus, sending a command through the server that changes the range can cause the scaling to be incorrect.

Let me know if you need more information on Ranges, Attributes and Commands.

Regards,
Aaron
0 Kudos
Message 4 of 5
(3,765 Views)

Hi,

It is possible to write your own OPC client in VC++ using COM although it is quite a big job to do it from scratch (I know as I did it myself). There are quite a few free code samples on the OPC Foundation web site which will help you.

If you value your time, you might want to consider buying in libraries to save on blood, sweat and tears. Softing is one such provider although they are a bit expensive.

 

Good luck

 

Tony

0 Kudos
Message 5 of 5
(3,441 Views)