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.

MSP430G2231 端口输出PWM波形问题



#include <msp430.h>

int main(void) {  

 WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT  

 P1DIR |= BIT4 + BIT5;                            // P1.4 P1.5 output

  P1SEL |= BIT4 + BIT5;                            // P1.4 P1.5option select   // CCR0 toggle mode  

CCR0 = 512;  

CCTL1 = OUTMOD_7;                         // CCR1 reset/set  

CCR1 = 384;                               // CCR1 PWM duty cycle  

TA0CTL = TASSEL_2 + MC_1;                  // SMCLK, up mode

  __bis_SR_register(CPUOFF);                // Enter LPM0      

   // CPU off

 }

 

代码在上面可是改变CCR1时P1_4, P1_5输出的波形的占空比没有变化