PortB Interrupt on change?
John Payson email (remove spam text)
> movf portb,1 ;Read portB (into itself) to end mismatch condition
> What mismatch condition? Why is this necessary? What is really going on?
For various design reasons, the interrupt-on-change circuitry uses a
"current state" latch-word (4-bits) which is compared with the actual
signals on port B. Any time such values are different, the PIC will
set RBIF. While it might have been possible to use synchronizers so
that the "current-state" latch-word would be updated automatically
after setting RBIF, such a design would have been a little tricky in
a context where there's no guaranteed clock (the CPU might be sleeping).
To force the "current-state" latch-word to match the port-pin values,
you must either read or write to PORTB. Note that if FSR is pointing
to portB, a NOP or CLRW instruction may also have this function. I
don't know whether a skipped instruction which [tried to] read PORTB
would or not; I don't know how the skipping logic works.
In reply to: <199604301649.QAA24831@ns1.indirect.com> from "Xaq" at Apr 30, 96 04:49:00 pm
See also: www.piclist.com/techref/microchip/ints.htm?key=interrupt
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the