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.

[参考译文] 编译器/CC430F5137:CC430F5137

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/803061/compiler-cc430f5137-cc430f5137

器件型号:CC430F5137

工具/软件:TI C/C++编译器

您好!

我使用 CC430f5137来控制我的器件。

我想使用计时器 A1来对移动传感器生成的脉冲进行计数。 我想使用引脚 P3.0至作为脉冲的输入。

端口3需要哪种类型的映射?

我已执行以下操作:

P3MAP0 = PM_TA1CLK;<-如果使用 INCLK、映射错误?

P3DIR &=~BIT0;  // BIT0 = 0 ->输入
P3SEL |= BIT0; // BIT0 = 0 ->外膜

计时器设置:

   //为脉冲计数设置 Timer1:
   //- tassel_2:时钟源 INCLK
   //- MC_0:时钟停止
  //- ID_0:分频器1
   TA1CTL = tassel_2 + MC_0 + ID_0 + TACLR;
   
  //将计数器初始化为0。
   TA1R = 0;
   
  //通常计数器被停止。 MC1设置连续
   //模式、最多可计数到0xFFFF。  
   TA1CTL |= MC_1;

我不理解如何使 P3.0用作脉冲计数器。

 BR

JanneN