UDHAI

FX-5U PLC

6 posts in this topic

Hi to all,i dont know the how to use the SWAPP instruction,if any one know PLS send me.if any another swapp instruction knows pls send me....

Share this post


Link to post
Share on other sites

From the manual regarding SWAP and SWAPP:

--

These instructions swap the value of 8 bits of the upper and lower bytes of the device specified by (d).

--

The difference between SWAP and SWAPP, is that SWAP is executed at every scan the EN input is active, SWAPP is executed once at the scan when a rising edge is detected at the EN input.

1 person likes this

Share this post


Link to post
Share on other sites

If you have a word D0 for example that's 0000 0000 1111 1111 SWAPP works like this:

M0 ------------------------|SWAPP D0|

Every time M0 turns on the first 8 bits in the word switch places with the last 8 bits. So after a pulse D0 is 1111 1111 0000 0000.

1 person likes this

Share this post


Link to post
Share on other sites

I ALLREADY  USED SWAPP INSTRUCTION BUT ITS NOT  WORKING.I NEED TAKEN VALUE FOR COMPARISON PURPOSE.SO PLS SEND THE SAMPLE PROGRAM. 

Edited by UDHAI

Share this post


Link to post
Share on other sites

You can also use the ROL or ROR instruction to swap position of the upper and lower byte in a word.

(ROtate Left or ROtate Right)

Rotate the word 8 steps to right or left will be equal to the SWAP instruction.

Share this post


Link to post
Share on other sites

My guess is that you use SWAP all scans. You should try using the SWAPP instead to make sure that the instruction is only swapped once instead of every scan.

1 person likes this

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