LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write to RSLinx OPC

I'm just starting to learn LabView and have used example VIs in opc.llb to read data from a PLC. Unfortunately I don't see any example VIs for writing data. I tried the 'DataSocket Write' function but can't get the connections to it sorted out. Are there any simple examples or writing to RSLinx OPC that someone could point me to please.
 
Thanks
0 Kudos
Message 1 of 6
(4,441 Views)

Well I see, in rereading your post, that you have some comm with the PLC so most of my message is not needed. If you are reading you should be able to write if you have the right "URL" spec'd. Which example have you been using, as I state in the body of this post the a modified "Multiple OPC Items Monitor", where I added an "Datasocket Open Connection.vi" set to "write" and then an event structure that wrote values if the UI's values changed which worked pretty well. Did them on the fly while at my customer, doing a proof of concept demo that LabVIEW could talk to his PLC. Of course it was the second trip, after getting an AB-Rockwell USB-RS485 adapter (customer paid for it, don't know the $) 

 

Hi,
     There have been a few discussions regarding communicating with RSLinx on this forum. Run a search with the terms RSLinx, OPC, LabVIEW. There are a number of things to watch for. First, you need to have the full RSLinx, not RSLinxLite, or whatever it is called. Secondly, how are you physically connecting to the device that you're trying to talk too? I recently fought with trying to talk over a serial port, to be told by a AB-Rockwell tech support guy that, "their drivers won't talk to a USB-RS232 adapter, may not talk to a built in serial port in OS above Windows98 (!!!)". There was a slight variation on the first part, they can talk to a USB-485 adapter that they sell. Then you need to make sure that the RSLinx is configured correctly (there is a doc on the NI site that helps for this). After all this I was able to use the basic example of multiple OPC items that ships with LabVIEW to do basic communication, writing to and reading from tags on the PLC I was working with.

 

Good Luck,

 

P.M.

 

Message Edited by LV_Pro on 03-23-2006 03:59 PM

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 6
(4,435 Views)

Graham_D wrote:
... Are there any simple examples or writing to RSLinx OPC that someone could point me to please.

Graham,

Last year, Andrew_Russell posted a few Datasocket URL's that he found worked for block reads/writes of booleans and floats from an AB-PLC5/RSLinx. You can find them here

=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 3 of 6
(4,422 Views)
Thanks for the replies. I used 'Multiple OPC Items Monitor.vi' to read PLC values without problems so RSLinx is set up ok and I have the correct URL format as I was able to replace the Select Items section with typed input. In this VI there is 'DataSocket Read Double.vi'. I was hoping there would be a similar VI ''DataSocket Write Double.vi' that I could use. The reading process in 'Multiple OPC Items Monitor.vi' involves
DS Open [Read]
DS Update
DS Read Double
DS Close
 
I'd really appreciate knowing how this should be changed to write a value.
 
Many Thanks -
 
Graham Dalby
0 Kudos
Message 4 of 6
(4,409 Views)


@Graham_D wrote:
.... I was hoping there would be a similar VI ''DataSocket Write Double.vi' that I could use.

There's a DataSocket Write Double.vi in dataskt.llb  (... \LabVIEW xx\vi.lib\platform\dataskt.llb).

=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 5 of 6
(4,402 Views)
Thanks Donald - That looks to be just what I need
0 Kudos
Message 6 of 6
(4,390 Views)