01-05-2012 10:25 AM - edited 01-05-2012 10:27 AM
Hello,
I am having trouble getting the TagWrite VI in the Ethernet/IP Industrial Communications driver package to work properly. I have an Allen-Bradley CompactLogix 1769-L32E PLC connected via ethernet. The controller is online and connected through RSLogix 5000.
At the moment, I am working on writing two simple VIs - one to read and display from a single boolean controller tag using the TagRead VI, and one to write to a single boolean controller tag using the TagWrite VI. Using the code shown below, I am able to read from and display the status of the tag "JogX_In" :
I do this by going online with the controller in RSLogix5000 and manually changing the status of "JogX_In," at which point the status of "JogX_In" is updated on a boolean indicator on the LabVIEW front panel. Using a very similar code to write to the same tag, however, I get the error shown below:
Unless there is a different syntax for TagWrite, I am sure that the network path and tag name are correct as they work perfectly using TagRead. Can anyone please give me some help with this problem? I am by no means a LabVIEW expert, but I have worked with LabVIEW an number of times and have a reasonable understanding of the basics. Please let me know if any more information is needed.
Thank you!
01-05-2012 01:17 PM
Bools are somewhat funny on the ControlLogix in that they are implemented as 32-bit words with multiple bools per word. This means the array vs single bool access is a bit different and has alignment considerations. In your example, is the bool tag a single bool or an array? Also, how many elements are in the array passed to the write?
Eric
01-05-2012 01:52 PM
The BOOL tag is a single value in RSLogix5000, and likewise I am looking to write a single value with the VI. The input defaults to an array when I use "Create Constant" on the input of the TagWrite block, so I just gave the desired value to the first element of the array constant. I don't think the TagWrite block has an input to specify the number of elements passed to the write, so I'm assuming it is just given that first element (?).
Thanks,
Joe
01-05-2012 03:16 PM
The code I posted above is now working. I double checked the input to the TagWrite block and it turns out I actually had specified values for both the first and second values of the array. I made a new array constant and made sure to only change the first element, and it worked perfectly. I also checked the same code using DINTs, INTs, and REALs, and all work perfectly. So thank you for bringing the idea of single vs array inputs to my attention, or else I likely would not have found that!
On an unrelated note, do you know if it is possible to give the TagRead or TagWrite blocks a list of tags, i.e. using a string array or something similar? It seems as though you need a new block for every tag.
This program I am creating is part of my master's thesis work, so I will be dealing with it for a while. I will keep posting in this thread if I run into more problems (which I'm sure I will!).
Thanks again,
Joe
10-17-2012 11:21 AM
Hi Joe,
I am lso getting the same problem, i have tried to use a single element in the array, its not helping. Attached are the screen shots for the VI and the rslogix
thanks
habeeb