Scott Dattalo wrote: >> dbankif gbankadr >> movf lastb, w ;make temp copy of previous input bits >> movwf ireg2 >> dbankif portb >> movf portb, w ;end the mismatch condition >> bcf intcon, rbif ;clear the interrupt condition >> movf portb, w ;get base value for next change detect >> dbankif gbankar >> movwf lastb ;update last IR input bits state >> xorwf ireg2 ;make flags for changed bits in IREG2 > > > Wouldn't it be faster to do this? > > ;dbank stuff > movf PORTB,W > bcf INTCON,RBIF > movf PORTB,W ;get base value for next change detect > ;dbank stuff > xorwf lastb,W ;get differences from last time > xorwf lastb,F ;save this one as the new last > movwf ireg2 ;save the differences Yup, looks a little faster. The code I posted above was ripped from a 18F252 project, the project specific stuff removed, then modified to make it more generic for the 16 family. I didn't try to optimize the result. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics