错在那里? #include <reg51.h> #include <intrins.h> unsigned char get_char(void);
void delay(void);
main() { unsigned char keybuf [16],count; SCON=0; ES=0; EA=0; count=0;
while (count<16) keybuf [count++], get_char(); } unsigned char get_char(void) { unsigned char key_code,column=0,mask=0x00; TI=0; SBUF=mask; while (TI==0); while(1) { while((P3^4&P3^5)!=0); delay( ); if((P3^4&P3^5)==0)continue ; else break; } mask=0xfe; while(1) { TI=0; SBUF=mask ; while(TI==0); if((P3^4&P3^5)!=0) { mask= _crol_(mask,1); column|| if(column>=8) column=0; continue; } else break; } if(P3^4==0) key_code=column ; else key_code=8+column; return(key_code); }
void delay(void) { unsigned int I= 10; /*延时10ms*/ while (I--); /*两减号间只能有一个空格*/ }
|