|
核心中断部分如下,控制R_SET_VAL的大小,就能控制输出对于颜色LED的亮度,基本测试通过,嘿嘿
void timer0() interrupt 1
{
TR0=0 ;
if(cnt>=0x63) cnt=0;else cnt = cnt+1;
if (R_SET_VAL < cnt)R_Drive = 1; else R_Drive = 0;
if (G_SET_VAL < cnt)G_Drive = 1; else G_Drive = 0;
if (B_SET_VAL < cnt)B_Drive = 1; else B_Drive = 0;
TR0=1 ;
}
|
|