ControlLogix 5000 Word Shift Register

We want the most recent value in word 0. Up or increase is n + 1. Example Array[0] + 1 = Array[1]. NOT the visual up in CLX Tag Monitor screen. Relate it to a BSL. A Word Shift Left is what we want
 
It does not matter in the slightest whether the data goes UP or DOWN the sodding array, just as long as you know where to put it in the newest data and pull out the aged data when you want it.

The single COP method outlined works exactly as requested except it has the characteristic that a word value put into say Array[n] moves to Array[n-1], not Array[n+1} as you are probably wanting. But it makes no difference to the end result.

You've asked for a single instruction that does a "word shift", and you've got it.... it's starting to baffle me why such a simple thing has now extended to 15 posts.
 
PhilipW pull your head out at least to you eye brows

Today our system is 20 words long. Bin 3 = word 17. Now we want to expand 5 bins. Bin 3 = word 22.

We will continue with this method

XIC System_Clock[5].1 ONS Test_One_Shots[1] BST CTU Test_Counter[1] ? ? MOV Test_Counter[1].ACC Bin[0] NXB MOV Bin[11] Bin[12] MOV Bin[10] Bin[11] MOV Bin[9] Bin[10] MOV Bin[8] Bin[9] NXB MOV Bin[7] Bin[8] MOV Bin[6] Bin[7] MOV Bin[5] Bin[6] MOV Bin[4] Bin[5] NXB MOV Bin[3] Bin[4] MOV Bin[2] Bin[3] MOV Bin[1] Bin[2] MOV Bin[0] Bin[1] BND

Works
Easy for Joe to follow
Everything expands on the end
 
This is my 600th post in this forum over the last three years, most of them helping people like you who want some assistance with Rockwell equipment. I'll leave it to others to judge precisely where my head is at; but as a result of your peculiar behaviour I am resolved NEVER to bother answering another question from an anomynous "Guest" poster.

Well done.
 
Last edited:
Phillip,

I have not made the CLX plunge yet, but I will be doing a project in the late fall that requires it. I hope you and others will help me through the migration form PLC-5's to CLX's.

There is a saying here in the states: "No good deed goes unpunished".

Anyway thanks for all the input to the board, don't let one unregistered guest minimize all your past help to others.
 
Philip,
Don't pay attention to this rude guest, they come and go.
This thread is another vote for register posters only, who provided a valid email to a PRIVATE ISP, like it done on most of forums (no yahoos, gmails etc.)

Now technical side: I guess UP and DOWN is relative like location of US and NZ :p

I normally use a scheme adopted in most programming languages, were low numbers are on the bottom and higher numbers on the top.

RSlogix does not follow this scheme, so you and I got confused.
But in any case with overlapped arrays COP working correctly only one way.
 
PhilipW said:
It does not matter in the slightest whether the data goes UP or DOWN the sodding array, just as long as you know where to put it in the newest data and pull out the aged data when you want it.

This made me laugh 🍺

And i wouldnt worry about a rude guest, you gave them the answer and if they are not clever enough to understand it then perhaps they should not be playing at programming a CLX!
 
Up Up and Away

To shift words up, You will need 2 COP instructions to prevent filling the array with Array[0] value.
COP
Source = Array[0]
Dest = TEMPArray[0]
LEN = <Length of Array - 1>
COP
Source = TEMPArray[0]
Dest = Array[1]
LEN = <Length of Array - 1>

Hey...Contr_Conn...just discovered this. This works GREAT for shifting up...which is something I prefer to do in my current application. Thanks!!
 
hi i know this is an old thread but i am trying to do this word shift as suggested by Contr Conn, who said to have the length of the array as -1 but when i tried this i get an Error: Rung 5, COP, Operand 2: Immediate value out of range. any help would be appriciated
 
I think you misunderstood what Contr_Conn was trying to explain. The LEN of the COP instruction should be one less than the size of your array. So if you have Array as a DINT[20] and TempArray as a DINT[20] then the COP instructions should be:
COP
Source = Array[0]
Dest = TempArray[0]
Len = 19
COP
Source = TempArray[0]
Dest = Array[1]
Len = 19

Hope that clears it up.
 
This made me laugh 🍺

And i wouldnt worry about a rude guest, you gave them the answer and if they are not clever enough to understand it then perhaps they should not be playing at programming a CLX!

I agree only register posters only. Because of this I won post my solution a single instruction. But lets just say in involves an instruction we all know and love that has to do with bits and how you change gears in a manual car.

Wow I just noticed how old this tread was. I am referring to a BSL (Bit 0 to bit 1...) or BSR (Bit 31 to bit 30...) depending on which way you want to go. THE BSL can have a length DINT=32 bits so it shifts a whole word. The source bit would be bit 0 of element 0 of the array.
 
Last edited:
But lets just say in involves an instruction we all know and love that has to do with bits and how you change gears in a manual car...

...I am referring to a BSL (Bit 0 to bit 1...) or BSR (Bit 31 to bit 30...) depending on which way you want to go. THE BSL can have a length DINT=32 bits so it shifts a whole word. The source bit would be bit 0 of element 0 of the array.

All of that is true, but the OP here (years ago) was looking to move words.. not bits. Every time a BSL or BSR executes everything moves over one bit. In order to make this work with BSL or BSR you'd have to run the instruction 32 times (assuming the pertinent info was held in a DINT) for every time you wanted to shift one word's worth of information. I'm sure a couple of COP instructions is much simpler than what it would take to make that happen.
 

Similar Topics

I'm not a PLC programmer, so bear with me here ... I was making an AOI with a bunch of BOOL inputs and realized some of them were actually...
Replies
6
Views
1,785
I'm attempting to read tags from a 1756L81E(FactoryTalk Logix Echo) controller using the PLC4J api. I have one read and one write bool setup in...
Replies
10
Views
2,231
Hey All, I'm currently building a control system for a large building in a industrial setting. Doing lighting, vent, roof control, door access...
Replies
12
Views
3,441
I know there's the DTOS Function, but I have a value of "35" that is really "0035", and that's how I want it converted. Looks like the function...
Replies
2
Views
1,488
I am an Electric Engineer working as a maintenance engineer and manage some technician on the production hall now but in the past, I mostly focus...
Replies
12
Views
3,508
Back
Top Bottom