zlg7289.h

来自「基于avr 得zlg7289 数码管 键盘程序」· C头文件 代码 · 共 121 行

H
121
字号

/************************************************************** 
 功            能: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 + =
减小字号Ctrl + -
显示快捷键?