Byte Interrupt_Extern;//同步信号
Byte Adj_Power_Time; //调整变量(t)
Byte Adj;//当前亮度等级(T)
if( Tick_Time>=SYSTICK) //Tick of System
{ Tick_Time=0;//
//调度时间片管理
Key_Time++;
Printf_time++;
Adc_Convert_Time++;
Adj_Power_Time++;
}
if(Interrupt_Extern==1)
{
if( Adj_Power_Time==Adj)
{
Trigger_Bta16_Task();
Interrupt_Extern=0;
}
}
代码仅仅几行而已,仅仅就是挂起一个标志位,然后数数,别的不会数数还是会的。我的系统时基是1MS也就也就是说我可以从1数到10,就行了如果在精确一些就改成100us一个TICK或者更小,那么实时性更高。调光也更平滑。
![](http://c.51hei.com/a/a/b/561217382358921.jpg)
就是这种波形
|