12-07-2009 01:44 PM
I want to read/write blocks of data from an AB PLC5 via RSLinx OPC server.
I've configured the RSLinx server sucessfully and am able to read and write single registers. I also am able to write individual bits.
For writes I'm using the URL opc://localhost/RSLinx OPC Server/[NITest]N7:3,L9
with a Boolean array connected to the write datasocket, works fine.
For reads I've tried URL opc://localhost/RSLinx OPC Server/[NITest]N7:0,L3.
The VI runs without errors but don't know how to extract individual registers.
Need help reading individual registers
12-08-2009 02:57 PM
dpaulovich,
How are you reading this data? Are you using LabVIEW? If so, are you using Data Sockets or DSC? What exactly do you mean by "extract individual registers"?
12-08-2009 04:42 PM
- I'm using Labview 9
- I'm using Data Sockets
The Data Socket read works with the URL of opc://localhost/RSLinx OPC Server/[NITest]N7:0,L3
From what I've read that should return the values in 3 registers N7:0 to N7:2. Once the Data Socket reads them
how do I look at the individual registers. Do I have to put them in array some how or what?
Attached is my VI to do the read/writes from Rslinx
12-09-2009 12:56 PM
dpaulovich,
What do you mean by "Data Socket read works"? What results do you currently get? What results are you expecting?
I see that you have a double wired into the type (variant) input on the Data Socket Read.VI is this the type you are expecting from these 3 registers? It looks like you are then taking that double and converting it to a I16 to display in both the water tank and Deg F indicators.
12-09-2009 01:40 PM
- When I run the VI with the URL of opc://localhost/RSLinx OPC Server/[NITest]N7:0,L3 I get no error.
It appears like its finding the items, although I have no way of proving it.
- When I run the VI with the URL of opc://localhost/RSLinx OPC Server/[NITest]N7:0
the VI gets the value from N7:0 and operates the bargraph in the water tank.
- The write works as shown. I can set/reset bits in the PLC
What I want to do is read a block of registers from a AB PLC5 using the RSLinx OPC server and Labview.
Once the register values are in Labview I need to be able to use the values in individual registers.
12-10-2009 10:11 AM
dpaulovich,
What do you get when you run the first URL? Is there anything in the indicator?
Is the value you recieve with the second URL what you would expect? Is that data stored in multiple registers or just one?
What happens if the parameter you put into the read is an array of doubles?
What is supposed to be in these registers? It could be that multiple registers are needed to make one value. You might try changing the constant to something smaller like an I8 or something.
12-10-2009 01:03 PM
Jason
Let me start over!!
Can you tell me how to read and write blocks of data
from an AB PLC5 using an RSLinx OPC Server and Labview
12-11-2009 02:52 PM
dpaulovich,
Have you looked through the following DevZone Articles?
http://zone.ni.com/devzone/cda/tut/p/id/4626
http://zone.ni.com/devzone/cda/tut/p/id/3224#toc2
The first explains how to set up your RSLinx OPC Server with your AB PLC. The second one explains how to use DataSockets to read from an OPC server. You may have to check the documentation of your PLC to get the exact item names and syntax for reading specific registers, but other than that this should pretty much cover everything. If you are having specific problems after looking at these, fill us in with some more details and maybe someone on here can give some advice.
12-11-2009 04:03 PM
David
Thanks for the info, I've already looked at these pages.
I'm able to read and write single registers to/from the PLC just fine.
What I would like to do is read/write blocks of data.
Can't seem to figure that out.
I've attached a Vi that I developed to do the reading and writing to the PLC.
Any help will be appreciated.
12-14-2009 03:33 PM - edited 12-14-2009 03:33 PM
dpaulovich,
In order to do a block read the best suggestion I can offer you is to place your read in a for loop and pass an array of individual registers paths and use the auto indexing to control how each location is read.
You also might want to implement some sort of timing/syncronization between the loops as currently they can run whenever they like. Making sure they read one after the other might help.