You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old May 12th, 2004, 04:57 PM   #1
Guest
 
Posts: n/a
Move Thru Mask

Could someone here give me an simple "read as not too techie" explantation of how the move thru mask instruction actually works.
if not too much trouble possible an example or two of practical uses of the same. I can't quite get the A.B. explanation in rsl. Any help would be apreciated
  Reply With Quote
Old May 12th, 2004, 05:39 PM   #2
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
0000 1010 SOURCE

0000 0011 MASK

0000 0010 RESULT


The Source Word and MASK are "AND"'d to produce the result.

That is,... SOURCE "AND" MASK = RESULT

Simple enough?

The bits in the MASK that are ON indicate the bits that you want to see from the SOURCE.


(18)

Last edited by Terry Woods; May 12th, 2004 at 05:41 PM.
  Reply With Quote
Old May 12th, 2004, 06:07 PM   #3
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is online now
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 5,447
If this is the MVM command we're discussing, another aspect of the command ,not clearly shown in Terry's example, is that bits in the result which are not covered by the mask are preserved. A pure AND would reset the non-masked bits in the result. So the actual equation would be:

RESULT = (RESULT AND (NOT MASK)) OR (SOURCE AND MASK)



SOURCE 0101 0101
MASK 0000 0011
ORIGINAL RESULT 1010 1010
RESULT 1010 1001


  Reply With Quote
Old May 12th, 2004, 06:14 PM   #4
Allen Nelson
Member
United States

Allen Nelson is offline
 
Join Date: Apr 2002
Location: West Chester, PA
Posts: 1,368
Oh no, not again.

Terry, we've gone over this before. http://www.plctalk.net/qanda/showthr...=&threadid=731

The only way that a MASK is like an AND is if the SOURCE word and RESULT word are the same memory address. Otherwise, it's quite different.

1) You have to pay attention to what the RESULT memory address was before the instruction with the mask is used. If the mask has a '0' in that bit location, then RESULT bit location will remain unchanged, regardless of the data in the SOURCE.

2) If the mask has a '1' in a bit location, then the RESULT bit location will be exactly the same as the Source bit location. Not AND'ed, but MOVED.

I think of a mask like a filter. Only the data that I want (both the ones and zeros) will come through; the rest stays behind.



Where may they be used? Any place that you need to pick out select bits from within a word:

• Picking out select alarms from within a word of alarms, to drive a horn if the result <> 0

• Splitting an ASCII character word pair into its two individual ASCII characters, so that they can be converted into something else (Real numbers, Hex equivalents).

• Used with Peter's tidbit technique, to count the number of bits in a word quickly and efficiently (Repeatedly masking out the lowest set bits).

• ???
__________________
©¿©¬
  Reply With Quote
Old May 12th, 2004, 06:46 PM   #5
BOWRIDER
Member
United States

BOWRIDER is offline
 
BOWRIDER's Avatar
 
Join Date: Mar 2003
Location: FLORIDA
Posts: 58
Thanks all for your responses. I am going to study this a little, (as I get time), Looks facinating. Got to go for now, machines need me.
Thanks again!
  Reply With Quote
Old May 12th, 2004, 07:23 PM   #6
Terry Woods
Member
United States

Terry Woods is offline
 
Join Date: Apr 2002
Posts: 3,170
Allen,...

This is definitely not a case of "A Rose is a Rose, by any other name".

It's not my fault that AB does not seem to know what a MASK (Mask Operation) is.

They have obviously decided to Ba$tardize the Mask Operation into something... well... A-Ba$tardized. (Hello, Ken!)

The MASK Operation is, and always has been, just as I have described, since the age of programming was born. A MASK is a "filter"... just as it is at a masqarade-ball... the EYES show through... the rest of the face doesn't... by design!

Look at what Bernie said... (I assume he knows what he speaks of.)

What he described ain't no MASK Operation... at least not your everyday, run-of-the-mill MASK Operation.

Something that programmers and programmer-wanna-be's need to know is...

Your basic MASK Operation is performed by using a simple "AND" instruction as I have described.

ANYBODY can explicitly do the extra steps that A-B has included in their particular ba$tardized version of the MASK Operation.

So... it's an extra step or two, but you will have performed a "REAL" MASK Operation in the process, and come to know that there are ways to do things besides marching to the A-Ba$... tune!

