This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Fast External Interrupts

Hello!

We're trying to use the fast external interrupt inputs EX1IN and EX2IN. We read the manual over and over and still we must be doing something wrong because the interrupt service routine never fires
using the corresponding CAPCOM interrupt
vectors.

We would be grateful for any help.
Here's the code:

void EX1IN(void) interrupt 0x19
{
// Never gets to here!
}

void main(void)
{
DP2_P9 = 0; // P2.9 as input (EX1IN)
DP2_P10 = 0; // P2.10 as input (EX2IN)

// CAPCOM MOD9 & MOD10 to capture
// on rising edge.
CC1_M2 = 0x0110;

// Enable interrupt inputs P2.9 & P2.10.
CC1_CC9IC_IE = 1;
CC1_CC10IC_IE = 1;

// EX1IN & EX2IN interrupt on rising edge.
EXICON = 0x0014;

// Select external interrupt inputs.
EXISEL0 = 0x0000;

PSW_IEN = 1; // Global interrupt enable.

while(1)
;

}

Parents
  • Thanks so much guys!

    We were setting P2.9 and P2.10 as inputs elsewhere. CAPCOM needs to be in capture mode. It's working now - there were a couple of problems. I learned that no interrupts within a group can have the same priority. Also a priority of zero didn't seem to work.

Reply
  • Thanks so much guys!

    We were setting P2.9 and P2.10 as inputs elsewhere. CAPCOM needs to be in capture mode. It's working now - there were a couple of problems. I learned that no interrupts within a group can have the same priority. Also a priority of zero didn't seem to work.

Children
  • I learned that no interrupts within a group can have the same priority.

    As the manual clearly says:

    Note: All interrupt request sources that
    are enabled and programmed to the same
    interrupt priority level (ILVL) must have
    different group priority levels. Otherwise,
    an incorrect interrupt vector will be
    generated.

    Also a priority of zero didn't seem to work.

    Again, the manual says:

    An action request will be accepted by the
    CPU if the requesting source has a higher
    priority than the current CPU priority level
    and interrupts are globally enabled. If the
    requesting source has a lower (or equal)
    interrupt level priority than the current CPU
    task, it remains pending.

    And the current CPU priority level cannot be less than zero, so interrupts with zero priority are never serviced.

    It's all in the manual.
    - mike