#include <reg52.h> //头文件
#include <intrins.h> //_crol_库函数头文件
#define uint unsigned int //宏定义
#define uchar unsigned char //宏定义
sbit KEYD = P1^3;
sbit key3 = P1^2;
sbit key2 = P1^1;
sbit key1 = P1^0; //开始/结束按键
sbit LED1_GREEN = P2^0;
sbit LED2_RED = P2^1;
sbit LED3_YELLOW = P2^2;
sbit LED4_GREEN = P2^3;
sbit LED5_RED = P2^4;
sbit LED6_YELLOW = P2^5;
sbit dot = P2^7;
//Count为中断次数,Time_Count为时间计数,Operation_Type为闪灯类型
uchar Count = 0,Time_Count = 20,Time_Type=0;Operation_Type = 0;sec = 0;min = 0;
void DelayMS(uint x)
{
uchar t;
while(x--) {for(t=0;t<120;t++);}
}
void TIMER0() interrupt 1 //50ms中断一次
{
TH0 = -50000/256;
TL0 = -50000%256;
Count++;
if(Count==20)
{
Count=0;
Time_Count--; //20*50ms 自减1
sec++;
if(sec==60)
{
sec=0;
min++;
}
if(min==60)
min=0;
}
}
uint i;
uchar m=0x01;
uchar code DSY_CODE[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
uchar data Buffer_Counts[]={0,0};
void show_count()
{
if (Time_Count==0)
{
Time_Type++;
Time_Type%=2;
if(Time_Type==0) Time_Count=20;
if(Time_Type==1) Time_Count=5;
Operation_Type++;
Operation_Type%=4;
}
else