Moving Bits

Altair

Member
Join Date
Feb 2003
Posts
28
I'm using PLC 5/20 and a SLC 5/03 and RSLogix 5 pro.
I'm trying to take parts of words (N29:25/0-3 for example) and place them in a destination word (ie N48:0/0-3), but in the same destination word N48:0 I'd like to take bits from other words (ie N29:25/6-8) and place them in the destination word N48:0/4-6).
But I'm stumped... this is probably a very easy thing to do, but Cop/Mov don't seem to be doing the trick for me.
I've found that there are isolated groups of Fault bits (all together 53). These are all over the place (logic-wise). What I'm attempting to do is organize them in 4 words.



Thanks for any/all help.


Russ
 
I ve had a similar problem and got round it using a masked move (MVM) simply get all the bits you want and move them into your destination word with out afecting any other bits.

Bad explination I know if you look in SLC instruction help in RSlogix for MVM it explains it much better I always use a int file as mask and then you can view it as binary and just turn on the bits you wnat to keep..

:)
hope this helps Jezz
 
hi

Another method although not elegant programming that will work is to use one xic and ote per bit that you require.

So for bits (N29:25/0-3 for example)

xic n29:25/0 ote n48:0/0

xic n29:25/1 ote n48:0/1

xic n29:25/2 ote n48:0/2

(sorry can't post ladder)


regards

kevin
 
Hi there,

A quick explanation of mvm

||--------------------Mvm N25:0
mask
N48;0


N25;0 1111111111111111
mask 0000000000001111 always in hex = h000f
n48;0 0000000000001111

as you can see the zero's masked the other bits,this is how the masked move works,i hope this helps.
 
Hello everyone,
So if I want to mask move bits 0,1,4,6 it would look something like this:

Code:
1100101000000000
 and it will move these bits to the final destination..because the 1 enables the move while 0 masks it. 
but...
[code]
would it be possible to shift what is bit 4 in the original word and place it as bit 6 (for instance) in the destination word? Doing the OTE would work, just have to XIC the original bit. If I keep the faults grouped in some way it shouldn't get too confusing for someone else to figure out what I've done. (that's one of the things I'm trying to keep in mind while working this up).
 But ya gotta do what ya gotta do :) as they say. :)

Thanks for the help.. this masked move will definitely help on some of the fault mirror. The Xic-OTE seems like the best way to shift small packets of bits around.


Thanks,
Russ
 
So if I want to mask move bits 0,1,4,6 it would look something like this:
1100101000000000
and it will move these bits to the final destination..because the 1 enables the move while 0 masks it.

Standard convention starts labeling bits at the right so your mask would look like:

0000000001010011

But I think you have the idea

would it be possible to shift what is bit 4 in the original word and place it as bit 6 (for instance) in the destination word? Doing the OTE would work, just have to XIC the original bit.
This is not possible in a single command and trying to do it with bit shifts would probably get real confusing real fast.

I vote for your best bet as Kevin has suggested with XIC->OTE rungs for each bit you want. You can save it in a library file and then use it in all your programs :)
 
Last edited:
The PLC5 has a Bit Distribute (BTD) instruction which will do exactly what you want. Unfortunately it is not available in the SLC5.

I have copied the RSLogix description of the BTD instruction to explain how it works.

btd.jpg
 
Thanks everyone! What I'm currently doing on the Plc 5-20 is going to have to be done on a slc. Though since they are different units their faults are completely different. The Slc has at least 3 more faults than the plc program. So I'll probably use the xic-ote on the slc. But the BTD seems perfect for the plc application.
The updated logic should be finished this evening. I'll post it up when it's all done. (there will be a few more additions to what I've talked about, but those are pretty basic).




Thanks again everyone!
Russ
 
I just finished creating the logic with a few BTD commands. Aligning the bits is the foundation for the history section. The history section is part of the temperature deviation (it mirrors it).
If during any 3 hour block one or more of the faults occur they are recorded. That block (since a fault occured in it) is also recorded. Up to 10 blocks can be recorded (which is a heck of a lot of faults :)).
Attached is (what I hope to be) the finished product. Though invariably there will be adjustments.
Thanks everyone for your input and idea's. They were very helpful.



Russ
 
kevin combes said:

Another method although not elegant programming that will work is to use one xic and ote per bit that you require.

So for bits (N29:25/0-3 for example)
xic n29:25/0 ote n48:0/0
xic n29:25/1 ote n48:0/1
xic n29:25/2 ote n48:0/2

kevin

This is very suitable and fastest method for 5 bits.
 
In the fault mirror setup I used BTDs in conjunction with xic-ote and even a GEQ-Mov.
My only concern about doing all xic-ote is memory. There isn't a lot of it left in the processor, and I think that setting up a number of xic-ote combinations would chew up more memory than a BTD.
Then again I could be wrong, but it was fun playing with the BTD method.
For the first time ever I wrote out what I planned on doing and refined it before actually writing code. I used Notepad and Excel. It seemed a pain at first, but when it came time to actually writing the code it was easy as pie.
For the SLC processors (there are two I've gotta replicate what I've done here on) xic-ote is probably going to be the only way to go.
If only I could use a For Next loop hehehe...




Thanks again,
Russ
(I did make 2 slight adjustments to the logic, but they weren't related to fault history, just final touches and a spot of cleanup for something I had removed earlier). It is now finished. :):):)
 
Read BlockTranfer commands help ! It could be happend parallely with other program and result could be happend any time of program scan with some settings. Result is that program don't work as assumed.

For-Next and indiredt pointing needs stacking variables who don't shown in ladder itself and that is hard process for processor and takes 'mutch' time.
 
I can understand the for-next command taking processor time. Fortunately the next step of this process is to take the data I've created on the processor and place it on an excel spreadsheet.
For this part I will need to used nested for next loops and select case. The integer values that I'm going to be reading need to be changed back to binary, with each bit (well 53/64 of them) being a significant fault.
Though at this point I'm not sure if it would be easier just reading each individual bit, or if it would be better to create a function that extracts the high bits from the integers.
Has anyone worked on this and what are your thoughts?





Thanks,
Russ
 

Similar Topics

Hi Everyone, I'm working on a self assigned homework project on a RSL5K and I'm stuck. What I'm trying to do is move data from Dint_1 to Dint_2...
Replies
6
Views
2,428
Hey everyone trying to record time and date on one of our machines. But Status bits don't seem to want to be moved to the integer files I make...
Replies
4
Views
1,991
Hi Guys. Can anyone help me with this one??? I am using an Omron CJ1M,and i am transmitting control codes to a programmable power supply. The...
Replies
2
Views
2,287
I'm a Siemens person, and this is one of my first AB programs. The customer wants everything programmed in Ladder. I have a lot of data (3...
Replies
14
Views
213
Hello, I have a compact Logix plc and I have been task with configuring alarms into our SCADA when an Analog signal stops moving. The analog...
Replies
6
Views
235
Back
Top Bottom