我想用msp430的timerB调pwm波形,可是怎么也出不来?求解??
用timerA能完美实现,但timerB却不行,即便是TI的例程也不行,哪位大神给解释一下啊,谢谢了
#include <msp430x14x.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P4DIR |= 0x7e; // P4.1 - P4.6 output
P4SEL |= 0x7e; // P4.1 - P4.6 TBx options
TBCCR0 = 512-1; // PWM Period
TBCCTL1 = OUTMOD_7; // CCR1 reset/set
TBCCR1 = 384; // CCR1 PWM duty cycle
TBCCTL2 = OUTMOD_7;
TBCCR2 = 128;
TBCCTL3 = OUTMOD_7;
TBCCR3 = 64;
TBCCTL4 = OUTMOD_7;
TBCCR4 = 32;
TBCCTL5 = OUTMOD_7;
TBCCR5 = 16;
TBCCTL6 = OUTMOD_7;
TBCCR6 = 8;
TBCTL = TBSSEL_2 + MC_1; // SMCLK, up mode
_BIS_SR(CPUOFF); // Enter LPM0
}
|