S7 5.5 array shifting and avg

dwoodlock

Lifetime Supporting Member
Join Date
Nov 2012
Location
Cincy/nKY
Posts
565
Gents,

Trying to shift and average 10 integer array values.

First issue is shifting every value in the array forward one spot.

0..8 becomes 1..9 is the idea, which allows me to move a new value into 0.

TIA makes this very easy, but not finding the same ease in classic.

I am sure I can use 10 move instructions, but I was hoping there was a way to manipulate larger groups of data.

Thanks in advance.
 
To make a block that both handles the FIFO buffer and the averaging will be very easy in SCL.

If you dont have SCL, then in the standard library, under the TI-S7 converting blocks, there is an FC85 "FIFO".
And under the S5-S7 converting blocks there is an FC92 "Buffer storage (FIFO)".
Both are FIFO buffer block for integers. Select either block and hit F1 to get help on the usage.

Unfortunately there is no averaging block that I know of.
Without SCL you will have to write STL code and use the LOOP instruction.
One hint, when doing the summing before averaging, you should convert the summing variable to a REAL or a DINT. Otherwise you risk that if you sum many INTs that summed value exceed the maximum number range of an INT (-32768 .. +32767).
 
Thanks for the suggestions. Unfortunately I don't have the ability to use SCL. I think I could sort it out fairly easily if so.

I made a block with all the code yesterday, and I'll plan to try it out today. I think what I made will work, but I was looking for a cleaner way to do it.

Thanks for the tips
 

Similar Topics

Greetings, I am trying shift data in an array (such as Array[0] is shifted into Array[1], Array[1] is shifted into Array[2]......all...
Replies
10
Views
360
Hello Guys, I think I need to use SCL for the following task but am very weak using SCL in tia portal. I have results history data block. It is...
Replies
14
Views
3,041
Hey guys, What do you suggest for doing a shift of dints within an array like this? Thanks, Kevin
Replies
12
Views
2,558
Not sure if this is possible but thought I would put it out there. Using Rockwell Studio 5000, is it possible to shift the address of an array...
Replies
7
Views
2,093
Hi, I am using RSLogix 5000 V19 and I am trying to figure out how to shift reals in an array. Currently, I setup a flip-flop that increments a...
Replies
19
Views
9,622
Back
Top Bottom