ET0=1; EA=1;
for (; ;);
}
void timer0(void) interrupt 1 using 1
{ unsigned int i;
unsigned int key;
key=jiansao( );
delay();
switch (key)
{ case 0x11: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[0]; while(!TI) TI=0;}; break;
case 0x21: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[1]; while(!TI) TI=0;}; break;
case 0x41: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[2]; while(!TI) TI=0;}; break;
case 0x81: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[3]; while(!TI) TI=0;}; break;
case 0x12: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[4]; while(!TI) TI=0;}; break;
case 0x22: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[5]; while(!TI) TI=0;}; break;
case 0x42: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[6]; while (!TI) TI=0;}; break;
case 0x82: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[7]; while(!TI) TI=0;}; break;
case 0x14: for (i=0;i<=7;i++)
{if (i<=7) SBUF=A[8]; while(!TI) TI=0;}; break;
case 0x24: for (i=0;i<=7;i++)
{if (i<=7) SBUF=A[9]; while(!TI) TI=0;}; break;
case 0x44: for (i=0;i<=7;i++)
{if (i<=7) SBUF=A[10]; while(!TI) TI=0;}; break;
case 0x84: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[11]; while(!TI) TI=0;}; break;
case 0x18: for (i=0;i<=7;i++)
{if (i<=7) SBUF=A[12]; while(!TI) TI=0;}; break;
case 0x28: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[13]; while(!TI) TI=0;}; break;
case 0x48: for (i=0;i<=7;i++)
{ if (i<=7) SBUF=A[14]; while(!TI) TI=0;}; break;
case 0x88: for (i=0; i<=7;i++)
{if (i<=7) SBUF=A[15]; while (!TI) TI=0;}; break;
default: SBUF=0xff; break;
}
}
void delay(void) //延时去斗//
{ unsigned int k;
for (k=600; k>0; k--);
}
unsigned int jiansao (void ) 扫描子程序
{ unsigned int lie, han;
P2=0xf0;
if ((P2&0xf0)!=0xf0) 判断有无键按下
{ delay (); 去斗
if((P2&0xf0)!=0xf0) 确认有键按下
{ lie=0xfe;
while ((lie&0x10)!=0)
{ P2=lie;
if ((P2&0xf0)!=0xf0)
{ han=(P2&0xf0)|0x0f;