|
单片机型号:stc15w4k58s4
问题是 用keil开始仿真就发声,然后键盘控制不了
void Timer1_Init(void) //10??@12.000MHz
{
AUXR &= 0xBF; //?????12T??
TMOD &= 0x0F; //???????
TL1 = 0xF0; //???????
TH1 = 0xD8; //???????
TF1 = 0; //??TF1??
TR1 = 1; //???1????
}
u8 count,j,key;
void main()
{ P3M0 = 0x80;
P3M1 = 0x00;
Timer1_Init();
IE=0x85;
IT0=1;
IT1=1;
j=4;
if(TF1)
{
TF1=0;
P1=~(1<<j);
j++;
if(j>7)
j=4;
}
if((P1&0x0f)!=0x0f)
{ key=P1;
switch(key)
{
case 0xee:sound0();break;
case 0xde:sound1();break;
case 0xbe:sound2();break;
case 0x7e:sound3();break;
case 0xed:sound4();break;
case 0xdd:sound5();break;
case 0xbd:sound6();break;
case 0x7d:sound7();break;
case 0xeb:sound8();break;
case 0xdb:sound9();break;
case 0xbb:sound10();break;
case 0x7b:sound11();break;
case 0xe7:sound12();break;
case 0xd7:sound13();break;
case 0xb7:sound14();break;
case 0x77:sound15();break;
}
}
}
|
|