How many interrupts can a PIC microcontroller have?

Discussion in 'Embedded Systems and Microcontrollers' started by ckilerci, Oct 3, 2014.

  1. ckilerci

    Thread Starter New Member

    Jun 20, 2014
    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
  2. Papabravo


    Feb 24, 2006
    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.
    ckilerci likes this.
  3. John P

    AAC Fanatic!

    Oct 14, 2008
    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.
    ckilerci likes this.
  4. ckilerci

    Thread Starter New Member

    Jun 20, 2014
    Thanks a lot. That info really helped.
  5. Art

    Distinguished Member

    Sep 10, 2007
    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.
  6. lightingman

    Senior Member

    Apr 19, 2007
    You should be able to 'On port state change, interrupt' within your program. So any port can generate an interrupt.

  7. DerStrom8

    Well-Known Member

    Feb 20, 2011
    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.