16.7 Clearing Interrupt Flags

The individual status flag bits (IOCBFx, IOCCFx, IOCEFx and IOCGF5) can be cleared by resetting them to zero. If another edge is detected during this clearing operation, the associated status flag will be set at the end of the sequence, regardless of the value actually being written.

To ensure that no detected edge is lost while clearing flags, only AND operations masking out known changed bits must be performed. The following sequence is an example of what must be performed.

Clearing Interrupt Flags (PORTB Example)

MOVLW	0xff
XORWF	IOCBF, W
ANDWF	IOCBF, F