Sign in to follow this  
Followers 0
lchamarthi

MVM Instruction

13 posts in this topic

Hi Everyone! Hello TWC controls! I understood the MVM instruction usage as u mentioned in the sample program & instruction help in RS Logix. Example is like this! Also example given in Help is If we see help example, 0000 are to be masked ones then how 1111 came in result value_b. I think masked bits output should be 0000 After clearing this basic question (above image), please clarify me in the/co relate first picture how it will manipulate? One more silly question, Is RSLogix 5000 software is enough to communicate from PC to PLC otherwise i need to have RSLinx Software as mentioned earlier & if then programming recommended cable? Thanks in advance. Lchamarthi Edited by lchamarthi

Share this post


Link to post
Share on other sites
For whatever reason when I viewed your post the images did not come through. So I'll answer the part of your post I can. RSLogix 5000 software lets you create the program but to get it to the processor you will need RSlinx and a programming cable. If you purchased RS5000 it comes with a free copy of RSlinx Lite. you'll also need either an ethernet cable if using a 1756-enet ot enbt module or a serial cable to communicate with the plc. You might find these links useful. Rockwell Automation Literature Library Rockwell Automation Knowledgebase I'd start at the literature library and do a search by catalog number for 1756 the general family number for the Controllogix.

Share this post


Link to post
Share on other sites
lchamarthi - Can you answer my last question on THIS topic 1st? I understand and respect your right to confidentiality. But the sake of our sanity, don't start another topic such as this on when it was building on the previous topic. In fact, since you images did not work, why don't you repost this in the previous thread. You only need to start a new thread if you are going to something completely different or we get way off topic. The main reason we ask this is the first thing you mention is my sample program. It won't be long till someone post the question "What sample program?" Edited by TWControls

Share this post


Link to post
Share on other sites
Hello TWC Controls, I understood the situation. As i thought it should not exist to smothen the things to my side.Next time i won't delete. Sorry for this time to everybody. Regards Lakshmi

Share this post


Link to post
Share on other sites
Could anybody offer me help in understanding above MVM instruction query please? Thanks in advance Lchamarthi

Share this post


Link to post
Share on other sites
Lchamarthi - We can't see your images so your question is not clear. I get the feeling you set the link to your images on you computer. Attach the images as JPEG files

Share this post


Link to post
Share on other sites
Hi TWControls, Please find the attached images. In this can you please explain me the MVM instruction manipulations (source, mask, & dest). Many Thanks Lakshmi

Share this post


Link to post
Share on other sites
We will use your first MVM as an example. I am going to use a value of 2#0010_0100_1010_0111_0000_0000_0000_0000 for Local:8.I.Data For you mask 33488896 = 2#0000_0001_1111_1111_0000_0000_0000_0000 in binary The MVM works on a binary level. If a source bit is 1 and its mask is one, it will write a 1 to the destination bit. If the source bit is 0 and the mask is one, it will write a zero to the destination. If the mask is zero, the destination will remain what it was before the instruction regardless of the source bit Example 2#0010_0100_1010_0111_0000_0000_0000_0000 Source 2#0000_0001_1111_1111_0000_0000_0000_0000 Mask 2#0000_0000_1010_0111_0000_0000_0000_0000 Destination Does that help?

Share this post


Link to post
Share on other sites
Really I stucked up here until u gave a hand. I will be glad to find & have Mr.PLC forum & group of good helping people.If i don't know certain things also i will agree to do my boss with confidence because of forum people's help. In this example Source is deviated from my example. If i take these bits correctly as in my example, 2#0010_0100_0001_1101_0010_0101_1111_0110 Source 2#0000_0001_1111_1111_0000_0000_0000_0000 (33488896) Mask 2#0000_0000_0001_1101_0000_0000_0000_0000 Destination Dest 11101 = which is ( 29 ) decimal Is my manipulation is correct? If then, Dest Should have 29 decimal but in program Dest is 8388608 ? This i couldn't get. Also in DIV instruction, Source A is 8388608 Source B is 65536 If i do normal division taking both as decimal 128. But in program Dest is 2. This also I confused. Please correct/guide me in correct path. Thanks in advance Lchamarthi

Share this post


Link to post
Share on other sites
mask simply specifies which bits from source are transfered to destination. if particular mask bit is zero, that bit in destination is not changed but if mask bit is one, source bit is copied into destination. this can also be achived with combination of AND and OR instructions but it's shorter to write using MVM. assume following: destination BEFORE: 0011_0011_0011_0011 then we run MVM and source is 0101_0101_0101_0101 mask is 0000_1111_0000_1111 result (destination AFTER) will be 0011_0101_0011_0101 the second instruction DIV 65536 is used instead of bit shift instruction (Last 16-bits are removed)

Share this post


Link to post
Share on other sites
Oh! Ya I understood. Can anybody clarify me on DIV instruction query also so that i can move ahead? Thank you Panic! Regards Lchamarthi

Share this post


Link to post
Share on other sites
It would help if we had a bigger picture of what is going on here but I get the feeling I know what they are doing since 65536 is kind of a special divide. Notice that your mask is only concerned with bits 16-24. This is pretty much the upper half of a double integer. The programmer was needing to pretty much move bits 16-24 to bits 0-8 for some type of manipulation or something. By dividing by 65536 it does just that For an example 33488896 (2#0000_0001_1111_1111_0000_0000_0000_0000) divided by 65536 equals 511 (2#0000_0000_0000_0000_0000_0001_1111_1111) Note in binary it is the same value shifted 16 bits

Share this post


Link to post
Share on other sites
imagine you deal with decimal value integers and you start with number like 12345 if you divide by 10, 100, 1000 etc., results will be 1234 123 12 1 0 it's because we divided with BASE (base in decimal is 10). when you look at numbers in binary format, same happens when you devide by 2,4,8,16,32 etc. start with number like 1010111100001010 and results will be 1010111100001010 101011110000101 10101111000010 1010111100001 101011110000 10101111000 1010111100 just don't forget to add leading zeros on the left side of the number. so someone needed to shift the binary number few places and they decided to do it with DIV... oh, and imagine what happens or in system with base 3 if you divide by 3,9,27,81.... you can check for example in octal (divide by 8,64, 512, 4096...) or in hex (divide by 16, 256, 4096,...) btw. see what is binary representation of numbers 2,4,8,16,32 or hex for numbers 16, 256, 4096, 65536 etc. any calculator should handle it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0