Multiple Interrupts on capture register CAP0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multiple Interrupts on capture register CAP0

397 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by groufosse on Tue Jun 04 15:46:58 MST 2013
Hi,

I have 2 different signals connected to 2 different pins: p1.26 (CAP0[0]) and p1.27 (CAP0[1])

Is it not possible to simultaneously receive signals on both of these pins? Since they are 2 unique registers, but on the same interrupt timer (TIMER0) I thought this was possible.

One of the inputs (CAP0[1]) is receiving pulses to be counted almost continuously. However, the other register (CAP0[1]) occasionally gets a block of pulses that also must be handled.

Here's sample code:

/TIMER0 interrupt handler sub-routine
void TIMER0_IRQHandler(void)
{
    //assign Timer 0's interrupt register current value to test variable
    interruptRegister = LPC_TIM0->IR;

    if( interruptRegister & ( 1 << TIM_CR1_INT ) )   
    {
        //or alternately, clear by setting the bit this way
        LPC_TIM0->IR = ( 1 << TIM_CR1_INT );
        motorTurnCtr++;
    }
   
    if( interruptRegister & ( 1 << TIM_CR0_INT ) )   
    {
    //it's the communications interrupt.
    LPC_TIM0->IR = ( 1 << TIM_CR0_INT );  
    //do some stuff.......
    }

The above code causes the program to crash if the CR0 handler is quite busy. These are very low frequency signals, both < 500Hz. Wow, if the chip can't handle 2 inputs of this type of signal simultaneously, this is a real problem...

Any ideas, suggestions or glaring errors?

Thanks!
0 Kudos
Reply
0 Replies