MVM vs. BTD RSLogix 5000 Instructions

jrsnydley

Member
Join Date
Dec 2014
Location
Minnesota
Posts
155
Hello everyone!

I am working on an existing system that contains a 1756-L73 controller, a 1756-DNB DeviceNet bridge, and a 2711-K3A5L1 PanelView Standard 300 with DeviceNet communication. The IO tags associated with the 1756-DNB are of the DINT data type. The tags in the PanelBuilder 32 software are of the INT data type.

In the code, I tried to do a masked move (MVM) of a constant value into bits 0-15 of the output from the DNB. For example, "3" gets moved to bits 0-15 of the output Local:1:O.Data[0] which is a DINT. I then used another masked move to move another fixed value to bits 16-31 of the same output Local:1:O.Data[0].

When I tested the logic, it would not write to bits 16-31 (I didn't test to see if it would write to 0-15) of the output. Even if I monitored the tag and manually put a 1 into those bits, it would change it back to a 0.

To make a long story short, I thought I would try the bit distribute (BTD) instruction instead of the MVM. It worked but it left me questioning why the MVM would not accomplish the same thing. Anyone have any ideas?

I thought maybe RSLogix configures a fixed value as a DINT and so it was letting bits 16-31 through because of the way the mask was set up and my value was so small (i.e. "3") that those bits were all zeros? That is the only guess I have.
 
I suspect there's some other logic conflict. Very carefully cross-reference the Local:1:O.Data[0] element and see if something's writing over your Output data tag.

The fact that manually "poking" values into that Output tag suggests that something is writing to it all the time. Many DeviceNet projects used a "DeviceNet Tag Generator" to auto-create logic that moves data from tags like "PV300_P01_Output" to Local:1:O.Data[0].

What was the Mask value when you did

MVM
Source: 3
Mask: ?
Destination: Local:1:O.Data[0]


If the mask was "3", or 16#0003, then only bits [0].0, [0].1, and [0].2 should have been affected. The other 29 bits in the word should have stayed at their last value.
 
Ken, I did try a cross-reference because I suspected something was overwriting it as well. The tag is not referenced anywhere else. My instructions were set up as follows:

MVM
Source: 3
Mask: 2#0000 0000 0000 0000 1111 1111 1111 1111
Destination: Local:1:O.Data[0]

MVM
Source: 5
Mask: 2#1111 1111 1111 1111 0000 0000 0000 0000
Destination: Local:1:O.Data[0]

So it is all making perfect sense to me now. If the logic reads the constant value of 5 as a DINT it would be:
2#0000 0000 0000 0000 0000 0000 0000 0101

So the 0's in bits 16-31 are being written to bits 16-31 in Local:1:O.Data[0] correct? However if the source tag were an INT it would write the value of bits 0 and 2 of the source to bits 16 and 18 of Local:1:O.Data[0]? So even when I manually change bit 16 to a 1 the logic from my MVM instruction is executed on the next scan and overwrites it with a 0?
 
I set it up this way because in PanelBuilder O:0 and O:1 are integers and so O:0 is Local:1:O.Data[0] bits 0-15 and O:1 is bits 16-31.
 
You are trying to move 2 INTs (INT0, INT1) into DINT Tag
I would use 2 BTD instructions
The first BTD: source =INT0 ,source bit =0 , destination =DINT Tag , destination bit =0 , lenght =8
The second BTD: source =INT1 , source bit = 0 , destination = DINT Tag ,destination bit =8 , lenght =8
 

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,256
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,426
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,250
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,262
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,236
Back
Top Bottom