📄 zlg7289.h
字号:
/**************************************************************
功 能:zlg7289键盘扫描程序
说 明:MCU:atmage48v 8M
设 计:
修 改:Joe Yuan qq:16693799
日 期:2007.05.11
***************************************************************/
#ifndef _ZLG7289_H
#define _ZLG7289_H
/************端口定义**************/
#define ZLG7289_PORT PORTD
#define ZLG7289_INPORT PIND
#define ZLG7289_DDR DDRD
#define ZLG7289_CLK PD0
#define ZLG7289_DIO PD1
#define ZLG7289_CS PD2
#define ZLG7289_KEY PD3
void Delay_short()//短延时函数
void Delay_long()//短延时函数
Byte Read_key()//读键盘函数
/**************************/
Byte Read_key(Byte)//读键盘函数
{
Byte i;
Byte temp=0;
Byte aa=0;
for(i=0;i<8;i++)
{
temp=temp<<!;
aa=ZLG7289_DIO; //按位或
if(aa==1)
temp=temp+1;
ZLG7289_CLK=1;
Delay_short(); //延时
ZLG7289_CLK=0;
return(temp); //返回按键的编号
}
}
switch(key_value)
{
case(0)
}
void Delay_short()//短延时函数
{
Byte i;
for(i=0;j<10;j++);
}
void Delay_long()//短延时函数
{
Byte i;
for(i=0;j<80;j++);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -