求大神指导,将if语句转化为Switch语句。。。。先感谢啦
程序代码:when(timer_expires(mTimerPreiod))//这句可以忽略不用理解其含义,主要是将{}中的转化,琢磨很久了,总是报错,谢谢各位啦!
{
static uint8 u8TempSign1 = 0;
uint16 u16LightDestroyTime;
uint16 u16LightBrightTime;
if( (Sci_Tx->u8ErrTimes[0]!=0) || (Sci_Tx->u8ErrTimes[1]!=0) || (Sci_Tx->u8ErrTimes[2]!=0) )
{
u16LightDestroyTime = 1500L;
u16LightBrightTime = 1500L;
}
else if(u16MsgErrCount == 1)
{
u16LightDestroyTime = 2870L;
u16LightBrightTime = 130L;
}
else
{
u8TempSign1 = 0;
u16LightDestroyTime = 3000L;
u16LightBrightTime = 1L;
}
if(u8TempSign1 == 0)
{
u8TempSign1 = 1;
mTimerPreiod = u16LightDestroyTime;
io_out(ioErrorLed,1);
}
else
{
u8TempSign1 = 0;
mTimerPreiod = u16LightBrightTime;
io_out(ioErrorLed,0);
}
watchdog_update();
}再次感谢,坐等解答哇








