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.

[参考译文] CCS/MSP430G2553:2553

Guru**** 2577385 points
Other Parts Discussed in Thread: MSP430G2553

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/610473/ccs-msp430g2553-2553

器件型号:MSP430G2553

工具/软件:Code Composer Studio

您好,

我使用的是 MSP430G2553 28引脚封装微控制器。 我需要为两个传感器接口生成捕捉中断以进行 rpm 计算。 首先、我尝试使用一个连接到端口引脚20 (P2.6)的传感器接口、并为此编写了代码。 定时器溢出中断生成没有任何问题。 我的问题是捕获中断无法正常工作。 任何一个 plz 帮助。 我在下面发布了我的代码。 我的外部电路运行良好。

void main( void )

//停止看门狗计时器以防止超时复位
WDTCTL = WDTPW + WDTHOLD;

BCSCTL1 = CALBC1_8MHZ;
DCOCTL = CALDCO_8MHZ;

P3DIR &=~BIT6;//配置 P3.6作为输入

P3DIR &=~BIT4;//配置 P3.6作为输入
P3SEL |= BIT5;// P3.6 Timer0_A、捕捉:CCI1A 输入、比较:Out1输出
P3SEL2 &=~BIT6;
P3SEL2 &=~BIT4;

TA0CTL = tassel_2 | MC_1 | ID_0 | TAIE;//连续模式,中断被启用

//TA0CCTL1 = CM_1 | CCIS_0 | SCS | CAP | CCIE;//捕获下降沿
TA0CCTL2 = CM_1 | CCIS_0 | SCS | CAP | CCIE;//捕获下降沿

_enable_interrupt ();

while (1)

计数器= 0;

#pragma vector=TIMER0_A1_vector
_interrupt void Timer0_A1 (void)

if (TA0IV!= 10)
testy[counter++]= TA0CCR2;
开关(TA0IV)

情况0:
中断;

案例2:
// TA0CCTL1 &=~CCIFG;//清除标志

testy[counter++]= TA0CCR2;

if (overflow_count > 1)

if (tusty[1]> tusty[0])
持续时间=(65535 - testy[1])+ testy[0];
其他
持续时间= testy[0]- testy[1];

持续时间+=(overflow_count * 0xFFFF);

test_speed =((float) 60 *(float) 100000)/(float)持续时间;
overflow_count = 0;
计数器= 0;

中断;

案例4:
计数器= 0;
中断;
案例6:
计数器= 0;
中断;

案例8:
计数器= 0;
中断;

案例10:
//计数器++;
// testy[counter++]= TAR;
overflow_count++;
if (overflow_count > 250)

overflow_count = 0;
P2OUT ^= 0x80;

中断;
默认值:
计数器= 0;
中断;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Yuva、

    P3.6 SEL 的设置是什么? 您似乎只设置了 P3.5 SEL。
    P3SEL |= BIT5;// P3.6 Timer0_A、捕捉:CCI1A 输入、比较:Out1输出


    此致
    Kc