From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

plc connection

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

0 Kudos
Message 1 of 7
(5,178 Views)

> 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.

http://forums.ni.com/t5/Machine-Vision/Communication-between-Vision-Builder-AI-3-6-1-and-Siemens-120...

 

If you'd rather have Vision Builder AI be the server, we also have a white paper that explains it:

http://www.ni.com/white-paper/13574/en/

 

Best regards,

 

Christophe

0 Kudos
Message 2 of 7
(5,172 Views)

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

0 Kudos
Message 3 of 7
(5,155 Views)

You can create the shared variables linked to the PLC OPC Server tags using the information from this post:

http://forums.ni.com/t5/Machine-Vision/Communication-between-Vision-Builder-AI-3-6-1-and-Siemens-120...

 

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.

http://joule.ni.com/nidu/cds/view/p/id/2535/lang/e​n

 

3) You will need the DSC Run-time System to communicate with OPC Servers.

http://sine.ni.com/nips/cds/view/p/lang/en/nid/101​2

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.

https://decibel.ni.com/content/docs/DOC-3806

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

0 Kudos
Message 4 of 7
(5,110 Views)

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: http://forums.ni.com/t5/Machine-Vision/Communication-between-Vision-Builder-AI-3-6-1-and-Siemens-120...

and this post: https://decibel.ni.com/content/docs/DOC-3806 to learn how to read/write shared variables from CVI.

You should have your solution.

 

Best regards,

 

Christophe

Message 5 of 7
(5,127 Views)

GREAT

Thanks a lot, I will try that

 

best regards

Oliver

0 Kudos
Message 6 of 7
(5,120 Views)

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".

0 Kudos
Message 7 of 7
(5,117 Views)