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/MSP430FR2422:MSP430FR2422

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/946623/ccs-msp430fr2422-msp430fr2422

器件型号:MSP430FR2422

工具/软件:Code Composer Studio

尊敬的先生:

我已配置用于 PWM 生成。 但信号在 P2.3端口引脚上不可用。

请找到以下代码。

int main (空)

   WDTCTL = WDTPW | WDTHOLD;

   PM5CTL0 &=~LOCKLPM5;
   OutPutPortConfiguration();
   TimerB0_Configuration ();
   PWMGeneration();

   while (1)
   {

       _bis_SR_register (LPM0_bits | GIE);
       __no_operation();
       _delay_cycles (500);

   }


空 OutPutPortConfiguration (空)

   P2DIR |= BIT3;      //P2.2和 P2.3
   P2OUT &=~BIT3;
   P2SEL0 |= BIT3;
   P2OUT |= BIT3;

空 TimerB0_Configuration (空)

  TA0CTL |= TACLR;              //开始前清除 TimerA
  TA0CTL |= MC__UP;                       //UP 计数器
  TA0CTL |= TASSEL_ACLK;       //32768Hz


空 PWMGeneration (空)

   TA0CCR0 = 32768;                      //周期为1秒
   TA0CCR1 = 16384;                      //DUTYCYCLE 为500mS
   TA0CCTL0 |=CCIE;
   TA0CCTL0 &=~CCIFG;
   TA0CCTL1 |=CCIE;
   TA0CCTL1 &=~CCIFG;
   TA0CCTL0 |= OUTMOD_7;
   TA0CCTL1 |= OUTMOD_7;

#if 1.
#pragma vector = TIMER0_A0_vector
_interrupt void ISR_TA0_CCR0 (void)

   //P2OUT |= BIT3;
    TA0CCTL0 &=~CCIFG;
   _BIC_SR_REGISTER_ON_EXIT (LPM0_BITS);

#pragma vector = TIMER0_A1_vector
_interrupt void ISR_TA0_CCR1 (void)

   //P2OUT &=~BIT3;
   TA0CCTL1 &=~CCIFG;
   _BIC_SR_REGISTER_ON_EXIT (LPM0_BITS);

#endif

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

    您好,Mutharagan,

    请放置 PM5CTL0 &=~LOCKLPM5;  OutPutPortConfiguration()之后;

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

    根据数据表(SLASEE5C)表6-16、P2.3是 TA1.2、但您要配置 TA0.1、它位于 P1.4上[参考表6-15]。

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

    谢谢主席先生。  我已清除该错误。