Interrupts with pic16f84

Discussion in 'Embedded Systems and Microcontrollers' started by raylapa12, Aug 9, 2006.

  1. raylapa12

    Thread Starter New Member

    Aug 9, 2006
    Hi there,
    i am new on the forum, i was wondering if it is possible to use two interrupts( RB0 and TMR0) with the pic16f84. i am doing a project on triac phase control.

  2. Papabravo


    Feb 24, 2006
    Of course it is possible. Microchip would not put multiple interrupts in a device if there was no way to use them.

    If your question is "How do I use two different interrupts in a PIC processor". The answer is if both interrupts are enabled with their respective interrupt enable bits and interrupts are globally enabled with the global enable bit then ALL enabled interrupt conditions cause the processor to push the PC onto the return stack, clear the global interrupt enable bit, and execute the next instruction from some address (typically 0x0004 in the midrange PIC series). At this location is a series of checks for interrupt flags which are set. In your case there would be an RB0 Interrupt flag and a Timer 0 Interrupt flag. When you are done checking all the enabled flags you exit with the RETFIE instruction. This differs from an ordinary RETURN instruction because it sets the Global Interrupt Enable back to 1 so more interrupts can be recognized.

    There are other processors which have separate locations for the different interrupt sources. The mid-range PIC is not one of them.