2022-05-19 13:07:52 +00:00
|
|
|
|
#include "main.h"
|
2022-06-05 12:26:03 +00:00
|
|
|
|
|
|
|
|
|
#define RELOAD (65535-9216) //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ(1ms)
|
|
|
|
|
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-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)
|
|
|
|
|
opr = confirm;
|
|
|
|
|
}
|
|
|
|
|
EA = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-19 13:07:52 +00:00
|
|
|
|
int main()
|
|
|
|
|
{
|
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();
|
|
|
|
|
menuInit(); //<2F>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
2022-06-07 05:35:25 +00:00
|
|
|
|
|
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
|
|
|
|
}
|