Hi,
I've a board with 3 signals connected on P4.1, P4.2 and P4.3.
I want to measure frequency of these signals, by configuring 3 intputs in compare mode, with interrupt on rising edge.
If I understand, there's only one interrupt (TimerB1_Vector)
My code doesn(t work, i never go in interrupt, signal is present and toggle (scope), but MSP430 doesn't see rising edge :
COuld you help me by reviewing following code? Is there an example somewhere with more than one signal used in capteur mode?
Thanks in advance
Init code :
P4DIR = 0x00;
P4SEL = 0x0E
TB0CCTL1 = CM_2 + CCIS_1 + CAP + CCIE;
TB0CCTL2 = CM_2 + CCIS_1 + CAP + CCIE;
TB0CCTL3 = CM_2 + CCIS_1 + CAP + CCIE;
Interrupt Code :
#pragma vector = TIMERB1_VECTOR
__interrupt void Timer_B1 (void)
{
switch(TBIV)
{
case TBIV_NONE: break; // Vector 0: No interrupt
case TBIV_TBCCR1: // Vector 2: TBCCR1 CCIFG
// Rising Edge was captured
if (!Count1)
{
R1Edge1 = TB0CCR1;
Count1++;
}
else
{
R1Edge2 = TB0CCR1;
Count1=0x0;
}
break;
case TBIV_TBCCR2: // Vector 3: TBCCR2 CCIFG
// Rising Edge was captured
if (!Count2)
{
R2Edge1 = TB0CCR2;
Count2++;
}
else
{
R2Edge2 = TB0CCR1;
Count2=0x0;
}
default: break;
}
}