ameyzingg

Looking for better way to copy array into individual tags

7 posts in this topic

I am copying some data from a vendor PLC through MSG instruction into my PLC through CIP data table read. Is there a better way to break down this array of data into individual real tags through an instruction (something similar to WORD_to_BIT instruction in Modicon). I was looking at FAL instruction but its not exactly doing what I am looking for. Any help is greatly appreciated.

Share this post


Link to post
Share on other sites

If you're working with Logix5000 Platform then you can do something like the following:

In your PLC you currently have Vendor_Real_Array[0] through Vendor_Real_Array[100].

You can create a tag of type Alias called TempAmbientReal which is an alias of Vendor_Array_Real[0].  Then create an alias with a meaningful name for each of the 100 reals.

Before you say that sounds like a lit of work, don't forget once you've made the first couple you can export tags to excel.  add the rest and re-import.

1 person likes this

Share this post


Link to post
Share on other sites

I just tried it and its working great, thank you! I want to branch out from this to one more question. How does the messaging works for UDTs in vendor PLC? 

For e.g. in a usual MSG instruction Vendor_Real_Array[0] is copied to Plant_Real_Array[0]

Where would Vendor_Real_Array[0].Volts will be copied to, if I don't have the same UDT in my PLC?

Share this post


Link to post
Share on other sites

OK now you're starting to mix references and confuse me.  

A MSG with a source of Vendor_UDT_Array in Vendor_PLC would need an identical UDT array in the Plant PLC to not error.

Are you moving an Array of UDT or an Array of Reals?

Share this post


Link to post
Share on other sites

Sorry for the confusion. I am moving both actually, with multiple MSG instructions. I am comfortable with array of reals since I have done those before. I am just not sure about UDTs.

Share this post


Link to post
Share on other sites

OK that's what I was thinking, but was wanting confirmation.  So let's assume you have a simple UDT for Vendor_UDT Type defined as Follows:

Vendor_UDT.Used is a Bool

Vendor_UDT.Value is a REAL

Vendor_UDT.Name is a STRING

Vendor_UDT_Array is an Array of type Vendor_UDT and a count of 16 for example.

You'll need a UDT Type in your PLC defined to match the Vendor_UDT type and you'll need an array that matches or exceeds the size of the Vendor_UDT_Array.

You'll right your message just like the REAL one only source and destination will be element [0] of the UDTArray.

You'll then be able to alias to each sub-element of the array just like you aliased to Real Array elements.

Share this post


Link to post
Share on other sites

Bob I created an account just to thank you for this Gem. I am not a fan of using aliases but this is the perfect use for them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now