计时器

#include <Reg52.h >
sbit key=P3^1;
char a[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
int n=0;
int cc = 0;
int T1MS = 65536-50000;
void disp_7seg(int num);
void delay(int i)
{
	int x,y;
	for(x=0;x < i;x++)
		for(y=0;y<255;y++);
}
//void disp_time(int hour, int minite, int second)
void disp_7seg(int num)
{
	P0 = 0x00;
	P2=0xFF;//111(1 11)11
	P0=a[num/1000];
	delay(2);
	P0 = 0x00;
	P2=0xFB;//111(1 10)11
	P0=a[num/100%10];
	delay(2);
	P0 = 0x00;
	P2=0xF7;//111(1 01)11
	P0=a[num/10%10];
	delay(2);
	P0 = 0x00;
	P2=0xF3;//111(1 00)11
	P0=a[num%10];
	delay(2);
}
void init_interrupt();
void main()
{
	init_interrupt();
	while(1)
	{
		disp_7seg(n);
		if(key==0)
		{
			delay(2);
			if(key==0)
			{
				n=0;
			}
		}
		while(key==0);
	}
}
void init_interrupt()
{
	TMOD = 0x00; //????
	TL0 = T1MS%256;  //??????
	TH0 = T1MS/256;	 //??????
	TR0=  1;   //?????0
	ET0 = 1;  //????0
	EA = 1;    //???????
}
void T0_interrupt() interrupt 1
{
	TL0 = T1MS%256;  //??????
	TH0 = T1MS/256;	 //??????
	cc++;
	if (cc>=80)
	{
		cc = 0;
		n++;
	}

}
============================找指导老师布置任务吧==============================