Posted 20 Dec 2016 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
Posted 20 Dec 2016 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
Posted 20 Dec 2016 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
Posted 29 Dec 2016 (edited) I ALLREADY USED SWAPP INSTRUCTION BUT ITS NOT WORKING.I NEED TAKEN VALUE FOR COMPARISON PURPOSE.SO PLS SEND THE SAMPLE PROGRAM. Edited 29 Dec 2016 by UDHAI Share this post Link to post Share on other sites
Posted 31 Dec 2016 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
Posted 5 Jan 2017 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