hi,
i want to use capture interrupt on port P2.0 but i cannot create correctly. you can see my code in below. where am i doing worng?
#include <msp430.h>
unsigned int timerBcaptureValues;
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
// Configure GPIO
P1DIR |= BIT3; // Set P1.0 as output
P1OUT |= BIT3; // P1.0 high
// echo
P2DIR &= ~BIT0;
P2SEL1 &= ~BIT0;//0
P2SEL0 |= BIT0; //1
P2OUT &= ~BIT0; // Set output to low
PM5CTL0 &= ~LOCKLPM5;
SYSCFG3 |= TBRMP;
TB0CTL = 0;
TB0CCTL1 = 0; // CCR2 reset/set
TB0CTL = TBCLR;
SYSCFG3 |= 0x02; //(TBRMP = 1)
TB0CCTL0 = 0;
TB0CCTL0 |= CM_2+CCIS__CCIA+SCS+CAP+CCIE; //Setup Timer1 with synchronous capture on both edges, connected to Vcc
//and generate interrupt on capture
TB0CTL = TBSSEL_2+MC_2+TBIE; //Setup Timer1 to run on SMCLK, UP mode and generate interrupt on overflow
// Start timer in continuous mode
__bis_SR_register(LPM0_bits | GIE);
__no_operation();
}
// Timer0_B3 CCR0, TB Interrupt Handler
#pragma vector = TIMER0_B0_VECTOR
__interrupt void TIMER0_B0_ISR(void)
{
TB0CCTL0 &= ~CCIFG;
timerBcaptureValues = TB0CCR0;
__no_operation();
}