|
#include
#define uint unsigned int
int main(void)
{
//init_clock();
WDTCTL=WDTPW+WDTHOLD;
P1DIR |=BIT1+BIT3;
P1OUT =0;
P1SEL |=BIT2;
P1DIR |=BIT2;
TACCTL1=OUTMOD_7; //TA1模式7=高电平PWM输出
TACCTL0=OUTMOD_3; //TA0模式3=低电平PWM输出
TACTL |=MC_1+TASSEL_1+ID_0; //定时器TA设为增计数模式,ACLK
TACCR0=2-1; //2个ACLK周期等于16kHZ
TACCR1=1; //TA1占空比为..(HIGH)
}
此程序调试出来频率智能达到16khz,占空比50%,远不及要求,怎样修改呢或是其他思路? |
|