用ISIS 7 Professional 进行的矩阵键盘扫描
Y1-Y4刷新看的很明显
应该不是电脑问题,新配的机子
下边是刷新的代码:
#include<reg52.h>
#include<intrins.h>
#include"key16x16.h"
unsigned char KEY_number;
unsigned char KEY_refresh()
{
unsigned char i = 0xFE;
unsigned char j = 0;
for(j = 0;j < 4;j++){
KEYIO = i;
i = _crol_(i,1);
switch((KEYIO) & (0xF0)){
case 0xE0:KEY_number = 1 + j * 4;break;
case 0xD0:KEY_number = 2 + j * 4;break;
case 0xB0:KEY_number = 3 + j * 4;break;
case 0x70:KEY_number = 4 + j * 4;break;
default:break;
}
}
return KEY_number;
}
刷新在主函数中,没有进行消抖处理,12M的晶振
一周热门 更多>