Sign in to follow this  
Followers 0
frank.raymond

Word Swapping

9 posts in this topic

I am using a CJ controller. I have a DM reg that I need to swap the contents of the first eight bits to the second eight bits. For an examples: DM100 = 0000000010010010 would bceome 1001001000000000. DM100 = 1001100100101111 would bceome 0010111110011001. The results does not have to be in the same DM address. Thanks in advance for any help Edited by frank.raymond

Share this post


Link to post
Share on other sites
First thought would be the MOVD instruction. It may require two instructions, but the Destination for both can be the same. I did NOT check the manual, but pretty sure this will do what you want. Hope this will help.

Share this post


Link to post
Share on other sites
Thanks for the reply. I hate to ask but could you please show me the ladder logic.

Share this post


Link to post
Share on other sites
Based on how quick this reply came back, I would guess you have not looked at the programming manual. Please secure a copy of manual #W340, and look at the Data Movement instructions. MOVD is part of that group of instructions. It is relatively straight forward, the trick is setting the Control word correctly. A bit of trail and error will help you to understand what is happening. Basically I am saying that if you do this yourself, you will learn the instruction and retain the knowledge for the future. Hope this will help.

Share this post


Link to post
Share on other sites
If the result can be in the same DM address, use swap:

Share this post


Link to post
Share on other sites
Use MOVE DIGIT MOVD(083. Note:- The same word can be specified for both S and D to copy a bit within a word. AND GET THE MANUAL!!! MOVD.pdf

Share this post


Link to post
Share on other sites
SWAP is the better instruction. Y'all just want to punch him through Digit Designator...

Share this post


Link to post
Share on other sites
On the other hand, here is a small tutorial on MOVD. How to use the MOVD Instruction @ MrPLC.com

Share this post


Link to post
Share on other sites
SWAP is the way to go - swaps the bytes around.

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