Searching \ for '[PIC]PortB Interrupt on change?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'PortB Interrupt on change?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]PortB Interrupt on change?'
1996\04\30@194040 by Xaq

flavicon
face
I have read through the MC data book and app notes and have not found much
info on PortB interrupt on change.

Do all of the pins (b4-b7) have to be used as interrupts when they are enabled?
Can you, for example, use bits b4 and b5 as external interrupts and use b6
and b7 as regular outputs?  Will outputs on those lines trigger an interrupt?

Also I am little confused about a line in the MC app notes (an566).  In
every example they use the following command as one of the first in the
interrupt service routine:

movf portb,1    ;Read portB (into itself) to end mismatch condition

What mismatch condition?  Why is this necessary?  What is really going on?


Thanks

Zach

1996\04\30@220620 by John Payson

flavicon
face
> 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.


'[PIC]PortB Interrupt on change?'
1996\05\01@011458 by Andrew Warren
face
flavicon
face
Xaq <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I have read through the MC data book and app notes and have not
> found much info on PortB interrupt on change.
>
> Do all of the pins (b4-b7) have to be used as interrupts when they
> are enabled? Can you, for example, use bits b4 and b5 as external
> interrupts and use b6 and b7 as regular outputs?  Will outputs on
> those lines trigger an interrupt?

> Also I am little confused about a line in the MC app notes
> (an566). In every example they use the following command as one of
> the first in the interrupt service routine:
>
> movf portb,1    ;Read portB (into itself) to end mismatch condition
>
> What mismatch condition?  Why is this necessary?  What is really
> going on?

Zach:

Don't know how you missed this in your reading...

PIC16C7X Data Sheet, section 5.2 ("PORTB and TRISB Registers"):

   "Four of PORTB's pins, RB<7:4>, have an interrupt on change
   feature.  Only pins configured as inputs can cause this
   interrupt to occur (i.e., any RB7-RB4 pin configured as an
   output is excluded from the interrupt on change comparison).
   The input pins (of RB7-RB4) are compared with the old value
   latched on the last read of PORTB.  The "mismatch" outputs of
   RB7-RB4 are OR'ed together to generate the RBIF interrupt (flag
   latched in INTCON<0>."

-Andy

Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
Fast Forward Engineering, Vista, California
http://www.geocities.com/SiliconValley/2499

1996\05\01@015445 by Xaq

flavicon
face
Thanks Andy,  for some reason I looked in the section on interrupts and
skipped the section about TRISB.  Next time I will try to look more thoroughly.

Thanks

Zach

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...