WE ARE TALKING COMPUTERS HERE, PEOPLE!!! ...Not just PLC's according to A-B.


(57)
  Reply With Quote
Old May 12th, 2004, 07:51 PM   #7
Eric Nelson
Lifetime Supporting Member + Moderator
United States

Eric Nelson is offline
 
Eric Nelson's Avatar
 
Join Date: Apr 2002
Location: Randolph, NJ
Posts: 4,324
I see a tangent looming...

Quote:
Originally posted by Terry Woods
WE ARE TALKING COMPUTERS HERE, PEOPLE!!! ...Not just PLC's according to A-B.
Yes, you are, but notice the thread starter's question:

Quote:
Originally posted by some unknown guy
Could someone here give me an simple "read as not too techie" explantation of how the move thru mask instruction actually works.
if not too much trouble possible an example or two of practical uses of the same. I can't quite get the A.B. explanation in rsl. Any help would be apreciated
As Bernie pointed out, it seems that this guy is trying to understand the MVM instruction, which A-B calls the "Masked Move" instruction (Note the addition of the word MOVE). A-B does not have a "Mask Without Move" instruction as far as I know...

beerchug

-Eric
  Reply With Quote
Old May 13th, 2004, 03:11 AM   #8
Gerry
Member
New Zealand

Gerry is offline
 
Join Date: Jun 2002
Location: Auckland
Posts: 1,141
Quote:
Terry, we've gone over this before.
Quote:
It's not my fault that AB does not seem to know what a MASK (Mask Operation) is.
I wonder whose fault it is that Terry Woods can't seem to comprehend what a MOVE WITH MASK operation is?

(111)
  Reply With Quote
Old May 13th, 2004, 09:48 AM   #9
bernie_carlton
Lifetime Supporting Member + Moderator
United States

bernie_carlton is online now
 
bernie_carlton's Avatar
 
Join Date: Apr 2002
Location: Yakima, Washington
Posts: 5,447
OK - let's get some sanity here. AB has a move (MOV) instruction. They also have an AND instruction (which Terry also labels as MASK). Finally they have the Masked Move (MVM) instruction as described above. Apparently the operations performed by the MVM were wanted enough that AB supplied it as an additional instruction. If you want to do the MASK instruction which Terry describes, just do the AND instruction and be done with it.
  Reply With Quote
Old May 13th, 2004, 04:33 PM   #10
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 4,532
be careful what you ask for ...

here’s my best shot at the
Quote:
... not too techie ...
explanation that you asked for ...

first of all ... here is a breakdown of all eight possible bit combinations for the source, mask, and destination entries for a MVM (Masked Move) instruction ...

[attachment]

in column A ... the 0 in the source wants to move down to the destination ... but it can’t because there’s a 0 in the mask ... the 0 in the mask disables the move ... so the 0 which was already in the destination does not change ... the final result of column A is still a 0 ...

in column B ... the 1 in the source wants to move down to the destination ... but it can’t because there’s a 0 in the mask ... the 0 in the mask disables the move ... so the 0 which was already in the destination does not change ... the final result of column B is still a 0 ...

in column C ... the 0 in the source wants to move down to the destination ... and it can because there’s a 1 in the mask ... the 1 in the mask enables the move ... so the 0 that was already in the destination gets overwritten by the 0 from the source ... the destination does not APPEAR to change ... the final result of column C is still a 0 ...

in column D ... the 1 in the source wants to move down to the destination ... and it can because there’s a 1 in the mask ... the 1 in the mask enables the move ... so the 0 which was already in the destination is overwritten by the 1 from the source ... the final result of column D is now a 1 ...

in column E ... the 0 in the source wants to move down to the destination ... but it can’t because there’s a 0 in the mask ... the 0 in the mask disables the move ... so the 1 which was already in the destination does not change ... the final result of column E is still a 1 ...

in column F ... the 1 in the source wants to move down to the destination ... but it can’t because there’s a 0 in the mask ... the 0 in the mask disables the move ... so the 1 which was already in the destination does not change ... the final result of column F is still a 1 ...

in column G ... the 0 in the source wants to move down to the destination ... and it can because there’s a 1 in the mask ... the 1 in the mask enables the move ... so the 1 which was already in the destination is overwritten by the 0 from the source... the final result of column G is now a 0 ...

