AB copy bits from one word to another

hannibalevivo

Member
Join Date
Jan 2008
Location
Salamanca
Posts
15
Hi, I'm starting with the ladder logic programming and I want to enssure if the following bitwise operation is correct or not.

I want to copy B9:12/12-9 bits to B3:11/14-11

Here is the sequence of instructions to do this:

CLR B3:11
MVM Source: B9:12 Mask: 1E00h Destination: B3:11
MUL Source A: B3:11 source B: 4 Destination: B3:11
(left shift, 2 positions)

Thanks in advance
 
Last edited:
hannibalevivo said:
Hi, I'm starting with the ladder logic programming and I want to enssure if the following bitwise operation is correct or not.

I want to copy B9:12/12-9 bits to B3:11/14-11

Here is the sequence of instructions to do this:

CLR B3:11
MVM Source: B9:12 Mask: 1E00h Destination: B3:11
MUL Source A: B3:11 source B: 4 Destination: B3:11
(left shift, 2 positions)

Thanks in advance
Hi hanni:
Since you´re only copying four bits 12-9 to 14-11 why don´t you copy one by one it´s going to take only four rungs.
Example:
xic [B9:12/12]-------- OTE (B3:11/14)
xic [B9:12/11]-------- OTE (B3:11/13)
xic [B9:12/10]-------- OTE (B3:11/12)
xic [B9:12/09]-------- OTE (B3:11/11)
 
I'm starting with the ladder logic programming and I want to ensure if the following bitwise operation is correct or not.



if we assume (gosh I hate that word) that all of the OTHER bits in word B3:11 are to be cleared to a ZERO status, then the code that you posted appears to do what you said you wanted ...



but ... since you’re just starting out, you might also be interested in going one step deeper - and try moving the same four bits into B3:11/15-12 ... in that case, the MUL that you used to “shift” the bit pattern is going to prove “onerous” - and the simple rung-by-rung approach suggested by my distinguished colleague widelto is likely to prove much more reliable ...



in any case, the rung-by-rung approach is probably going to be a lot easier for a maintenance technician to understand whenever a troubleshooting problem eventually pops up ...



good luck on your studies ...
 

Similar Topics

Hey everybody, I have a bunch of bits used for diagnostics all compiled into a couple of DINTS. I have an x-ref sheet in Excel that aligns...
Replies
8
Views
1,877
Hi All, As a precaution my company has been collecting copies all the HMI and PLC programs. I have recorded copies of most of our sites...
Replies
0
Views
56
I have 2 7cp476 plcs. How can I copy one of them and install it somewhere else?
Replies
0
Views
76
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
145
Hi everyone I'm in a bit of a conundrum, I've been trying to get this HMI on our machine and I am unable to retrieve it. Device Delta Model...
Replies
10
Views
907
Back
Top Bottom