|
MSP430F149实现TB捕获测量输入信号的频率
[复制链接]
- #include
- int main(void)
- {
- WDTCTL| = WDTPW + WDTHOLD; // Stop WDT
- BCSCTL2|=SELS;
- P1SEL|=0X02;
- P1DIR |= 0x08; // P1.2 and P1.3 output
- CCTL0|=CM_1+SCS+CAP+CCIE;
- TACTL|= TASSEL_2 + MC_2+TAIE; // SMCLK, up-down mode
- _EINT();
- while(1);
- }
- #pragma vector=TIMERA0_VECTOR
- __interrupt void TimerA0(void)
- {
- if(TACCTL0&CM1)
- {P1OUT&=~0X08;
- TACCTL0|=CM_1+SCS+CAP+CCIE;
- }
- else if(TACCTL0&CM0)
- {P1OUT|=0X08;
- TACCTL0=CM_2+SCS+CAP+CCIE;
- }
- }
|
|