Ben22

FLL Instruction - RSLogix 5000

6 posts in this topic

My problem is this:

I'm using a UDT Array to store and calculate scrap quantities for individual stations on our machines. Every lot I clear those arrays using an FLL. I Source an empty array of 500 elements (So I may use one array for my varying lengths of arrays to clear. None of them are greater than 500 elements). My instruction looks like this:

FLL

Source: Empty_Array_500[0].Count               (Count is a DINT) (Empty_Array_500 is a UDT[500])

Dest:     StationTag[0].Count                           (Count is a DINT) (StationTag is the same UDT[50] or UDT[32] depending on the station being referenced)

Length: 32 or 50                                                (Depending on the station, the length is 32 or 50 because the array tag for that station only needs so many array elements)

 

Somehow, after the FLL's for every station tag are completed, there are values left in some of my ".Count" in some of my arrays, but not all of them. I'd really appreciate some input on what I may be doing wrong or what to look out for.

 

Thanks!

Share this post


Link to post
Share on other sites

Can you post an image of your logic?

Is it possible, that after the FLL is completed, some other values are written to your ".Count" somewhere else in the logic

Share this post


Link to post
Share on other sites

That's what I'm trying to figure out right now. I'm about to watch the trend line on a .Count value that has a >0 value in it

Update:

I placed an FLL in an empty rung to verify no preceding logic could be blocking it, and I'm trending one of the array elements to see if it's being rewritten every cycle by something else in the logic.

The trend line stays a constant value indicating nothing is even being written to it by the FLL. 

Could it be that the FLL is not the right instruction for this function? I tried a CPS as well with no success.

 

 

Capture.JPG

Edited by Ben22

Share this post


Link to post
Share on other sites

What is your UDT structure?

My understanding of the FLL instruction is that it will take the value in Source and "FILL" the destination addresses to the length specified. IOW, your code would create 50 copies of Empty_Array_500[0].Count into the destination.

A COP or CPS instruction would do what you want with simple arrays but I'm not sure the COP, CPS, or FLL will work to overwrite a single element in an array of UDTs.

Select the "FLL" instruction and hit "F1" to open the instruction help. There may be useful information there for you.

I suspect that the instructions are starting with the ...[0].Count element inside your UDT array and just writing the contents of the empty array [0].Count to 50 consecutive memory locations, including the other elements of each UDT. In other words, if your UDT looks like this:

Ben22.Count [DINT]
Ben22.Foo [DINT]
Ben22.MrPLC [DINT]

...and you have declared it as "Array[50]" of type "Ben22",

...your FLL instruction will take the value stored in Empty_Array_500[0].Count and write it to:

Array[0].Count
Array[0].Foo
Array[0].MrPLC
Array[1].Count
Array[1].Foo
Array[1].MrPLC
Array[2].Count
Array[2].Foo
Array[2].MrPLC
...
Array[16].MrPLC

...leaving the rest of the UDT array unchanged.

That is my first suspicion of what's happening. I would have to prototype it to be sure but I'm out on the floor without access to a Logix 5000 PLC to play with it.

 

Share this post


Link to post
Share on other sites

This is the structure of the array in question: I looked into the possibility of filling the consecutive memory locations, but I'm not sure how it would work assuming the strings are next to it. Perhaps the strings are why the FLL is not working for this tag structure

Capture2.JPG

 

Update: I was able to get it to work as needed. I removed the .Count from the destination array and it now works perfectly. I guess there's more to be learned about how to use the FLL instruction than meets the eye.

Thanks for the help!

Edited by Ben22
1 person likes this

Share this post


Link to post
Share on other sites

First, it is not necessary to have an array as the source for the FLL - just enter 0 as an immediate variable.

Second, as Joe E. hints at, the FLL won't work the way you're hoping. The instruction to use is FAL.

 

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