| 
 
| 本帖最后由 awentian 于 2011-2-26 11:37 编辑 
 我用单片机控制595的OE脚,输出PWM波形,实现LED渐变,怎么在渐变的过程中,在刚渐亮,或刚熄灭的时候,LED要闪一下,有谁知道这个问题吗
 主程序
 if (percent <150 && light==1) percent = percent+1;
 else light =0;
 
 if (percent >0 && light ==0) percent = percent-1;
 else light =1;
 中断函数
 void pulse() interrupt 1 using 0
 {
 TH0 = 0xfc;
 TL0 = 0x66;
 
 if (times++ == percent) oe= 0;
 else if (times ==140)
 {times =0;oe= 1;}
 
 }
 | 
 |