函数传入的WS2812RGBvalue函数255,254,253这3个数据不见了,keilv4调试以及单片机发送的的3个0x00.
下面这个图是发的是255,255,255,keilv4调试截图
用这下面这段代码发送的数据没有异常
void LightingControl()
{
//switch (WS2812Control)
//{
//case 0:WS2812RGBvalue(0, Gv, 0, 4); break;
//case 1:WS2812RGBvalue(17, Gv, 17, 4); break;
//case 2:WS2812RGBvalue(Gv, 17, 17, 4); break;
//case 3:WS2812RGBvalue(Gv, 0, Gv, 4); break;
//case 4:WS2812RGBvalue(0, 0, Gv, 4); break;
//case 5:WS2812RGBvalue(47, Gv, Gv, 4); break;
//case 6:WS2812RGBvalue(Gv, Gv, 9, 4); break;
//case 7:WS2812RGBvalue(Gv, Gv, Gv, 4); break;
//case 8:WS2812RGBvalue(255, 255, 255, 4); break;
//default:
// break;
//}
WS2812RGBvalue(255, 255, 255, 4);
}
/**T0中断函数**/
void InterruptTimer0() interrupt INT_NO_TMR0 using 1
{
TH0 = T0RH;
TL0 = T0RL;
//eveFlag = 0;
if (cFlag)
{
Gv = Gv + 2;
WS2812RGBvalue(255, 255, 255, 4);
if (Gv >= 240)
{
cFlag = 0;
}
}
else
{
Gv = Gv - 2;
WS2812RGBvalue(255, 255, 255, 4);
if (Gv <= 20)
{
cFlag = 1;
}
}
}
下图是STC8A调试以及实际发生数据的截图,没有问题
下面是CH552T驱动WS2812的源程序
CH552WS2812.zip
(144.74 KB)
|
|