>. movf PORTB, w >. andlw 0x30 ; mask out 4,5 >. xorwf last_input, f If you only want to test EITHER bit changing 0->1, then you can just use: . btfss STATUS, Z . goto error_path This will save one cycle, bringing this one to 5 cycles, regardless of which bit changed, 6 cycles if neither changed. However, you won't know WHICH one changed, of course. >. btfss last_input, 5 >. btfss last_input, 4 >. goto error_path >;; Either 4 or 5 changed 0->1 >. movf PORTB, w >. movwf last_input >. >. etc... >error_path >;; Otherwise, neither changed >; do error stuff here >; --Andrew _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body