📄 sckey.c
字号:
#include <c8051f020.h>
#include"ks0108.h"
#include"PCF8563.H"
#include "ZiKu.h"
/*#define arrangekey P3 //P3口低五位接行线
#define rowkey P1 //P14—P16接列线*/
extern void Delay1ms(unsigned char T);
unsigned char keyscan(void)
{
unsigned char scancode, tmpcode;
P3 &= 0xe0; //行端口送全0
if((P1&0x70)!= 0x70)
{
Delay1ms(10);
if((P1&0x70)!= 0x70)
{
//scancoderow = P1;
//scancoderow &= 0x70;
scancode = 0xfe;
while ((scancode&0x20) != 0)
{
P3 |=(scancode | 0x1f);
if((P1 & 0x70) != 0x70) //本行有键按下
{
tmpcode = ( P1&0x70 ) | 0x8f;
return(~scancode) + (~tmpcode);
}
else
scancode=(scancode<<1) | 0x01; //行扫描码左移一位
}
}
}
return(0);
}
void KeyIn(void)
{
unsigned char key;
while (1)
{
key = keyscan();
switch (key)
{
case 0x21:
DispBmp(screen);
break;
case 0x41:
TestI2C();
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -