In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: I wrote a library of bit-oriented routines for the SX -- in it you'll find functions that will reverse the bits in a byte and in a word. [code]' Use: result = FLIP_BYTE aByte ' -- flips bits in byte end-to-end FUNC FLIP_BYTE '{$IFUSED FLIP_BYTE} ASM MOV __PARAM2, __PARAM1 ' make copy to __PARAM2 CLR __PARAM3 ' clear count FB_Loop: RR __PARAM2 ' get bit from __PARAM2 RL __PARAM1 ' move into __PARAM1 INC __PARAM3 ' update count JNB __PARAM3.3, @FB_Loop ' abort at 8 ENDASM '{$ENDIF} ENDFUNC[/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=353373#m353629 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)