51单片机如何能记录键值然后存储在数组里?
按下按键有反应但死活都无法修改数组的元素intmain(){unsignedcharm;unsignedchark;intx=0;TMOD=0x11;//定时器T0,T1...
按下按键有反应但死活都无法修改数组的元素
int main()
{
unsigned char m;
unsigned char k;
int x = 0;
TMOD = 0x11; //定时器T0,T1设置为方式1
EA = 1;
ET0 = 1;
ET1 = 1;
TR1 = 0;
TR0 = 0;
led = 0xff;
while(1)
{
uint num,mode,len; //低中高音mode
uchar l;
int i=0;
num = key_input();
l=num;
number = numtable[0];
mode = 0;
led = 0xff;
if(K8 == 0&0 != num)
{
song6[x++]=l;
number = numtable[num];
SPEAK = 0;
if(x==60)
{
x=0;
}
if(0xff == input)
{
delay1ms(5);
if(0xff == input)
{
SPEAK = 1;
input = 0xff;
break;
}
}
if(K8 == 1)
{
led=0x01;
song6[x]=0;
song6[x+1]=0;
song6[x+2]=0;
break;
}
} 展开
int main()
{
unsigned char m;
unsigned char k;
int x = 0;
TMOD = 0x11; //定时器T0,T1设置为方式1
EA = 1;
ET0 = 1;
ET1 = 1;
TR1 = 0;
TR0 = 0;
led = 0xff;
while(1)
{
uint num,mode,len; //低中高音mode
uchar l;
int i=0;
num = key_input();
l=num;
number = numtable[0];
mode = 0;
led = 0xff;
if(K8 == 0&0 != num)
{
song6[x++]=l;
number = numtable[num];
SPEAK = 0;
if(x==60)
{
x=0;
}
if(0xff == input)
{
delay1ms(5);
if(0xff == input)
{
SPEAK = 1;
input = 0xff;
break;
}
}
if(K8 == 1)
{
led=0x01;
song6[x]=0;
song6[x+1]=0;
song6[x+2]=0;
break;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询