diff --git a/MCU/MCU_REAL _FINAL/eeprom.c b/MCU/MCU_REAL _FINAL/eeprom.c index d999045..c59d639 100644 --- a/MCU/MCU_REAL _FINAL/eeprom.c +++ b/MCU/MCU_REAL _FINAL/eeprom.c @@ -15,7 +15,7 @@ #include "eeprom.h" #include "delay.h" -extern unsigned int bestScore[10]; +unsigned int bestScore[10]={0}; /*---------------------------- Disable ISP/IAP/EEPROM function @@ -90,7 +90,17 @@ void IapEraseSector(WORD addr) void addBest(unsigned int s) { - bestScore[2]=s; + int i,j; + for(i=0;i<10;i++) + if(bestScore[i]i;j--) + bestScore[j]=bestScore[j-1]; + + bestScore[i]=s; + return; + } + } void saveBest() diff --git a/MCU/MCU_REAL _FINAL/menu.c b/MCU/MCU_REAL _FINAL/menu.c index 4fae6c7..38cde5e 100644 --- a/MCU/MCU_REAL _FINAL/menu.c +++ b/MCU/MCU_REAL _FINAL/menu.c @@ -24,7 +24,7 @@ Menu* LAST = NULL; // enum OPR opr = idle; static unsigned char local[2] = {0}; unsigned int score; -unsigned int bestScore[10]; +extern unsigned int bestScore[10]; extern enum GS blockGameStatus;