EMHBH

MVM instruction.

6 posts in this topic

Hi, I'm new member to this fine forum, I tried to find the suitable room for my question but not sure that I did, so, excuse me if I posted my question in the wrong place. My question is about RSLogix 500 MVM instruction ( Masked Move ), where do we need it, and an example if possible. Thanks

Share this post


Link to post
Share on other sites
See link, http://www.plctalk.net/qanda/showthread.php?t=79074&highlight=mvm

Share this post


Link to post
Share on other sites
Thank you Mickey, This is what came to my mind, "MVM" is similar to "AND" instruction, or I'm wrong ?

Share this post


Link to post
Share on other sites
Its a filter. If the source is a one ( true) and the corresponing bit for the mask is a one ( true) then the destination will be true ( the source is passed to the destination). If the source is a zero (false) and the mask is a one (true) then the destination will be zero (false). The gate is open. If the mask is a zero (false) it effectively blocks (filters) the source from the destination. ( destination is unchanged)

Share this post


Link to post
Share on other sites
A good example of it's use is where you receive an integer (16 bits) from a device, where the first 8 bits are boolean status information, and the last 8 bits are a value like a status code. I want to get a hold of just that integer value, I can use the MVM instruction. e.g. N7:0 is the value I want to extract the value from N7:1 is wher I'm going to put the extracted value N7:0 is 0100 1011 0001 0011. I'm only interested in the last 8 bits: 0001 0011, which is decimal 19 --------------------------| MVM || Source: N7:0 || Mask: 2#0000000011111111 || Destination: N7:1 | --------------------------Note: the 2# before the mask value is to indicate that I'm entering a binary value. You can also enter it in decimal or hex but it's easier to see what's going on with the binary. N7:0 = 0100 1011 0001 0011Mask = 0000 0000 1111 1111N7:1 - 0000 0000 0001 0011You can see that N7:1 no contains only the last 8 bits - the ones that were marked with a 1 in the mask - and so now, N7:1 = decimal 19, which is what we were after.

Share this post


Link to post
Share on other sites
Mask simply specifies which bits are to be transferred (regardless if high or low). Equivalent function can be created using few basic instructions... TEMP1 = SOURCE AND MASK ; extract source bits based on mask TEMP2 = DESTINATION AND (NOT MASK) ; extract destination bits based on mask DESTINATION = TEMP1 OR TEMP2 ; combine the two parts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now