while(1)
{
TIMER_A_generatePWM(TIMER_A0_BASE,
TIMER_A_CLOCKSOURCE_SMCLK,
TIMER_A_CLOCKSOURCE_DIVIDER_1,
TIMER_A_PERIOD,
TIMER_A_CAPTURECOMPARE_REGISTER_1,
TIMER_A_OUTPUTMODE_RESET_SET,
i
);
j=10000;do j--;
while(j!=0);
if(jia_flag==1) i+=40;
if(i>=480) jia_flag=0;
if(jia_flag==0) i-=40;
if(i<=40) jia_flag=1;
}
我想通过这样来改变PWM占空比,从而实现呼吸灯的效果。但是为什么LED灯时钟不亮?如果用函数库,要改变PWM占空比怎么做比较合适啊? |