``下面是写的程序,但感觉采样的数据不对,请各位大神帮助一下`
WDTCTL = WDTPW + WDTHOLD;
if ((CALBC1_1MHZ == 0xFF) || (CALDCO_1MHZ == 0xFF)) { /G2553自检,如果FLASH区被串改过或损坏,则程序不停复位/
while(1); /内部DCO自校准/
}
BCSCTL1 = CALBC1_1MHZ; /基础时钟校准/
DCOCTL = CALDCO_1MHZ; /内部振荡时钟源校准/
Init_uart();
Init_gpio();
TA1CTL = TASSEL_2 + ID_3 + MC_2 + TAIE + TACLR; /SMCKL,开中断,增计数模式/
TA1CCTL1 = CAP + CM_3 + CCIS_0 + SCS + CCIE;
#pragma vector=TIMER1_A1_VECTOR
__interrupt void Timer_A1(void)
{
// uint8_t x = 0;
if(TA1CCTL1 & CM_2){
TA1CCTL1 = (TA1CCTL1 & (~CM_2)) | CM_1;
start = TA1CCR1;
overflow = 0;
}
else if(TA1CCTL1 & CM_1){
TA1CCTL1 = (TA1CCTL1 & (~CM_1)) | CM_2;
middle = TA1CCR1;
overflow = 0;
}
更多回帖