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/MSP430F5529:传感器的上升沿计数

Guru**** 2595805 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/648565/ccs-msp430f5529-count-rising-edge-of-the-sensor

器件型号:MSP430F5529

工具/软件:Code Composer Studio

嗨、大家好。 我在传感器的上升沿计数时遇到问题。 这是我的代码

P2IE |= 0x0020;//输入引脚 P2.5上的中断
P2IES |=(0x0020);//高到低边沿
P2IFG &=(~BIT5);// P2.1 IFG 清零

_BIS_SR (GIE);

while (1)

if (flag==1)

P1OUT ^= 0x01;
for (i=50000;i>0;i--);//延迟
flag=0;

#pragma vector=port2_vector
_interrupt void 端口2_(void)

FLAG = 1;
P2IFG &=(~BIT5);// P2.5 IFG 清零

它的工作方向相反。 当未检测到传感器时进行计数、这意味着输入为零并且在检测到传感器时不工作。 我使 LED 闪烁以了解目的。 有人可以帮助我  

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

    请参阅用户指南的第12.2.7.2节、为了用一个低电平到高电平转换来设定 P2IFG 标志、必须将 P2IES 清零。 您的代码注释中也说明了这一点、请查看 TI 提供的代码示例。

    此致、
    Ryan