如下程序,每次执行时,程序总会莫名其妙地停止运行(用ICD2仿真,烧入后也会不正常),但当把下面的
//case 16:
//workmode=0;
//break;
关闭时,发现程序会正常工作.不会出现刚运行中停止的问题.
1.难道switch case 只能有case 0~15 限制? 编译器是HI-TECH C PRO for the PIC18 MCU Family (Lite) V9.63PL3 LITE MODE
2. 程序开始运行时根本没有进入CASE 16,写上这个代码运行时也会停下来.这是什么道理?
请各位指点.
void Action(void)
{
// unsigned char i;
switch (workmode)
{
case 0:
break;
case 1: //1
DISPTHO=1;
UpdateDisp();
workmode=0;
break;
case 2: //2
DISPTHO=2;
UpdateDisp();
workmode=0;
break;
case 3: //3
DISPTHO=3;
UpdateDisp();
workmode=0;
break;
case 4: //4
DISPTHO=4;
UpdateDisp();
workmode=0;
break;
case 5: //5
DISPTHO=5;
UpdateDisp();
workmode=0;
break;
case 6: //6
DISPTHO=6;
UpdateDisp();
workmode=0;
break;
case 7: //7
workmode=0;
break;
case 8: //8
workmode=0;
break;
case 9: //9
break;
case 10: //a
workmode=0;
break;
case 11: //b
workmode=0;
break;
case 12: //c
workmode=0;
break;
case 13: //d
workmode=0;
break;
case 14: //e
DISPTHO=14;
UpdateDisp();
workmode=0;
break;
case 15: //f
DISPTHO=15;
UpdateDisp();
workmode=0;
break;
case 16:
workmode=0;
break;
default:
workmode=0;
break;
} |