Masked Move with UDT

kloc5

Member
Join Date
Apr 2014
Location
St Louis
Posts
25
Hello,

I am using a UDT to track status from two different indexing lines that merge into one. Essentially, one indexing line is the part, and the second indexing line is the container. The UDT has BOOLs for each of the status bits for both lines (part loaded, part inspection passed, container inspection passed).
When the part is loaded into the container, I wanted to merge these UDT tracking words, so that at the end I will have the status of the part in container and know whether or not it is a good or a reject.

When the two lines merge, if I copy the line1 tracking to the line2 tracking, I will lose the line 2 tracking that had already been set for the container (or have to copy individual bits from line 2 tracking to a temp buffer and then latch / unlatch those bits in the "merged" tracking)

Is there a way to do a Masked Move with UDT's to only copy part of the BOOLs from the UDT to another UDT of the same structure? Any alternative solutions?

Thanks!
 
Do you mean other than keeping the bits in a single integer (INT, DINT, etc.) and using MVM?


Each of the fixtures on the part indexer hold 4 parts each, and each position in the fixture (part) has 14 status bits. There are twenty indexes end to end and that is before the merge to the second indexer.

I have a UDT for the fixture, that is just 4 of the Position UDTs, and the position UDTs are Bools for the status bits.

Fixture UDT-----> Position 1 (Position UDT data type)
Position 2 (Position UDT data type)
Position 3 (Position UDT data type)
Position 4 (Position UDT data type)

Position UDT-----> Part Loaded (Bool data type)
Part Inspection Passed (Bool data type)
Container Inspection Passed (Bool data type)
....
....

The advantage I saw using the UDT with BOOLs was that the program would kind of be self-documenting, instead of having to comment hundreds of tracking bits (i.e. Fixture1.Position2.Part_Loaded)

Hope that makes sense.
Thanks!
 
yes, that makes sense.

what I meant was using a single integer in the UDT instead of all the bools, so merging is trivial, but then that self-documenting aspect is lost.
 
Each of the fixtures on the part indexer hold 4 parts each, and each position in the fixture (part) has 14 status bits. There are twenty indexes end to end and that is before the merge to the second indexer.

I have a UDT for the fixture, that is just 4 of the Position UDTs, and the position UDTs are Bools for the status bits.

Fixture UDT-----> Position 1 (Position UDT data type)
Position 2 (Position UDT data type)
Position 3 (Position UDT data type)
Position 4 (Position UDT data type)

Position UDT-----> Part Loaded (Bool data type)
Part Inspection Passed (Bool data type)
Container Inspection Passed (Bool data type)
....
....

The advantage I saw using the UDT with BOOLs was that the program would kind of be self-documenting, instead of having to comment hundreds of tracking bits (i.e. Fixture1.Position2.Part_Loaded)

Hope that makes sense.
Thanks!
There's a solution.

Create an overlay within the Position UDT consisting of:
Code:
Status    : DINT
Status0   : BOOL
Status1   : BOOL
Status2   : BOOL
...
Status31  : BOOL

I've attached a template UDT. Each of the 32 BOOLs target a unique BIT of the DINT.

You can open it in a text editor and modify its names and descriptions, then import it into your project. Or it can just be imported to get a feel for it.

  • 8/16-bit versions can be created by changing the DINT to SINT or INT and removing the excess BITs.
  • There's also an attribute to hide unused bits of the UDT.

yes, that makes sense.

what I meant was using a single integer in the UDT instead of all the bools, so merging is trivial, but then that self-documenting aspect is lost.

C'mon, drbitboy. ;)
 
Last edited:
Thank you for your help!

I've been playing with these overlay UDTs to see if they would work for our application. We are currently using RSLogix5000 v20. It makes me a little nervous that if we ever need to add a status bit to the overlay UDT, we would have to reimport the UDT and check all the tracking in the program, as Status.5 (Part_Loaded) is now Status.6 (Part_Loaded). Of course, I guess the status bits don't have to necessarily be in chronological order, so I could just add them at the end.

Is there a better way to do this? I was thinking that when the part is loaded into its container, I could copy the Line 2 (container) Tracking to a buffer, and then copy Line 1 (part) Tracking to the Line 2 (now merged) tracking and then copy the individual bits of the Line 2 (container) Tracking over from the buffer to the merged tracking. All this to avoid having to reimport overlay UDTs, while reducing the number of individual tracking bits that I have to copy over at the merge.

Seems like there has to be a better way.

Thanks!
 
I ended up staying with the UDT format, but I have another question related to this.

I would like to check if either the entire UDT is zero or possibly if a particular status bit (i.e. status bit 1) is off in each Position for each Station, without doing a branch of 100 XIO bits in series. I tried using an EQU to compare the Station UDTs to a Blank Station UDT that I had previously created for clearing the UDTs.

Station 1
Position 1
status bit 1
status bit 2
....
status bit 15
Position 2
status bit 1
status bit 2
....
status bit 15
...
Position 4
status bit 1
status bit 2
....
status bit 15


Any suggestions?

Thanks!
 
If you're using the overlay you can find a few options handy:
- use the base SINT/INT/DINT overlay target
- COP the UDT to a DINT and EQU DINT 0
 

Similar Topics

Hey I'm new to rs logic 5000 I have the basics but I'm getting confused with this mvm instruction. Can anybody bum it down for pls Thanx in advance
Replies
3
Views
4,889
So I'm using a 1769-L35E. I'm trying to move two INTS through Masked Move Instructions to create a DINT together. I'm fairly new to this so...
Replies
14
Views
6,780
can someone give me a plain english explaination of the MVM instruction and when to use it properly ...thank you ...
Replies
3
Views
3,812
What Does The "masked Move" Function Do?
Replies
2
Views
5,028
Whoever programed this micrologix used this masked move to delay a lift when it reached its upper limit (reed sw.) via a "thumb roll" pot.there...
Replies
8
Views
4,344
Back
Top Bottom