LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I transfer data to AB PLC 5-40E with OPC?

Hello,
I need to transfer data from a Labview executable to an AB PLC 5-40E. I was convinced by NI to buy the OPC addon. I have that now, but I need to know the steps involved in setting this up. I do not have access to the PLC in question (it is in another country) and I do not have one to test with. Does someone already have this done that I could use? Is there a tutorial that explains how to do this? I do not want to become an expert in OPC - I just want it to work. LV8.0, WIndows XP.
 
Thanks,
Ron
0 Kudos
Message 1 of 5
(3,930 Views)
Hi Ron: Actually, the NI-OPC server is probably the easiest way to link Labview with an A/B PLC. The first thing to learn is the DataSocket part of Labview. Basically, you assign the data points in the A/B that you want to read/write with the OPC Setup Wizard, and access then with Labview DataSocket technology. I realize this is pretty general advice, but what you want to do is a bit beyond what I would want to describe until I had an idea of your familiarity with Labview, and what level of detail I should go into. For now, look into DataSocket, and the solution will almost jump out at you. Good Luck, Dave
0 Kudos
Message 2 of 5
(3,922 Views)
Thanks Dave,
I am familiar with Datasocket but am not with the PLC interface. THe customer is in Mexico and I am not; I do not have access to an A/B here. How do I know how which data points to assign on the PLC? Do I ask the customer for a range of addresses? I can see how it works if you are developing on the system with the PLC attached, but I need to make the exe and send it away without being able to connect to the system. Do I set up the datasocket for a flattened string or can I set an array of numbers? Is there an OPC tutorial or something I can work from? The help files are nice but it is hard to search for something that you don't know exists. Thanks for your help.
Ron
0 Kudos
Message 3 of 5
(3,909 Views)
Hi Ron,

I hope you're doing well.  Even though you don't have the PLC physically hooked up to your development PC, you can definitely develop your software without it.  It sounds like you have the NI Industrial Automation OPC Server, so you already have the drivers for your AB 5-40E PLC and can create an OPC server for LabVIEW to communicate with.  You will be able to write values to any of the data members of the OPC server to control the PLC, so when you actually set it up on a machine with the hardware, it will actually communicate with the OPC server/driver will then communicate with the PLC.

To do this, you'll first need to set up the OPC Server for the PLC on your development machine.  There is a step-by-step section on creating a server in the IA OPC Servers Help, which can be found in Windows, Start»Programs»National Instruments»Industrial Automation OPC Servers <version>»Industrial Automation OPC Servers Help.  Under the Contents, there is a section titled "Getting Started: Creating a Server."  After you create the server, you can restart the IA OPC Servers application and then the OPC server should be visible to any OPC client on your machine.

From here, I would take a look at the Getting Started with LabVIEW DSC Manual, located at C:\Program Files\National Instruments\LabVIEW 8.0\manuals\DSC_Getting_Started.pdf.  You can create an IO Server similar to how the manual instructs, except you would create an OPC Server instead of Custom VI – Periodic I/O Server.  You can then browse to National Instruments.OPCLookoutDrivers to find the server that you created for your PLC.

Let us know if you are running into any specific issues when trying to get this up and running and we'll be glad to help, but hopefully this gives you a good place to start.  Have a great day Ron!

Thaison V
Applications Engineer
National Instruments

0 Kudos
Message 4 of 5
(3,892 Views)

Hello,

Thanks for the input. I now have the server setup, etc. but am running into a Labview error/crash problem. I am using LV7.0 and OPC server, Windows XP. I have the server setup and OPC object as an AB PLC5/40E and data members associated with the channels on the PLC. I use the Datasocket Write VI and connect up a URL and data. I put this in a loop and it runs fine and at good speed. If I then try to change the URL (to write to a different address of the PLC) it immediately crashes with a range of errors that have no explanation (eg -2147467262). There are other times when it crashes and shuts down labview. Same result if built into an executable. IF the PLC is connected and operational it works OK. I am worried that the PLC will shut down for some reason (maintenance) and that will cause my exe to crash. IF anyone can help, I would appreciate it.

NI tech support have duplicated the problem and are trying to offer a work around or a solution, but so far with no success. One suggestion is to use LabView DSC but this is another $2k or so above the OPC original cost.

Thanks,

Ron Larson

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