Logix 5000, Array filling

4 posts in this topic

Hi there!

I have a question with AB PLC. My problem: 

I have some raw data...distance for example.When the machine starts,the sensor begins to send the information with the distance values. When data is received it is moved into an array. After the first 5 values the program calculates an average and the result is moved into another array.Currently after receiving the fifth value,thus filling the first array,making the calculation and sending the average to the other array,the program empties the entire first array instead of just always discarding the oldest value of the five,and recalculating the average with the newly arrived value every time.

I tried to made this with ladder diagram using an an fifo load and unload but isnt working. Please help me if anybody can. Thank You.

Share this post

Link to post
Share on other sites

What part of the program are you having problems with?

Can you show what you have so far?


Share this post

Link to post
Share on other sites

Hi, sorry for the late reply. Here is the pic.  My problem is that now the program after every fifth data arriwed made an calculation. But I want that the program make after every new data an calulation. I hope do you understand my problem.

Thank you.


Share this post

Link to post
Share on other sites

I'm not clear why you are using multiple arrays. Only one is needed for the FIFO.

I suggest the following modifications:

In the first rung remove the MOV command. In the FFL change 'source' to just 'Distance'

In the second rung remove the ONS contact. Remove the EQU and insert an XIC of 'control.DN'. In the AVE change the 'Dest' to a single tag. In parallel with the AVE command add a FFU. Use the same control tag as in the FFL. Provide a dummy tag as the destination for the oldest array member, assuming you don't need it.

Analysis - the FIFO Unload will remove the oldest reading and bump the rest. 'control.DN' will turn off and will stay that way until the next reading is added in your first rung. Thus your second rung will only fire after the first 5 readings are accumulated then will fire after each new reading comes in.

Edited by b_carlton

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