in column H ... the 1 in the source wants to move down to the destination ... and it can because there’s a 1 in the mask ... the 1 in the mask enables the move ... so the 1 that was already in the destination gets overwritten by the 1 from the source ... the destination does not APPEAR to change ... the final result of column H is still a 1 ...

continued in next post ...
Attached Images
File Type: jpg mvm.jpg (12.5 KB, 475 views)
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.

  Reply With Quote
Old May 13th, 2004, 04:34 PM   #11
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 4,532
you asked for an example ... this ladder demonstrates a fairly common use of the MVM (Masked Move) instruction in an SLC processor ... if you’re interested seeing it done in a PLC-5 processor, then post again ...

the task is to take the hours and minutes readings of the SLC’s wall clock and show them on a common four-digit 7-segment LED display ... think: “alarm clock” type readout ... this type of display is often wired to a 16-point output module ... the signal is usually sent over in a BCD (Binary Coded Decimal) format ... we’ll use military (24-hour) format for the hours reading ...

[attachment]

note that the decimal value "5155" which appears at output O:3.0 would be displayed as "1423" in the readout's BCD format ... that's the "14" for the hours (2:00 pm) and "23" for the minutes ...

if you have any questions about this program post again ...

continued in next post ...
Attached Images
File Type: jpg mvm ladder.jpg (100.0 KB, 465 views)
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.


Last edited by Ron Beaufort; May 13th, 2004 at 04:49 PM.
  Reply With Quote
Old May 13th, 2004, 04:36 PM   #12
Ron Beaufort
Lifetime Supporting Member
United States

Ron Beaufort is offline
 
Ron Beaufort's Avatar
 
Join Date: Jul 2002
Location: Charleston, SC
Posts: 4,532
and here’s the secret handshake on how to decipher any “Mask” entries that you might run into in a ladder logic program ...

consider the example “0E7A3h” ...

first ... the “h” at the end stands for “hexadecimal” ... ignore it for now ...

next: the “0” at the beginning is just there to confuse you ... don’t let it ... ignore it for now ...

that leaves “E7A3” as our mask ...

now find an UNUSED integer in the processor’s memory ... post again if you’re not sure how to tell if the integer is unused ... now change the radix to “Hex/BCD” ... type in the mask value ... now change the radix to “Binary” ... now you’ll see the mask’s binary bit pattern (example: “1110011110100011”... note: you can even do this offline – you do not need a processor to use this conversion feature ...

[attachment]

note that a mask of “0FFFFh” translates as “all bits enabled” ... the mask “0FF00h” (used in the Hours/Minutes program above) specifies “move the bits at the high end of the word (bits 8-15) ... but not the bits at the low end of the word (bits 0-7)” ...

let us know if you need any more detail ...
Attached Images
File Type: jpg mask.jpg (44.7 KB, 455 views)
__________________

2-B ?
Best regards, ----+----] [----+------------( )----
Ron | |
PLC Training Boot Camp | 2-B |
+----]/[----+

I once was lost, but now am found, was blind, but now I see.


Last edited by Ron Beaufort; May 13th, 2004 at 04:44 PM.
  Reply With Quote
Old May 13th, 2004, 07:39 PM   #13
bob1371
Member
United States

bob1371 is offline
 
bob1371's Avatar
 
Join Date: Mar 2003
Location: Southern Indiana
Posts: 226
Ron

Very well put. I have never actually used the Masked Move instruction but have seen it often. Although I have never had to completely decode it, I think I can now. Another great post that will be saved in my fav's

thanks,
Bob
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
5/03 number will not move to N file Greg Webb LIVE PLC Questions And Answers 16 December 21st, 2004 11:04 AM
GE Fanuc ethernet MOVE commands Kirkamorey LIVE PLC Questions And Answers 7 June 21st, 2004 09:26 AM
Building an S7 Array Move Questions DesertDog LIVE PLC Questions And Answers 19 June 17th, 2004 09:51 AM
Need help on EV Move utility for activation key using ICOM version 6.19 for PLC2. John Salazar LIVE PLC Questions And Answers 11 April 15th, 2004 02:58 PM
Batch move markers to array cmulder LIVE PLC Questions And Answers 0 February 27th, 2003 02:21 AM


All times are GMT -5. The time now is 01:25 PM.


.