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 September 13th, 2018, 10:14 AM   #1
RBergmann
Member
United States

RBergmann is offline
 
RBergmann's Avatar
 
Join Date: Jun 2002
Posts: 248
BCD with MVM Instruction

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 way to go. So, below is the way I configured two BCD switches on the same input module. I do not yet have a PLC to validate.

*******************
First BCD device using inputs:
I:2/1
I:2/2
I:2/3

MVM
Source Local:2:I.Data
2#0000_0000_0000_0000
Mask 14
Dest BCD_Wash1

*******************
Second BCD device using inputs
I:2/9
I:2/10
I:2/11

MVM
Source Local:2:I.Data
2#0000_0000_0000_0000
Mask 3584
Dest BCD_Wash2

*******************
Am I on the right track? I'm expecting to get values 0-7 from each BCD device.
__________________
...rab

Last edited by RBergmann; September 13th, 2018 at 10:17 AM.
  Reply With Quote
Old September 13th, 2018, 11:07 AM   #2
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 783
Yes Masked Move MVM would be the most efficient way to transfer the bits to a stored word. One thing, you might want to clear (set to 0) the destination word just before the MVM just to make sure the bits are correct.
Just be aware as pointed out on this site, other programmers following you may not understand what you are trying to do with the MVM
  Reply With Quote
Old September 13th, 2018, 11:28 AM   #3
RBergmann
Member
United States

RBergmann is offline
 
RBergmann's Avatar
 
Join Date: Jun 2002
Posts: 248
Quote:
Originally Posted by GaryS View Post
Yes Masked Move MVM would be the most efficient way to transfer the bits to a stored word. One thing, you might want to clear (set to 0) the destination word just before the MVM just to make sure the bits are correct.
Just be aware as pointed out on this site, other programmers following you may not understand what you are trying to do with the MVM
Thanks for the feedback and tip, Gary ...


I've done a similar thing with other PLCs, but not with AB.
__________________
...rab
  Reply With Quote
Old September 13th, 2018, 11:35 AM   #4
Mispeld
Member
United States

Mispeld is offline
 
Mispeld's Avatar
 
Join Date: Feb 2017
Location: VA
Posts: 374
It's not clear exactly what you are trying to accomplish, but it seems like a bitwise AND or bit distributor (BTD) are worth looking at.
__________________
"The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." -Stephen Hawking
  Reply With Quote
Old September 13th, 2018, 11:54 AM   #5
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 198
A Masked move will leave the bits at the same location, i.e., bits 1-3 and bits 9-11

If you were to look at your destination file for the bits 1-3 MVM, you'll see numbers 0,2,4,6,8, etc., not 0-7, as you want.

The BTD instruction, can take only the three bits (.01 to .03) and move them into the FIRST three bits of your destination word (BCD_Wash1.0, .1., and .2), resulting in the 0-7 numbers that you're after.
  Reply With Quote
Old September 13th, 2018, 12:21 PM   #6
RBergmann
Member
United States

RBergmann is offline
 
RBergmann's Avatar
 
Join Date: Jun 2002
Posts: 248
Quote:
Originally Posted by Aardwizz View Post
A Masked move will leave the bits at the same location, i.e., bits 1-3 and bits 9-11

If you were to look at your destination file for the bits 1-3 MVM, you'll see numbers 0,2,4,6,8, etc., not 0-7, as you want.

The BTD instruction, can take only the three bits (.01 to .03) and move them into the FIRST three bits of your destination word (BCD_Wash1.0, .1., and .2), resulting in the 0-7 numbers that you're after.
Almost sounds like a bit shift operation. That's not what I'm looking for. In my destination, I'm looking for a static value that changes only when I put the detented selector into a new position. I'm interpreting the BCD value in order to select the appropriate recipe program I wish to run. I'm looking for eight programs maximum so I will select program '0', program '1', ... program '7'.



Am I confused as to what the MVM will provide me?
__________________
...rab
  Reply With Quote
Old September 13th, 2018, 12:47 PM   #7
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 198
As I said, a masked move does not change the bit location. So for your example with the BCD switch wired into bits 1, 2 and 3, a MVM will set the bits in the destination as such:
Bit    ... 5  4  3  2  1  0   (Decimal value)
----------------------------------
Data 1 0 1 0 1 0 (42)

Mask 0 0 1 1 1 0 (14)
- - ║ ║ ║ -
▼ ▼ ▼

Dest 0 0 1 0 1 0 (10)



So rather getting the value of 5 that you'd expect with the 1st and 3rd bits set, you get 10.

The BTD on the other hand, would take bits 1, 2 & 3, and move them into you destination words 0, 1, & 2, giving you the value of 5.

It's not a "bit shift" in that the source file is not affected, nor are any of the other other bits. It performs a copy, on a bit-by-bit basis, and changes where the starting location is.

It is the instruction you're looking for.
  Reply With Quote
