mvm & Multiple timer presets

marley

Member
Join Date
Feb 2013
Location
oregon
Posts
1
As part of a homework assignment I am trying to load multiple presets through a masked move. Previously, I was able to do this with a limit and a MOV using 1 timer. There were 9 preset changes then. Now my task requires a MVM to accomodated the additional size & choices. I am too close to the forest to see the trees. :sick:
 
In RSLogix, the key is to determine what mask bits you need for each MVM. Mask out all bits that you do not want to change for EACH preset operation. For example, if you have a 16-bit word with a Preset in bit 2, (position 3) that you want to change (but do not want to change any other bit during this particular MVM), then your mask should be Binary 0000 0000 0000 0100 (Decimal 4, or Hexadecimal 0004). To set bit 2, MVM "4" (or "-1") through mask 4 to the destination. To reset bit 2, MVM "0" through mask 4 to the destination.

Mask is the address of the mask through which the instruction moves data. The mask can also be a hexadecimal value. You can enter the value in binary, decimal, or hexadecimal. RSLogix500 will make any necessary conversion and display the hexadecimal value.
Rockwell Software
 
Last edited:
Perhaps the homework assignment says to use a Masked Move MVM instruction just so that you can learn what it does.

I personally cannot see a need to use a MVM to load Timer presets (with one exception I will mention later).

When dealing with Masked data, try not to think of them as decimal numbers, or you will get confused. MVM comes into its element when dealing with bit patterns, and is often used to "look-at" specific bits in an input "word", or to modify only specific bits in an output "word".

The essential thing is that Masked instructions don't care (inputs), and don't change (outputs) any bits where the mask bit is a "0"

An example :

you have a jig that a robot places one of 3 parts into...
the jig has 7 sensors that tell the system which part has been placed, so that it knows what to do with it...
those sensors are wired into an input module containing other inputs, not relevant to the 7 sensors...
you need to extract the sensor inputs and decode them somehow, so you can use a MVM to read the input "word" as a whole, and mask the other input bits that aren't relevant...
now it is easier to "compare" what you have against fixed data (constants) at the word level, without having to build a much larger bit-level matrix to decide what part is present.

The exception I mention above.... Many people use some maths to determine a preset for a Timer. Sometimes that calculation can give a negative answer, and if that negative number gets loaded into a Timer Preset (or Accumulator) with a MOV, the next time it is scanned, the processor will Major Fault.

So some people use a MVM, masking off the sign bit, and no-one knows that the process is happily running with a positive time delay, when the maths said it should be less than zero.

Good "housekeeping" i.e. belt and braces range-checking is good practice.
 

Similar Topics

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
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,322
Back
Top Bottom