Why would I implement a MEQ instruction compared to using AND?

Dave85

Member
Join Date
May 2011
Location
Florida
Posts
13
What's the difference or benefits of using a "MASKED EQUAL" compared to using "AND" instruction? A "MASKED EQUAL" instruction is basically an "AND" instruction, so what's the difference? In the example below I got the same results

Ex.
MASKED EQUAL:

Source: 0000 1100 1100 1111 = 3279
Mask: 0000 0000 1111 1001 = 249
Compare:0000 0000 1100 1001 = 201

AND:
Source A: 0000 1100 1100 1111 = 3279
Source B: 0000 0000 1111 1001 = 249
Destination: 0000 0000 1100 1001 = 201
 
A "MASKED EQUAL" instruction is basically an "AND" instruction, so what's the difference?
This is not correct. In an AND instruction you get a 0 as result when one of the bits in the AND is 0. In the MEQ instruction on the other hand, if there is a 0 in the mask this means the bit in the destination will not be changed. If it was 1 before, it will remain 1, if it was 0 before, it will remain 0. The difference between the two instructions lies therefore in the situation of the destination BEFORE the instruction as carried out. You're assumption is right IF AND ONLY IF the destination was all zeros on beforehand.

Kind regards,
 
Thanks moggie, I was clearly referring to the masked move instruction and not to the masked equal. Your post reminded me of that.

Kind regards,
 
What's the difference or benefits of using a "MASKED EQUAL" compared to using "AND" instruction? A "MASKED EQUAL" instruction is basically an "AND" instruction, so what's the difference? In the example below I got the same results

Ex.
MASKED EQUAL:

Source: 0000 1100 1100 1111 = 3279
Mask: 0000 0000 1111 1001 = 249
Compare:0000 0000 1100 1001 = 201

AND:
Source A: 0000 1100 1100 1111 = 3279
Source B: 0000 0000 1111 1001 = 249
Destination: 0000 0000 1100 1001 = 201

Technically if the Bit is Zero in the mask then it is "not looked at" so it dosn't care what state the Source is in. But the result would be the same. Both have to be a "1" to get a "1".
 

Similar Topics

Let's say I have an inverter fed three phase induction motor drive where in the braking phase (when the motor operates in a generator mode) the...
Replies
2
Views
142
I want to improve a semi custom product I am delivering to a customer with implementation of safety relays. The system is fairly simple with just...
Replies
5
Views
585
I'm struggling to implement the test case which is highlighted. What ends up happening is the servo starts when I turn the cycle on, but it...
Replies
3
Views
1,070
I am trying to implement FIFO for filling tanks in the order it went empty in easysoft or some of you might know it by easydoft 7. I am trying to...
Replies
2
Views
2,313
Dear friends, I'm using Mitsubishi FX3G PLC and GxWorks2 Software for programming. I need to implement 10 power X (X is a +/- floating value)...
Replies
2
Views
1,070
Back
Top Bottom