Old September 13th, 2018, 01:08 PM   #8
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 783
There seams to be some confusion about the masked Move
It only moves the selected bits it dos not cate about the value of the word
It will overwrite only the selected bits in the destination with the same bit value (1 or 0)
with the bit value of the selected source bits. It will not change any bits in the destination that are not selected in the mask. It you select bits 1,2,3 using the mask only what's in the source 1 or 0 will be copied to the same bits in the destination again as selected by the mask bit 1,2,3 bit 0, 4,5, 6 - 16 ect, will remain as they were befor the Masked Move

I hope this helps
  Reply With Quote
Old September 13th, 2018, 01:15 PM   #9
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 783
There seams to be some confusion about the masked Move
It only moves the selected bits it dos not cate about the value of the word
It will overwrite only the selected bits in the destination with the same bit value (1 or 0)
with the bit value of the selected source bits. It will not change any bits in the destination that are not selected in the mask. It you select bits 1,2,3 using the mask only what's in the source 1 or 0 will be copied to the same bits in the destination again as selected by the mask bit 1,2,3 bit 0, 4,5, 6 - 16 ect, will remain as they were befor the Masked Move

I hope this helps
  Reply With Quote
Old September 13th, 2018, 03:54 PM   #10
RBergmann
Member
United States

RBergmann is offline
 
RBergmann's Avatar
 
Join Date: Jun 2002
Posts: 248
Quote:
Originally Posted by Aardwizz View Post
As I said, a masked move does not change the bit location. So for your example with the BCD switch wired into bits 1, 2 and 3, a MVM will set the bits in the destination as such:
Bit    ... 5  4  3  2  1  0   (Decimal value)
----------------------------------
Data 1 0 1 0 1 0 (42)

Mask 0 0 1 1 1 0 (14)
- - ║ ║ ║ -
▼ ▼ ▼

Dest 0 0 1 0 1 0 (10)



So rather getting the value of 5 that you'd expect with the 1st and 3rd bits set, you get 10.

The BTD on the other hand, would take bits 1, 2 & 3, and move them into you destination words 0, 1, & 2, giving you the value of 5.

It's not a "bit shift" in that the source file is not affected, nor are any of the other other bits. It performs a copy, on a bit-by-bit basis, and changes where the starting location is.

It is the instruction you're looking for.
If I understand correctly, using the BTD instruction, then my setup as in the original example would be


*******************
First BCD device using inputs:
I:2/1
I:2/2
I:2/3

BTD
Source Local:2:I.Data
2#0000_0000_0000_0000
Source Bit 1
Dest BCD_Wash1
Dest Bit 0
Length 3


*******************
Second BCD device using inputs
I:2/9
I:2/10
I:2/11

BTD
Source Local:2:I.Data
2#0000_0000_0000_0000
Source Bit 9
Dest BCD_Wash2
Dest Bit 0
Length 3

*******************
Am I getting warmer???
__________________
...rab

Last edited by RBergmann; September 13th, 2018 at 04:14 PM.
  Reply With Quote
Old September 13th, 2018, 04:16 PM   #11
RBergmann
Member
United States

RBergmann is offline
 
RBergmann's Avatar
 
Join Date: Jun 2002
Posts: 248
I changed the destination bit, "Dest Bit", to '0' for both BTD instructions.
__________________
...rab
  Reply With Quote
Old September 13th, 2018, 11:35 PM   #12
Doug-P
Member
United States

Doug-P is offline
 
Doug-P's Avatar
 
Join Date: Jun 2003
Location: Pa
Posts: 1,244
There are graphic representations of this instruction which illustrate what is being discussed in chapter 7 of the instruction set reference.
__________________
Let's eat Grandma!

Let's eat, Grandma!

Words are very important, but punctuation saves lives...
  Reply With Quote
Old September 14th, 2018, 09:55 AM   #13
RBergmann
Member
United States

RBergmann is offline
 
RBergmann's Avatar
 
Join Date: Jun 2002
Posts: 248
Quote:
Originally Posted by Doug-P View Post
There are graphic representations of this instruction which illustrate what is being discussed in chapter 7 of the instruction set reference.
Thanks for your suggestion.


When dealing with RSLogix/Studio 5000 or any other Rockwell product, I do refer to the instruction manual before posting to this site. Perhaps it's due to old age or my denseness in understanding but I don't always find the Rockwell examples clear, and do find the PLCs.net board to be most helpful in giving an alternative explanation of Rockwell concepts, instructions and methodologies.


I greatly appreciate all the assistance this board has given me over the years.
__________________
...rab
  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
FOR instruction help in Studio 5000 DaveLM LIVE PLC Questions And Answers 7 May 27th, 2017 10:27 AM
Logix5000 - Unconditional Output behaviour when Faulted lambles LIVE PLC Questions And Answers 12 May 16th, 2017 08:43 PM
Help me understand BCD value into controllogix via modbus Prosoft MCM Module diat150 LIVE PLC Questions And Answers 7 April 26th, 2017 02:14 PM
1762-L24BXB MVM Instruction Paradigm_shift LIVE PLC Questions And Answers 2 August 30th, 2012 11:35 AM
installing a panelview 600 + rjmarinaro LIVE PLC Questions And Answers 10 June 17th, 2008 12:52 PM


All times are GMT -5. The time now is 09:43 PM.


.