> Looking for advice on a way to insure that only one of four push buttons > is > active at one time. (IE - prevent multiple button press's) I have 4 > pushbuttons > on Port A (16F88) and have AND'ed these bits out. The only idea that I've > tossed > around so far is to rotate the bits and count them.. If count = 1 then > only one > push button is selected. Is there a better way to do this? Here's a solution to check if one and only one button is pressed. It doesn't require the buttons to be adjacent. MOVF A,W ANDLW BUTTON_MASK SKPNZ return ; No buttons are pressed MOVWF temp ; Clear one bit by using x &(x-1) ADDLW 0xff ; W=PORTA-1 ANDWF temp ; W=PORTA&(PORTA-1) SKPZ return ; More than one button is pressed ; temp holds the one and only button press Scott -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist