Help - Search - Members - Calendar
Full Version: Referencing an element in an array RS5000
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Donovanr
Hello

I have created a UDT called Recipe_Storage, the first element of the recipe array is the Product_Name (String Type),

Using a tag called New_Product_name (String Type which is a single source on an HMI to edit) and with indirect reference (Product_No) to which Product_Name you are going to edit ie:

Recipe_Storage[0].Product_Name or
Recipe_Storage[1].Product_Name or
Recipe_Storage[2].Product_Name

I am trying to reference only the Recipe_Storage[X].Product_Name

If i use the COP instruction on the left it overides all of the tag data in
Recipe_Storage[0].Product_Setting_1
Recipe_Storage[0].Product_Setting_2 etc
and the COP on the right does not verify.

Is there any other way of pointing to Recipe_Storage[0].Product_Name and using indirect referencing? Or have i reached the limits of indirect referencing..

Thanks for your input

[attachmentid=6457]


Mandar
Hi,

If you want to reference Recipe_Storage[X].Product_Name, and use indirect addressing, then your COP instruction should be as follows:

COP New_Product_Name Recipe_Storage[Product_No].Product_Name 1

The Recipe_Storage[Product_No] will now point to the element in the Recipe_Storage array as per the value present in 'Product_No'. And the COP instruction will now copy New_Product_Name to .Product_Name.

The first COP instruction you have used will write to whole of Recipe_Storage[X] (the UDT).

In case of the second COP instruction, you are trying to point to an array for .Product_Name, this tag is a String type tag also is not an array, which is the reason the instruction is not getting verified.
Donovanr
QUOTE(Mandar @ Jul 4 2008, 12:19 AM) [snapback]71125[/snapback]
Hi,

COP New_Product_Name Recipe_Storage[Product_No].Product_Name 1



Hi Mandar

Thanks for your input, it is exactlly what i was after...

Nice tip!!

I never tried the last element of the tag after the indirect address reference

Cheers
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.