PDA

View Full Version : External Interrupts Vs. RB/KBI Interrupts?



kevj
- 1st September 2008, 06:09
I'm laying out a design with a 18F45K20. What is the difference between the standard "External Interrupts" INT pins, and the other PORTB "Interrupt on Change" pins.

There are INT0, INT1, and INT2 on RB0, RB1, and RB2.

There are also KBI0, KBI1, KBI2, and KBI3 on RB4, RB5, RB6, and RB7.

The data sheet seems to indicate they can each wake the processor from sleep.

I have 3 inputs I need to handle - a high pulse from another processor, a tilt sensor, and a push button.

I want to be able to use Darrel's Instant Interrupts to handle any of the 3 inputs, I would also like to use all 3 inputs to wake the processor from sleep. Ideally, I'd like to be able to tell the source of the input after the interrupt occured.

Does it really matter what pin (an INT pin or a KBI pin) I use for these inputs?

Thanks!

Darrel Taylor
- 1st September 2008, 07:52
... What is the difference between the standard "External Interrupts" INT pins, and the other PORTB "Interrupt on Change" pins.

The INT0, INT1, and INT2, can be set to trigger on Either the Rising edge, or the Falling edge, both not both. And each one is a separate interrupt source, so it's easy to tell which one triggered.

KBI0, KBI1, KBI2, and KBI3, as there name implies, are better for KeyBoard Input. They trigger on ANY change rising or falling, and it's up to the program to figure out which one(s) changed because they all funnel into 1 interrupt source.

> The data sheet seems to indicate they can each wake the processor from sleep.

Yes. Either way can wake the PIC from sleep.

> I want to be able to use Darrel's Instant Interrupts to handle any of the 3 inputs

Good choice. :)

> I would also like to use all 3 inputs to wake the processor from sleep. Ideally, I'd like to be able to tell the source of the input after the interrupt occured.

Not a problem. If you use the INT0-INT2, then each pin will have it's own "Handler".