primary purpose of a masked move

Oh yeah... my old friend Move with Mask...

AB's Move with Mask is nothing more than a bit-wise "pass-gate".
It simply allows certain, specified bits in one value to overwrite the corresponding bits in another value.

Case-1 Case-2 Case-3 Case-4
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Value_A 0 1 0 1 | 0 1 0 1 | 0 1 0 1 | 0 1 0 1
Mask 0 0 0 0 | 1 1 1 1 | 1 0 1 0 | 0 1 0 1
Original Value_B 1 1 1 1 | 1 1 1 1 | 1 1 1 1 | 1 1 1 1
Resulting Value_B 1 1 1 1 | 0 1 0 1 | 0 1 0 1 | 1 1 1 1


The Mask determines which bits in the source (Value_A) are allowed to "paint" the corresponding bits in the destination (Value_B).

Regardless of what the original value of Value_B is, Value_B has a value of some kind... even if that value is 0000.

These examples show that Value_B already has a value of 1 1 1 1. However, bear in mind that 0 0 0 0 is also a valid value!

So... in Case-1, the Mask indicates that NONE of the source bits are allowed to "paint" the corresponding destination bits. A "0" in the Mask means "Paint is Not-Permitted" while a "1" in the Mask means "Paint is Permitted". After the operation the value of Value_B remains the same.

In Case-2, the Mask indicates that ALL of the source bits are allowed to "paint" the corresponding destination bits. After the operation the value of Value_B is the same as Value_A.

In Case-3, the Mask indicates that bits 1 and 3 are allowed to "Paint" the corresponding bits in the destination. After the operation the value of Value_B becomes 0 1 0 1.

In Case-4, the Mask indicates that bits 2 and 4 are allowed to "Paint" the corresponding bits in the destination. After the operation the value of Value_B remains the same, 1 1 1 1.

I find it very sad indeed when I see an AB programmer working on a non-AB PLC and he is beside himself because, when needed, he finds there is no Move with Mask instruction available in the particular PLC. So sad.

Especially since, if they were to look in the AB Manual to see how AB executes the function in Statement List they would see that AB Statement List does it like so...

Value_B := (Value_B AND NOT_MASK) OR (Value_A AND MASK)

Having a particular tool to do a particular job is nice... but how do you do the job if you don't have the particular tool?

Going back to Tim's post about the hammer... If you need a hammer and you have a hammer, fine. However, if you need a hammer and you don't have a hammer... what now?

Anybody that says they have NEVER used anything but a hammer when a hammer was called for is a bald-faced liar.

It is far more beneficial for programmers to understand the nature of DIGITAL LOGIC than it is to only understand the AB-way of using logic. After all, even AB has to work with the fundamental rules of logic and logic manipulation to produce particular results. If they build a function to handle a particular set of operations, fine. But a programmer NEEDS to understand how that result is really developed!

It reminds me of some kids these days that can't multiply or divide because they don't have their calculator or the batteries are dead or whatever.

I used to say, "If you can program any PLC you can program all PLCs."

These days, regarding some programmers, I realize that is not necessarily true... DAMN! That's sad... Who is going to develop the future calculators?
 
Another example. 16 bit input card, the 4 least significant bits are used to input a BCD switch. The remainder are normal inputs.

Mask out the 12 most significant bits and move the BCD switch inputs to a channel to be used in another section of program.

You can now use the BCD figure for whatever and the other 12 bits as normal inputs.
 
Jiri

The trouble with students is they do not know it all and therefore ask ignorant questions.

Sorry
I just learned 1 + 1 = 2, and here you are talking multiplication.

I can sort of see what you are saying but do not know enough to understand it yet.

Am more than open to you giving me some homework assignments but keep it at 2nd or 3rd grade if you can

Thanks for the help

Dan Bentler
 

Similar Topics

Hi, does anyone know how to tell in Aveva InTouch (v2020) whether the primary or secondary data source is active (i.e is failover active or...
Replies
3
Views
605
Does anyone have any experience in this? I have a lead lag pump setup for water that is maintained by pressure using VFDS, the idea is to have...
Replies
6
Views
1,849
Hi All I have several FactoryTalk HMI servers that are sharing one ODBC data source for data logging in Oracle. But when I'm running...
Replies
0
Views
1,276
According to UL, NEC, OSHA, etc. Do machine primary disconnects have to be switchable from outside the panel? Or can I have a din rail mount...
Replies
6
Views
1,669
Good afternoon all, I'm looking at the PSB24-120S-3 power supply from automation direct. The recommended circuit breaker size on primary size is...
Replies
13
Views
6,873
Back
Top Bottom