LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication with PC-Access OPC Server

Dear All,
 
Please be forgiving for this is my first Active-X project...: I am running CVI 7 and would like to read (and possibly write) data from/to a Siemens S7-200 PLC. To simplify life, I have just purchased PC Access (Siemens) which is an OPC server for this PLC. I have set it up and it works nicely, that is I can read the status of my PLC via the serial port and display it in PC Access. But now comes the active part, I want to read the status from within my C program: I tried to run the CVI Active-X controller wizard and generated a function panel for the S7-200, but I have not the slighest idea how to proceed further... I have studied some ActiveX demos from NI, ie. the IE control, but: I do not know which of the many fp-functions to use to read a certain data value etc. Browsing this forum I have seen that there seem to be some programmers out there that have been dealing successfully with such a problem, so may be someone could give me some kind advice of how to tackle this problem 🙂
 
Many thanks,
Wolfgang
0 Kudos
Message 1 of 9
(6,338 Views)
Hi Wolfgang

1) See http://www.ni.com/opc/opcservers.htm
2) In fact, you just need to use DataSocket functions/bindings to access your Siemens OPC Server.

Regards,
0 Kudos
Message 2 of 9
(6,327 Views)
Thank you!
 
I have two difficulties with your suggestion: The page you mention does not list the S7-200. And second, as I understand it, I would need to purchase yet another software package? In my understanding, using CVI 7.0 I should be able to control any OPC server that is running on my computer using the corresponding wizard... without buying additional software?
0 Kudos
Message 3 of 9
(6,324 Views)
Wolfgang,

1) I did try the datasocket binding of controls with Eurotherm 2700 Controllers (which are not in the list either). It is really basic: you enable the datasocket binding of the control in the iur, browse your OPC server item (choose read or write) and that's it. It seems to me that datasocket is compliant with any OPC server.
2) To me, you don't need to buy any package as long as you do OPC CLIENTS with CVI. You have your datasocket functions and you don't need anything more, i.e.
"LabVIEW, LabWindows/CVI, Measurement Studio
These National Instruments software packages feature an OPC client. Use DataSocket functions to read and write to these OPC data items." int the NI page.
Message 4 of 9
(6,321 Views)

Again, many thanks! I will have a closer look into the DataSocket approach. According to your email, it seems to be very simple. Still, I wanted to ask about this CVI capability of building an Active-X client control... there are examples for IE, Word, Excel etc. but I could not translate these samples to my case: I did arrive at this self-built function panel which unfortunately consists of so many functions that I am confused which one I have to use. Probably something very simple, but because so far I have never used this client server schema I am somewhat lost...And unfortunately I could not find some detailed beginners guide for these things.

0 Kudos
Message 5 of 9
(6,315 Views)
To use ActiveX controls:
1) You have to make sure that the ActiveX component is provided with your PAC... and is documented.
2) If yes, you can use the  CVI wizard for Active X. Generate a instrument. No problem. Will create for you all the stuff needed to access the control... if this stuff exits in the control (i.e. if Siemens made it open to 3rd party softwares).
3) If you're lucky, the documentation is for Visual Basic (just as for NI ActiveX controls) and you "translate" in C functions the C++ like methods and objects. Hard work indeed ! If not, you have to "guess" what the hundreds of functions generated by the wizard are made for and how to use them...

My only sucessful experience with ActiveX was with NI 2D Graph controls. And it took me some time to make it working. The main frustration I had was that I did not find any sample code in C in the help. Good luck.

Message 6 of 9
(6,307 Views)

Ahh, this is a really helpful answer: It is always good to see other, more experienced people having similar problems... Ok, I guess I will stop thinking about ActiveX immediately. For others: Yes, The PLC server (Siemens calls this software PC Access) is found by the CVI wizard, and there is an example for VBasic as well. But I guess I will skip the manual language translation. So for now my last question concerning data sockets: what if I want to read and possibly write/modify my PLC data? The samples I have seen are either read or write access, not both: is it possible?

Many thanks! 

0 Kudos
Message 7 of 9
(6,299 Views)
You can use DataSocket object without having contol binding. If this case:
1) you have to code a bit yourself.
2) when connecting to the data source (i.e the url), you can choose a read/write access mode see the help associated with
err = DS_OpenEx (url_string, DSConst_ReadWriteAutoUpdate,
                 callback_function, NULL, DSConst_EventModel, 1000,
                 &handle);

To answer your question: yes it's possible to read/write but you have to use your keyboard. To read OR write, you just need your mouse.
Regards,

Message 8 of 9
(6,287 Views)
Thanks again, I guess I will be able to type this code 🙂
0 Kudos
Message 9 of 9
(6,282 Views)