最近在调程序,遇到SWITCH语句,用仿真器去调试。以下程序编译没问题,在ADS1.2、RVDS2.2、KEIL ARM3.05A、KEIL C51下仿真都会出错,唯有在ICCAVR 6.3编译后用AVRSTUDIO仿真是对的。难道D版的编译器有问题? void Lcd_Init(unsigned char i ); main(void) {
unsigned char i=5; Lcd_Init(i); i=0x00; return 0; }
void Lcd_Init(unsigned char i) { unsigned char cc; switch(i) { case 1: { //gg=(unsigned char (*)[20])aa+1; cc=9; break; } case 2: { //gg=(unsigned char (*)[20])aa; cc=9; break; }
case 3: { //gg=(unsigned char (*)[20])aa; cc=9; break; } case 4: { //gg=(unsigned char (*)[20])aa; cc=9; break; } case 5: { //gg=(unsigned char (*)[20])aa+2; cc=9; break; } default: break; } } |