代码逻辑没问题,但是下载之后,除了和蜂鸣器一个管脚的led6一直闪烁外,不管按下什么按键都没有任何反应,有没有大神帮忙看一下(QAQ
代码如下:
#include <reg52.h>
typedef unsigned char u8;//255
typedef unsigned int u16;//6536
sbit BEEP=P2^5;
sbit LED1=P2^0;
sbit LED2=P2^1;
sbit LED3=P2^2;
#define Key_Matrix_Port P1
void delay() //延时20ms子程序
{
unsigned int i,j;
for(i=20;i>0;i--)
for(j=110;j>0;j--);
}
unsigned int code VoidList[]={262,294,330,349,392, 440,494,523, 587,
659,698,784,880,988,1046,1175,1318,1397,1568,1760,1967};//音频表 3*7=21
//矩阵的线翻转扫描
u8 Key_Matrix_Flip_Scan(void){
static u8 Key_Value = 0;
Key_Matrix_Port=0x0f; //给所有的行低电平,所有的列高电平0000 1111,哪一列有按键按下哪一列就为低电平 测试列
if(Key_Matrix_Port!=0x0f){