先附上一段代码
#define N 2
void fun(void)
{
static u8 sta=0;
switch(sta)
{
case 0:
list1_on(1);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 1:
list1_on(2);list2_on(2);list3_on(4);
delay(N);
sta++;
break;
case 2:
list1_on(1);list2_on(3);list3_on(1);
delay(N);
sta++;
break;
case 3:
list1_on(3);list2_on(4);list3_on(2);
delay(N);
sta++;
break;
case 4:
list1_on(2);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 5:
list1_on(3);list2_on(2);list3_on(4);
delay(N);
sta++;
break;
case 6:
list1_on(2);list2_on(3);list3_on(2);
delay(N);
sta++;
break;
case 7:
list1_on(3);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 8:
list1_on(4);list2_on(2);list3_on(1);
delay(N);
sta++;
break;
case 9:
list1_on(5);list2_on(3);list3_on(2);
delay(N);
sta++;
break;
case 10:
list1_on(1);list2_on(4);list3_on(1);
delay(N);
sta++;
break;
case 11:
list1_on(2);list2_on(2);list3_on(2);
delay(N);
sta++;
break;
case 12:
list1_on(3);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 13:
list1_on(2);list2_on(2);list3_on(4);
delay(N);
sta++;
break;
case 14:
list1_on(1);list2_on(3);list3_on(5);
delay(N);
sta++;
break;
case 15:
list1_on(2);list2_on(4);list3_on(6);
delay(N);
sta++;
break;
case 16:
list1_on(1);list2_on(1);list3_on(1);
delay(N);
sta++;
break;
case 17:
list1_on(3);list2_on(2);list3_on(2);
delay(N);
sta++;
break;
case 18:
list1_on(2);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 19:
list1_on(4);list2_on(2);list3_on(4);
delay(N);
sta++;
break;
case 20:
list1_on(2);list2_on(3);list3_on(2);
delay(N);
sta++;
break;
case 21:
list1_on(3);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 22:
list1_on(4);list2_on(2);list3_on(4);
delay(N);
sta++;
break;
case 23:
list1_on(5);list2_on(3);list3_on(1);
delay(N);
sta++;
break;
case 24:
list1_on(6);list2_on(4);list3_on(2);
delay(N);
sta++;
break;
case 25:
list1_on(1);list2_on(5);list3_on(3);
delay(N);
sta++;
break;
case 26:
list1_on(2);list2_on(6);list3_on(4);
delay(N);
sta++;
break;
case 27:
list1_on(3);list2_on(2);list3_on(1);
delay(N);
sta++;
break;
case 28:
list1_on(1);list2_on(3);list3_on(2);
delay(N);
sta++;
break;
case 29:
list1_on(2);list2_on(1);list3_on(3);
delay(N);
sta++;
break;
case 30:
list1_on(3);list2_on(2);list3_on(4);
delay(N);
sta++;
break;
default:
sta = 0;
break;
}
}
上面的代码是sta从0到30反复执行,delay是软件延时函数。
现在调试的时候发现一个问题,如图
为什么case中的delay函数和sta++;语句到不了???是什么原因呢??
我用了n76e003 APROM program DATAFLASH as EEPROM,跟这个FLASH当EEPROM有关系吗?
百思不得其解啊。。。。网上找了几天了。
因为要用到掉电**,所以刚开始的时候用的官方EEPROM教程,出现问题了,后来在论坛找了一个前辈写的EEPROm代码,还是有问题,不过不知道是不是这个问题。
|