Warren F. Davis wrote: > > > The objective is to locate the rightmost 1 bit in a binary number. > Specifically, to produce a word of all zeros except for a 1 bit at the > position of the rightmost 1 bit in the given number. > I use a variation of this "bit trick" to count the number of bits that are set in a byte. Check out the routine called "bitcount" at: http://www.interstice.com/~sdattalo/technical/software/pic/picprty.html If you wish to obtain just the right most bit as Warren described, then try this chunk of code: ;File register b is the input, W is the output ; Three test cases: ;b=0x01 b=0x00 b=0xf0 DECF b,W ;W=0x00 W=0xff W=0xef ANDWF b,W ;W=0x00 W=0x00 W=0xe0 XORWF b,W ;W=0x01 W=0x00 W=0x10 Most bit nerds find this pretty neat! Scott