2022-05-19 13:07:52 +00:00
|
|
|
|
#include "main.h"
|
2022-06-07 06:25:11 +00:00
|
|
|
|
#include "eeprom.h"
|
2022-06-05 12:26:03 +00:00
|
|
|
|
|
2022-06-07 15:51:01 +00:00
|
|
|
|
//#define WIPE_BEST
|
|
|
|
|
|
2022-06-07 16:26:36 +00:00
|
|
|
|
#define RELOAD (65535-8535) //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ(1ms)
|
2022-06-05 12:26:03 +00:00
|
|
|
|
unsigned char TH, TL;
|
|
|
|
|
|
|
|
|
|
extern Menu *NOW; //<2F>˵<EFBFBD>ָ<EFBFBD><D6B8>
|
2022-06-05 13:03:15 +00:00
|
|
|
|
extern enum OPR opr; //<2F><><EFBFBD><EFBFBD>״̬
|
2022-06-07 13:45:23 +00:00
|
|
|
|
extern unsigned int bestScore[];
|
2022-06-07 15:51:01 +00:00
|
|
|
|
extern unsigned int ver;
|
2022-06-05 12:26:03 +00:00
|
|
|
|
|
|
|
|
|
void int0() interrupt 0 //<2F>ⲿ<EFBFBD>жϣ<D0B6><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
|
|
|
|
|
{
|
2022-06-07 05:35:25 +00:00
|
|
|
|
|
2022-06-05 12:26:03 +00:00
|
|
|
|
unsigned char LS, CS, flag = 0;
|
|
|
|
|
LS = PIN_3;
|
|
|
|
|
while(!PIN_1)
|
|
|
|
|
{
|
|
|
|
|
CS = PIN_3;
|
|
|
|
|
flag = 1;
|
|
|
|
|
}
|
|
|
|
|
if(flag == 1)
|
|
|
|
|
{
|
|
|
|
|
if((LS == 0) && (CS == 1))
|
|
|
|
|
opr = right;
|
|
|
|
|
if((LS == 1) && (CS == 0))
|
|
|
|
|
opr = left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void time() interrupt 1 //<2F><>ʱ<EFBFBD>жϣ<D0B6><CFA3><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
EA = 0;
|
|
|
|
|
TH0 = TH;
|
|
|
|
|
TL0 = TL0 + TL;
|
|
|
|
|
TL0 = TL0 + 23;
|
|
|
|
|
|
|
|
|
|
if(PIN_4 == 0)
|
|
|
|
|
{
|
2022-06-06 11:52:51 +00:00
|
|
|
|
delayms(15);
|
2022-06-05 12:26:03 +00:00
|
|
|
|
if(PIN_4 == 0)
|
2022-06-07 15:51:01 +00:00
|
|
|
|
{
|
2022-06-05 12:26:03 +00:00
|
|
|
|
opr = confirm;
|
2022-06-07 15:51:01 +00:00
|
|
|
|
delayms(20);
|
|
|
|
|
}
|
2022-06-05 12:26:03 +00:00
|
|
|
|
}
|
2022-06-07 15:51:01 +00:00
|
|
|
|
|
2022-06-05 12:26:03 +00:00
|
|
|
|
EA = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-19 13:07:52 +00:00
|
|
|
|
int main()
|
|
|
|
|
{
|
2022-06-07 13:45:23 +00:00
|
|
|
|
|
2022-06-05 12:26:03 +00:00
|
|
|
|
TH = RELOAD / 256; //<2F><><EFBFBD><EFBFBD>ֵԤ<D6B5><D4A4><EFBFBD><EFBFBD>
|
|
|
|
|
TL = RELOAD - (RELOAD / 256) * 256;
|
|
|
|
|
TH0 = TH;
|
|
|
|
|
TL0 = TL;
|
|
|
|
|
|
|
|
|
|
TMOD = 0x01; //ʹ<>ö<EFBFBD>ʱ<EFBFBD><CAB1>T0<54><30><EFBFBD><EFBFBD>4λȫΪ0,<2C><>4λGATE=0<><30>C/T=0<><30><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>ʽ1<CABD><31>M1=0,M1=1
|
|
|
|
|
|
|
|
|
|
TR0 = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>0
|
|
|
|
|
EA = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>ܿ<EFBFBD><DCBF><EFBFBD>
|
|
|
|
|
ET0 = 1; //<2F><EFBFBD>ʱ<EFBFBD><CAB1>0<EFBFBD>жϿ<D0B6><CFBF><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IT0 = 1; //<2F>жϴ<D0B6><CFB4><EFBFBD><EFBFBD><EFBFBD>ʽΪ<CABD>±<EFBFBD><C2B1>ش<EFBFBD><D8B4><EFBFBD>
|
|
|
|
|
EX0 = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD>ж<EFBFBD>0
|
|
|
|
|
|
|
|
|
|
EA = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>ܿ<EFBFBD><DCBF><EFBFBD>
|
|
|
|
|
|
|
|
|
|
displayInit(); //<2F><>Ļ<EFBFBD><C4BB>ʼ<EFBFBD><CABC>
|
|
|
|
|
clear();
|
2022-06-07 06:25:11 +00:00
|
|
|
|
menuInit(); //<2F>˵<EFBFBD><CBB5><EFBFBD>ʼ<EFBFBD><CABC>
|
2022-06-07 15:51:01 +00:00
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
|
|
|
|
|
#ifdef WIPE_BEST
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 0, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 1, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 2, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 3, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 4, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 5, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 6, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 7, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 8, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 9, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 10, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 11, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 12, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 13, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 14, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 15, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 16, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 17, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 18, 0);
|
|
|
|
|
IapProgramByte(IAP_ADDRESS + 19, 0);
|
|
|
|
|
#endif
|
2022-06-07 13:45:23 +00:00
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>а<EFBFBD>
|
|
|
|
|
bestScore[0] = ((unsigned int)IapReadByte(IAP_ADDRESS + 0)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 1);
|
|
|
|
|
bestScore[1] = ((unsigned int)IapReadByte(IAP_ADDRESS + 2)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 3);
|
|
|
|
|
bestScore[2] = ((unsigned int)IapReadByte(IAP_ADDRESS + 4)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 5);
|
|
|
|
|
bestScore[3] = ((unsigned int)IapReadByte(IAP_ADDRESS + 6)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 7);
|
|
|
|
|
bestScore[4] = ((unsigned int)IapReadByte(IAP_ADDRESS + 8)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 9);
|
|
|
|
|
bestScore[5] = ((unsigned int)IapReadByte(IAP_ADDRESS + 10)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 11);
|
|
|
|
|
bestScore[6] = ((unsigned int)IapReadByte(IAP_ADDRESS + 12)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 13);
|
|
|
|
|
bestScore[7] = ((unsigned int)IapReadByte(IAP_ADDRESS + 14)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 15);
|
|
|
|
|
bestScore[8] = ((unsigned int)IapReadByte(IAP_ADDRESS + 16)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 17);
|
|
|
|
|
bestScore[9] = ((unsigned int)IapReadByte(IAP_ADDRESS + 18)) * 256
|
|
|
|
|
+ (unsigned int)IapReadByte(IAP_ADDRESS + 19);
|
|
|
|
|
|
2022-05-19 13:07:52 +00:00
|
|
|
|
while(1)
|
2022-06-05 12:26:03 +00:00
|
|
|
|
{
|
2022-05-19 13:07:52 +00:00
|
|
|
|
|
2022-06-05 13:03:15 +00:00
|
|
|
|
NOW->f(NOW);
|
2022-06-05 15:35:53 +00:00
|
|
|
|
|
2022-06-05 12:26:03 +00:00
|
|
|
|
}
|
2022-05-19 13:07:52 +00:00
|
|
|
|
}
|