MVM (masked mov command)

seanfournier

Member
Join Date
Aug 2002
Posts
3
I'm having major trouble here people. What I need to do is take a 5 digit number 12345 (in one address N7:1(decimal)) and store different parts of it in different locations.

12 has to go to N7:2
34 has to go to N7:3
5 has to go to N7:4

I've tried using the MVM command (micrologix 1000)

source is
12345
mask is
?????
store in
n7:2

source is
12345
mask is
?????
store in
n7:3

source is
12345
mask is
?????
store in
n7:4

any idea how I'm going to accomplish this?
 
This should work for a SLC500. Whether it will apply to a Micrologix 1000, I don't know.

Integer divide N7:1 (12345) by 1000. The unrounded quotient (12) will be in S:14. The remainder (345) will be in S:13. Move S:14 to N7:2

Now integer divide S:13 by 10. Following the division, the unrounded quotient (34) will be in S:14 and the remainder (5) will be in S:13.
Move S:13 to N7:4 and S:14 to N7:3
 
Another way to do it would be to convert the integer to BCD (TOD instruction).

Then you can mask out the groups-of-4 bits you want, and then convert back from BCD to back to Integer (FRD)

Steve's way is much, much cleaner.
 

Similar Topics

can someone give me a plain english explaination of the MVM instruction and when to use it properly ...thank you ...
Replies
3
Views
3,809
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,260
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,430
hi all, i have another problem with my unity conversion from rslogix500. i have a MVM (masked move) that i need to program into my unity program...
Replies
2
Views
1,261
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...
Replies
12
Views
3,279
Back
Top Bottom