Miller, Steve wrote: > I am working on some code that uses PortB interrupt on change > feature. I know that bit test are dangerous because of the > read-modify-write sequence. > .... > What about: > > movf portB,w ; retrieve a copy of PortB to W > movwf temp ; save the copy in temp > btfss temp,7 ; test if Bit 7 of Port B is set > > Will this keep PortB from getting screwed up? Steve: No, it won't... The problem isn't with modifying or writing the port; it's with READING the port. Any instruction that reads port B (which means "any instruction that accesses port B", since every "write" instruction does a read first) can potentially make you miss change-on-portb interrupts. Sorry. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === === Custodian of the PICLIST Fund -- For more info, see: === http://www.geocities.com/SiliconValley/2499/fund.html