How many interrupts can a PIC microcontroller have?

Thread Starter

ckilerci

Joined Jun 20, 2014
6
Hi everyone,

I am quite new to embedded programming. I was wondering, how many interrupts can a pic microcontroller have? I have more than 5 or 6 conditions where all of them requires an interrupt routine. Am I limited to the microcontroller's interrupt capability such as timer interrupt 0, 1 and 2.

Thanks for your responses
 

Papabravo

Joined Feb 24, 2006
21,225
No. There is no limit to the number of interrupts that can be generated by the hardware in any given PIC processor. In each of those hardware interrupt service routines you can implement additional additional capabilities that mimic hardware interrupts. For example, a single timer interrupt can implement 8 software timers that can be connected to independent actions.
 

John P

Joined Oct 14, 2008
2,026
The processor will give you options to have interrupts from a number of sources, depending on its capabilities. But you might consider what the effect of using a lot of them could be. If one interrupt is being serviced when another one occurs, the second one is blocked until the first one completes. And if there's a long sequence of interrupts, your main process can get suspended for a significant time. Maybe that's OK and maybe it's not, but you should do a quick assessment of what the worst-case situation might be--what I think of as the "jackpot condition" where everything tries to happen at once.
 

Art

Joined Sep 10, 2007
806
You can use diodes to connect every other port pin to rb0, then when any pin changes state
you can check in the interrupt routine which other pin triggered the interrupt.
That way you can implement interrupt on most port pins.
 

DerStrom8

Joined Feb 20, 2011
2,390
Software interrupts are (practically) unlimited. Hardware interrupts (meaning from an external trigger through the PIC pins) is limited, depending on the processor you have. The PIC I am currently using on one of my projects has three external interrupt pins, for example.
 
Top