10-08-2014 04:22 PM
Hi
we are using CVI 2012 and we want to read out variable values from a Siemnes PLC.
We got a recommendation to see the PLC as OPC server and establish a connection to it to read out the values.
Now I wonder if it is possible to see the variables from the PLC as shared variables and read them out like variables from VBAI?
Does anyone know if it is possible to establish the variables of a PLC as shared variables?
thanks
Oliver
10-08-2014
04:36 PM
- last edited on
03-05-2025
10:01 AM
by
Content Cleaner
> Now I wonder if it is possible to see the variables from the PLC as shared variables and read them out like variables from VBAI?
Yes, it's possible. This thread explains how to communicate between Vision Builder AI and an OPC Server.
If you'd rather have Vision Builder AI be the server, we also have a white paper that explains it:
Best regards,
Christophe
10-09-2014 01:41 AM
Hello Christophe
that was a misunderstanding.
i want to read out variables from a PLC with a CVI program. One possibility seems to be to use OPC. Now I wonder if there is also an other way. In an other project where we use a CVI program and we communicate with a VBAI application via shared variables. That works really fine and i wonder if this solution could also be used with PLCs.
That means, I want to create a CVI program and read out variables from a PLC and I want to ask if this is possible with shared variables?
thanks
Oliver
10-09-2014
01:56 PM
- last edited on
03-05-2025
10:03 AM
by
Content Cleaner
You can create the shared variables linked to the PLC OPC Server tags using the information from this post:
Communicating with an OPC Server
It is possible to communicate with OPC Servers using shared variables.
1) Using your PLC OPC Server software, create tags for each data you want to share.
2) Download and install the NI Distributed System Manager, which is a free utility.
https://www.ni.com/en/support/downloads/software-products/download.distributed-system-manager.html
3) You will need the DSC Run-time System to communicate with OPC Servers.
https://www.ni.com/en-us/shop/product/labview-datalogging-and-supervisory-control-module.html
Unfortunately, this Run-time is not free, but you can check with you NI customer service representative, to see if you can get an eval version to see if that works for you.
Install it.
4) Launch the Distributed System Manager.
Right click on localhost (located under My Systems). Then select "Add Process"
Choose for example "OPC Client" as the Process Name.
Now, right click on OPC Client.
Select Add I/O Server. Choose an OPC Client I/O Server.
In the configuration dialog, you should see your PLC OPC Server. Select it. Click OK.
5) Follow the instrutions from this link to read/write the variables from CVI.
The document describes how to read variables created with LabVIEW, but it should be the same if they've been created using the Distributed System Manager.
Hope this helps.
Christophe
10-09-2014
02:21 PM
- last edited on
03-05-2025
10:03 AM
by
Content Cleaner
You should be able to read/write shared variables in CVI that were created by the Distributed System Manager.
Combine the information from this thread to create the variables using the Distributed System Manager: https://forums.ni.com/t5/Machine-Vision/Communication-between-Vision-Builder-AI-3-6-1-and-Siemens-12...
and this post: https://forums.ni.com/t5/Example-Code/CVI-and-LabVIEW-Network-Published-Shared-Variables/ta-p/352165... to learn how to read/write shared variables from CVI.
You should have your solution.
Best regards,
Christophe
10-09-2014 03:25 PM
GREAT
Thanks a lot, I will try that
best regards
Oliver
10-09-2014 04:28 PM
Another possible way to go, not involving shared variables is to use a different communication protocol supported by the PLC.
I am thinking for example about Ethernet/IP which is commonly supported. While NI doesn't have an Ethernet/IP C API (we do have one for LabVIEW), you could get one from some other companies. Google for example "Ethernet/IP C API".