AB SLC 5/03 - MOVE with OFFSET?

rlmts

Member
Join Date
Jul 2003
Location
Newport, S.Wales, UK
Posts
120
Hi!

Scratching my head here?!

I wanted to move a group of bits from one word to another - with a bit 'offset' (Using AB SLC 5/03)

How would you move a group of bits from somewhere in the middle of one word to the lowest end (lsb) of another word?

Eg:

Need to copy bits /5 thru /10 of word B3:5 to N7:5 (but offset)

MoveBits.jpg


Would you use individual rungs to energise N7:5/bits, bit by bit from B3:5/bits?

Or is there a smarter 'mathematical' method? (move with an offset?)

There's the obvious 'move with mask' but that just puts the values into the same bit positions.

Regards Richard
 
Hi Greg,
Yep, I suppose you are right... just thought I was missing out on a more universal method, whether it be 2 bits or 14 bits, by manipulating the words in one or two rungs.
Thanks for the reply Greg.
 
Whilst GIT has posted a solution, never the less as with any solution, precautions are needed, as was pointed out.

Is there not an instruction available in the Rockwell library that could do this task? I am not a AB user, but in the family that I use, there is plenty of instructions for some of the tasks that can be constructed using the fundementals.

only a few pesos worth...
 
Sure there are, such as BSL, BSR... however, the execution times of these instructions may outweigh the "old and bulky" way of doing it simply with discete bits.

Not to mention the guideline I give any of my guys when they are laying out any type of new installation - how do you want this to look a few years from now when you have to come back and work on it? Will you remember why you did it this way? Wil the guy who takes this project over be able to figure out what you did?

I have LOTS of situations where simple and repititious has won out over snazzy and shiny, simply because of that reason.
 
rlmts said:
Thanks 'GIT' That's quite neat!
Will I have to watch for 'divide into zero if B3:5 bits are all zero?
Rich.

I've never heard of 'divide into zero' as any kind of critical error. You just get zero as the correct answer.
 
devide by zero will give you positive infinity not zero hence why its a problem error that can potentially error on any programming language. However in this case I don't believe you need to worry about it.
 
Last edited:
Just loked it up you may need to worry about the devide by zero if it does occur it will set flag S:0/1 and S:5/0 (overflow)
 
GIT's logic would only divide into zero, not by zero.

Shouldn't be a problem other than has been mentioned as far as remembering what you did and why five years from now. I have some of that right now. A year ago, one of our branches built a machine and sent it to us with the programmer so we could straighten it out. The programmer was in over his head and while the machine worked, it was difficult for the operators to setup. I basically rewrote everything explaining what I was doing and why and everyone was happy. Even the original programmer because he put learning something above his feelings. He took the program back with him, built another machine and added a few rungs to operate a solenoid valve. When we got the machine, there were a few problems and when the tech hooked up the laptop, the rung description offsets were wrong causing him confusion. Imagine what this would have been like were the rung descriptions missing? When I went to help, even I was confused until I corrected the rung offset.

Sorry to get so off topic, but I see these posts quite a bit and while it may be nifty to eliminate a rung or three here and there, sometimes it is still best to keep it simple.
 
Thanks for your input on this everyone!
I've taken note and done it the 'old' way! (rung-by-rung read/write)
A few of your comments hit a nerve (I sometimes don't understand my old code!)

I have to admit I do like the challenge of creating a smart bit of code (it's like solving a puzzle!) But more often than not I guess it really isn't very smart at all!

Thanks again, Richard.

PS. although it may not create an error, isn't 0/<number> an infinately small number? Just as <number>/0 is an infinately large one?
 
tomalbright said:
The AB will set a minor fault on an arithmetic error. As long as you know what the error is, just... ignore it.
It will set minor error but if you don't reset the error yourself prior to end of scan won't the program stop ?
 

Similar Topics

Hi I am home doing prep for a project in work next week no access to plc,anyway question is I have a slc5/04 with a DCM communicating with a 5/40...
Replies
7
Views
1,817
How difficult will it be to move an AB SLC 5/05 processor programming to the new ControlLogix 1756-L55? We have an application already written...
Replies
2
Views
4,734
I’m attempting to send a temperature from a SLC-5/02 to an EZiMarquee display. The vendor said to use a MSG instruction to send the data to the...
Replies
1
Views
86
Hello all. I have a few SLCs in my plant and of late we've seen a weird issue: The system will be running normally and then randomly the outputs...
Replies
2
Views
100
I am working on setting up a Prosoft Datalogger model PLX51-DLplus-232. This unit will be collecting data from a SLC 5/05 on the DB9 port set to...
Replies
3
Views
103
Back
Top Bottom