mvm instruction

rscott9399

Member
Join Date
Aug 2017
Location
in space
Posts
114
Seeing some irregular behavior with my MVM instruction
Either that or i dont get how it works? :)

I am moving an INT
Lets say for arguments sake the source is #16FFFF
So everything is on

I have tried a mask of 0 and a mask of FFFF

No matter what i put in for the mask it still passes all the bits

What am i doing wrong?

Studio 5000 31.01 with an L36ER if it matters
 
Lets keep this simple for a second

If you have a single bit
Lets say its at a high state = 1

and your mask is 1 what do you get == ?

if your mask is 0 what do you get ==????
 
Isn't a MVM basically an 'AND' instruction?

In the thread that gclshortt linked above, they get into a pretty heated debate about this before Ron Beaufort puts the issue to bed. It is a pretty interesting read. Here is the end result of the conversation they had.

OK - let's get some sanity here. AB has a move (MOV) instruction. They also have an AND instruction (which Terry also labels as MASK). Finally they have the Masked Move (MVM) instruction as described above. Apparently the operations performed by the MVM were wanted enough that AB supplied it as an additional instruction. If you want to do the MASK instruction which Terry describes, just do the AND instruction and be done with it.


By the way, I love your signature! :ROFLMAO:
 
back to the present OP's simple question in his Post #2 ...

If you have a single bit
Lets say its at a high state = 1

and your mask is 1 what do you get == ?

the answer is: "you'll get a 1 in the Destination bit" ...

if your mask is 0 what do you get ==????

well, that depends ...

if the Destination bit started out with a 1 – then the Destination bit will STAY a 1 ... but ... if the Destination bit started out with a 0 – then the Destination bit will STAY a 0 ...

in simplest terms – a ZERO in the MASK will "block" the move operation – and will therefore leave the corresponding bit in the Destination UNCHANGED ...

so no, an MVM is not quite the same as an ADD ...

side note:

just one more class to teach until I retire ... I'm going to miss this sort of stuff ... hard to believe that material that I wrote 14 years ago is still being useful today ...
 
Last edited:
We had an in instructor that helped us with a somewhat silly illustration:

Code:
MVM:

0001 1000 0001 0101   source
1111 0000 1111 0000   mask
0001 uuuu 0001 uuuu   result

u means unchanged

The mask work like this: "The fat zeroes in the mask block the data so the destination bits remain unchanged. The skinny ones in the mask let the source bits slip through and replace the bits in the destination."
 
We had an in instructor that helped us with a somewhat silly illustration:

the illustration's not "silly" - if it helps you remember the facts ...

I've got students from years ago who tell me that they still remember - and use - some of my "silly" statements like:

go see Ethel
shake the paper
send Darling to her mama's house
who's his daddy?
shoot the rider - not the horse
and so on ...

the fact is that MOST of my students don't work with the PLC software day-in and day-out ... it might be months (or longer) between troubleshooting sessions where they need to crank this stuff up and go online ... in the meantime they've got motors to replace, wires to pull, bearings to grease, and other "manly" chores to do around the plant ...

so it might sound silly to some - but if it helps the students remember the facts, then I say "party on" ...
 
Last edited:
My high school physics teach taught us Ohms law like this:

"I are equal to E, not You are equal to E, but I R equal to E." He said so many times until the whole class groaned at it, but no one missed any ohms law questions on the test.
 

Similar Topics

In an effort to configure BCD switches on my CompactLogix input module. I thought the MVM (masked move), in Studio 5000, instruction might be the...
Replies
12
Views
4,220
Good Morning Sirs, I'm using a MVM instruction to turn on/off my PLC's outputs. I'm using, meanwhile, the outputs O:2/0 to O:2/3. Then I use my...
Replies
2
Views
2,073
Hi everyone, I want to ask you guys if I can use an output digital word (O:6, for instance) as the Dest parameter of a MVM instruction on a SLC...
Replies
5
Views
4,931
I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,250
Hi All, I know this is probably a strange question, but does anyone know what would be faster between a MVM and AND instruction? I...
Replies
5
Views
1,424
Back
Top Bottom