Help - Search - Members - Calendar
Full Version: RS5000 Indirect addressing used for recipe
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Donovanr
I have an application where i need 1x HMI screen for machine settings, it will contain data stored in an array of 10x DINT's called Recipe_Storage[10]

Using indirect addressing i would like to change the Product_Selected tag from eg. 0-9 (10 Products) which will then copy the stored data from Recipe_Storage[10] in to the selected product Current_Product[10]

All the prevoius posts i have found are using only single DINTS, is it possible to use an Array in indirect addressing?

Are there any RS5000 examples using Arrays

Below is my code, which does not seem to copy from Recipe_Storage[0] to Current_Product[0] because you cant specify the start of the array

LIM 0 Product_Selected 9 BST XIC Read COP Current_Product[Product_Selected] Recipe_Storage[0] 1 NXB XIC Store COP Recipe_Storage[0] Current_Product[Product_Selected] 1 BND

Any help would be much appreciated

Thanks smile.gif
b_carlton
I make a User Defined Type which is the array. I'm sure the ten different items in the array standf for different things. This is a great opportunity to break them out. The UDT can contain the ten individual items as their own DINT. Let's call the UDT 'MyRecipe'. Let's say the DINTS are named Ingredient1, Ingredient2 etc. If you know specifically what the ingredients are then name them as such instead of the generic 'Ingredient'

Once you have the UDT defined create a single instance as a tag called 'CurrentProduct' of type MyRecipe. This will have the components CurrentProduct.Ingredient1, ... CurrentProduct.Ingredient9

Also create a tag 'RecipeStorage' of type MyRecipe but being an array 10 long. This will have:

RecipeStorage[0].Ingredient1 ... RecipeStorage[0].Ingredient9
...
...
...
RecipeStorage[9].Ingredient1 ... RecipeStorage[9].Ingredient9

Now it's just COP CurrentProduct RecipeStorage[ProductSelected] 1 to store and COP RecipeStorage[ProductSelected] CurrentProduct 1 to Read.

If you ever decide to expand the number of ingredients you can, while offline and having uploaded all current data, add another DINT to the UDT definition. This will change the size of CurrentProduct as well as all ten RecipeStorage items. All the original info will be in place. After downloading, you now just have to add the data for the new ingredient.

And of course to add to the number of recipes you just increase the RecipeStorage array size in the same manner while offline.
Donovanr
QUOTE(b_carlton @ Jun 29 2008, 09:40 PM) [snapback]70957[/snapback]
I make a User Defined Type which is the array. I'm sure the ten different items in the array standf for different things. This is a great opportunity to break them out. The UDT can contain the ten individual items as their own DINT. Let's call the UDT 'MyRecipe'. Let's say the DINTS are named Ingredient1, Ingredient2 etc. If you know specifically what the ingredients are then name them as such instead of the generic 'Ingredient'

Once you have the UDT defined create a single instance as a tag called 'CurrentProduct' of type MyRecipe. This will have the components CurrentProduct.Ingredient1, ... CurrentProduct.Ingredient9

Also create a tag 'RecipeStorage' of type MyRecipe but being an array 10 long. This will have:

RecipeStorage[0].Ingredient1 ... RecipeStorage[0].Ingredient9
...
...
...
RecipeStorage[9].Ingredient1 ... RecipeStorage[9].Ingredient9

Now it's just COP CurrentProduct RecipeStorage[ProductSelected] 1 to store and COP RecipeStorage[ProductSelected] CurrentProduct 1 to Read.

If you ever decide to expand the number of ingredients you can, while offline and having uploaded all current data, add another DINT to the UDT definition. This will change the size of CurrentProduct as well as all ten RecipeStorage items. All the original info will be in place. After downloading, you now just have to add the data for the new ingredient.

And of course to add to the number of recipes you just increase the RecipeStorage array size in the same manner while offline.



Thanks b_carlton' for your reply

Creating UDT's does make it more flexible if any changes are needed at a later date..

Do you then convert the RecipeStorage array in to a 1 dimensional array to then reference via a single screen on the HMI?

eg. Display a numeric input enable for the follow tags

RecipeStorage[0].Ingredient1
RecipeStorage[0].Ingredient2
RecipeStorage[0].Ingredient3...

Thanks again for your input



BobLfoot
I would use a screen which displays two UDT tags named like follows:
RecipieCurrentValue
RecipieUpdateValue
and displays a DINT RecipieNumberSelected

When the screen loads or you change recipie numbers you do a
COP RecipeStorage[RecipieNumberSelected] RecipieCurrentValue 1

When you press the Update recipie Button you do a
COP RecipieUpdateValue RecipeStorage[RecipieNUmberSelected] 1

This allows you to update any recipie without having to make it the Current Product.
DwalterE
You could also use two-dimension array for your recipe storage ie Recipe_Storage[10,10]

To save a recipe to this array, set Product_Select to the desired recipe, then

COP Current_Product[0] Recipe_Storage[Product_Select, 0] LEN 10

To retrieve a recipe:

COP Recipe_Storage[Product_Select,0] Current_Product[0] LEN 10

I don't have a PLC here to test it on, but did enter this code into Logix5000, and it accepted it
without complaint.

There's also a synchronous copy instruction CPS, which ensures that none of the data changes
during the copy process.


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.