This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
尊敬的TI大神们:
我最近调试MSP430FR2355的TB输入捕获功能,配置如下:
P6SEL1 |= BIT4; // 捕获的IO口
P6DIR &= ~BIT4;
TB3CCTL5 |= CM_2 | CCIE| CCIS_0 | CAP | SCS;
TB3R=0x0000;
//TB1CTL |= TBSSEL_1 | MC_2 |TBCLR|TBIE|ID_0; // Use ACLK as clock source, clear TA0R
TB3CTL |= TBSSEL_1 | MC_2 |TBCLR|ID_0|TBIE; // Use ACLK as clock source, clear TA0R
目前捕获无法进入中断,中断函数如下
#pragma vector=TIMER3_B1_VECTOR
__interrupt void TIMER3_B1_ISR(void)
{
//TB1CCTL1 &= ~CCIFG;
//pumpTimes = TB1CCR1;
switch(TB3IV)
{
case 2:
TB3CCTL5 &= ~CCIFG;
if(pulseTimes>=3) //3圈后开始采集数据,防止干扰
{
pumpTimes = TB3CCR5;
pumpTimes = overFlow*65536 + pumpTimes;
rev = ((unsigned long)60*(unsigned long)32768)/pumpTimes; //r/min
pulseTimes=10;
//TACCR0=0;
}
else
{
pulseTimes++;
}
overFlow =0;
TB3CTL |= TBCLR; //清定时器
TB3CCR5=0;
TB3CCTL5 &= ~CCIFG; //清除中断标志
break;
case 4: break; // CCR2 not used
case TBIV_14: // TimerA溢出中断;
LED_REV;
TB3CCTL5 &= ~COV;
overFlow++;
if(overFlow>=2) //2s没有收到数据
{
pulseTimes=0;
pumpTimes=0xffffffff;
rev=0;
}
break;
}
}
溢出中断可以进入,但是正常的捕获始终不进中断,不知哪里配置不正确,还请大神们帮忙看看,万分感谢!
设置的有点问题,参考下面程序:
P6SEL0 |= BIT4; // 捕获的IO口
P6DIR &= ~BIT4;
Thanks!
Best Regards
Johnson