Shifting Integer values with AB 5/03

birdy

Member
Join Date
Aug 2002
Posts
4
Hello All,

I'm busy with a project and run accross some problems.

Here it is:
I have an integer table of 80 values: For example N7:0 to N7:79.
With every falling edge of a limit switch I want to move all the data 1 up. (In N7:0 comes a value of 0,1,2,3,4,5,6 or 7 to describe the product)

That is:
N7:78-->N7:79
N7:77-->N7:78
...
N7:0-->N7:1
and finally I put a new value in N7:0

I do not care about the loss of data in N7:79.
(On the conveyor way N7:x is read in some stations but NEVER modified)

I'm not so used to work with the register functions.
So I planned to make the shift by myself...but if I just type it out...it means a lot of work. (Not that I'm lazy, but it doesn't look elegant).

I tried to use a loop (Within one program scan) for 80 times with indirect adressing, but that will do really bad for the scan time.
(It is much better to type the whole thing out than to use such a loop).

I suppose I will have to do it with ffl and ffu...but that makes it somewhat more difficult to handle.
If I write as above, I can really control by many ways.

Any experience is very thankfully welcome,

Kind regards

Birdy
 
PLC type and further

Hello,
thanks for your reply
As you guessed...it is an allen bradley slc 5/03.

As for your suggestion for BSL...

I thought this was only good for shifting bitwise.
Maybe I'm misunderstanding BSL...

But what I want to do is shift the integer value (eg 7) upwards in the integer data table on a puls.


Kind regards,


Birdy
 
You may have to invert your thinking but try this:
   GO_NOW  B3/0     +-COP------------+
----] [----[OSR]----| Copy File |
| Source #N7:1 |
| Dest #N7:0 |
| Length 80 |
+----------------+

Store the new value into N7:80 and push the go button. The integer values will shift DOWNWARD one notch (to a lower address). (Example: N7:80 -> N7:79; N7:79 -> N7:78; N7:0 -> nowhere). I think this was covered on this forum in some detail - but I can't find the thread right now. My rung doesn't include everything you requested but hopefully it will get you started.
 
Last edited:
Since say you want to move the data UP (Ron's code will only go DOWN), you need to move it to an intermediate (N9 in my example).

COP #N7:0 #N9:0 79 ; This will grab N7:0 to :78 and put it N9:0 to 78

COP #N9:0 N7:1 79 ; this will take N9:0 to 78 and put it in N7:1 to 79.

If you follow the data, you'll see that
N7:78 --> N9:78 --> N7:79
N7:77 --> N9:78 --> N7:78
N7:76 --> N9:78 --> N7:77
. . .
N7:0 ---> N9:0 ---> N7:1

Use Ron's example of a one-shot trigger to do the double move.
 
Ron,

The COP method of shifting numbers was on A-B's forum... that's why you wouldn't find it here. Great Thred though...but I can't seem to find it right now either
 
Hello,

I read above examples and was amazed how easy it could be !
(I saw the light~~)

I tested this little program and it worked perfectly.
B3:0/0 will create a one shot on B3:0/2.
For the example I took a data table of 10 words: N10:0..9

When B3:0/2,
I first copy N10:0..9 to N11:0..9 (that is copying 10 words)
Then I move N11:0..8 to N10:1..N10:9 (that is copying 9 words)
Finally move N7:0 (New value) on N10:0

XIC B3:0/0 OSR B3:0/1 OTE B3:0/2


XIC B3:0/2 BST COP #N10:0 #N11:0 10 NXB COP #N11:0 #N10:1 9 NXB MOV N7:0 N10:0 BND



Thanks everybody,

Birdy

shift.jpg
 

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
358
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,023
Why encremental encoder have a phase shift of 90°between A,B phases ,if it's 60° 30° what happen what's the difference ,can we change the 90°in...
Replies
47
Views
10,784
Hello everyone, I am working on trying to record a history of user logins with a time stamp. It will record their user ID and the time that they...
Replies
15
Views
3,826
Hey guys, What do you suggest for doing a shift of dints within an array like this? Thanks, Kevin
Replies
12
Views
2,556
Back
Top Bottom