keil编程出现问题void Play_Tone() interrupt 1处错误
#include#define uchar unsigned char
#define uint unsigned int
uint code Tone_Delay_Table[]=
{64021,64103,64260,64400,64524,64580,64684,64777,
64820,64898,64968,65030,65058,65110,65157,65178};
sbit BEEP=P3^0;
uchar KeyNo;
void DelayMS(uchar x)
{
uchar i;
while(x--)for(i=0;i<120;i++);
}
void Keys_Scan()
{
uchar Tmp,k;
P1=0x0F;
DelayMS(2);
Tmp=P1^0x0f;
switch(Tmp)
{
case 1:k=0;break;
case 2:k=1;break;
case 4:k=2;break;
case 8:k=3;break;
default:return;
P1=0xF0;
DelayMS(2);
Tmp=(P1>>4)^0x0F;
switch(Tmp)
{
case 1:k+=0;break;
case 2:k+=4;break;
case 4:k+=8;break;
case 8:k+=12;break;
default:return;
}
KeyNo=k;
}
void Play_Tone() interrupt 1
{
TH0=Tone_Delay_Table[KeyNo]/256;
TL0=Tone_Delay_Table[KeyNo]%256;
BEEP=~BEEP;
}
void main()
{
TMOD=0x01;
IE=0x82;
while(1)
{
P1=0xF0;
if(P1!=0xF0)
{
Keys_Scan();
TR0=1;
}
else
{
TR0=0;
}
DelayMS(2);
}
}