js321

movd(83) function

11 posts in this topic

Hi, I am working on modifing a ladder code which read and validate a barcode. However, the code doesn't have any documentation on it. I am new to PLC programming, but I know that the instruction code of the movd function contains 4 digits. For example: #ABCD, A is first souce digit, B is number of digit, C is first destination digit, D is not used. But in my PLC code, the some instruction codes only contain 1 or 3 digits. For example, #100, #1. I do not have a work simulator. I don't know what that is telling the PLC to do. Thanks.

Share this post


Link to post
Share on other sites
In CX-Programmer, right click on an instruction > Instruction Help to find brief information what the instruction does, operands, memory areas etc. For detailed information download the Instruction manual reference manual. MOVD_083_.pdf

Share this post


Link to post
Share on other sites
Yes, I have read the instruction. I understand that the control word requires 4 digit instruction (ie: #1030). But the code that I am modifying only has 1 or 3 digits, for example #100, #0. What does that mean (like where is first digit from the source, first digit from destination, how many digit it is moving, etc).

Share this post


Link to post
Share on other sites
If the control word is #100, read it as #0100. If it is #0, read it as #0000 (all operands are 0). You don't have to set leading zeros in the control word. For instance #0 wil move the first digit of the source word, 1 digit "size" to the first digit in the destination word. By the way the 4th digit (most left) is not used.

Share this post


Link to post
Share on other sites

Hey, I tried reading the Instruction help section. I still cannot understand the document. Would you be kind enough to maybe give one or 2 example(s) to help me understand this function a bit better.

 

Thank you :)

 

Share this post


Link to post
Share on other sites

Here is my example: 

This is what the example does:

wMzu0Cj6z0PQwAAAABJRU5ErkJggg==

Here is the code to do that:

W0PjEqoTSJAAAAAASUVORK5CYII=

It gets more confusing when you start wrapping around with the digits, but for extracting a byte or a digit and moving it to another word (like above), it is pretty straight forward.

1 person likes this

Share this post


Link to post
Share on other sites
13 hours ago, Michael Walsh said:

Here is my example: 

This is what the example does:

Here is the code to do that:

It gets more confusing when you start wrapping around with the digits, but for extracting a byte or a digit and moving it to another word (like above), it is pretty straight forward.

Thank you so much! I really understand the concept, and your program helped me understand the way I can program for my project.

Share this post


Link to post
Share on other sites
On 5/12/2016 at 6:19 AM, Michael Walsh said:

Here is my example: 

This is what the example does:

Here is the code to do that:

It gets more confusing when you start wrapping around with the digits, but for extracting a byte or a digit and moving it to another word (like above), it is pretty straight forward.

Hello Sir, may I know how you get the destination results in "HEX" cuz I got the results in "&". 
Do I need to change the properties?
Thank you in advance.

Share this post


Link to post
Share on other sites

Why don't you start a new topic? This thread is very old and unrelated to your issue.

Your result is whatever it is. You are viewing it in Decimal (&). From the 'View' menu, click 'Monitoring Data Type' then choose 'Monitor in Hex'. CX Programmer will then show your values in Hex (#).

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