Shifting 10 words at a time

vocalmind

Member
Join Date
May 2005
Posts
4
Hi,

Any workaround on how to shift 20 words at a time. My knowledge of shift register is that it can shift 1 word at a time.

Sample:

N19:0 to N19:19 (length=20 words)
N19:20 to N19:39
N19:40 to N19:59
N19:60 to N19:79


I need to shift this 20 words every machine cycle.

Regards,
 
You can use a COP Function to move words if they are lined up COPY N19:0 to N19:20, Length of 20. This would move 20 words from N19:0-19 to N19:30-39. Since yours are staggered, you may want to use a bunch of MOV blocks.
 
vocalmind said:
Hi,

Any workaround on how to shift 20 words at a time. My knowledge of shift register is that it can shift 1 word at a time.

Sample:

N19:0 to N19:19 (length=20 words)
N19:20 to N19:39
N19:40 to N19:59
N19:60 to N19:79


I need to shift this 20 words every machine cycle.

Regards,


A shift register instructions are file instructions. That means it can work on more than one word at a time, but it shifts bits. That is X/0 is shifted to X/1 and X/1 is shifted to X/2 and so on. Eg.
BSL #N19:0 R6:0 B3/0 320 creates a bit shift register that is twenty words, or 320 bits long.

It sounds however like you are wanting to shift the contents of N19:0 thru N19:19 to N19:20 thru N19:29, not just shift the bits, so a shift register instruction wont work. You need to use the copy instruction. If you are using a PLC5 then I think you could do this in a very slick way with a single FAL instruction, but if you are using the SLC5/0x family you will have to use three COP instructions. Be sure and use the # file indicator

COP #N19:40 #N19:60 20
COP #N19:20 #N19:40 20
COP #N19:00 #N19:20 20

If you are using the PLC5, look at the FAL instruction in the manual. Is if possible to use a FIFO, FFL, instruction instead?
 
Are you tracking products through a machine?
Another method is let the data stay where it is, and advance an indirect address pointer every machine cycle. Anything that needs to read from or write into the shift register is just offset from here.

pp
 

Similar Topics

Hello Everyone, I have spent several hours searching the forum for a similar example or situation. The basic problem is this; I am trying to...
Replies
8
Views
3,273
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
374
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,105
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
11,004
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,889
Back
Top Bottom