⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keyscan.c

📁 Keil C51完整的128X64LCD显示的电子打铃仪代码,内含DS1302X5045等操作代码
💻 C
字号:
/*********************************************************************
 *Description:    		SW680GAM Machine KEY Drive Program 
 *File Name:   			KeyScan.C
 *Use Compile Lanague: 	KEIL C51
 *Version :    			V1.0
 *Code Author:    		zhouhuanxi
 *Date:					2005-01-14
 CopyRight(C) 			2005 --  SHENZHEN XINSANWEI Machine&Electronics CO.,LTD.
*********************************************************************/
//==== FILE Include And Macro Declare Segment====
#define _LCD_H
#include 	"Config.H"

//Define Key Scan Port
#define KEYPORT				P1

uint8 DTime=0;
//*************************************************
//============= FUNCTION CODE SEGMENT =============
//*************************************************

//=================================================
//Function: 	ScanFuncKey	
//Description: 	Scan self-helpful Key  and Get the KeyPressing of Key Value	
//Parameters: 	NO.
//CALL:			NO.
//Returns: 		KeyPressing of Key Value
//=================================================
uint8 KeyScan(void)
{
	uint8	tempkeyvalue0,tempkeyvalue;
	KEYPORT			=	0xFF;
	tempkeyvalue	=	KEYPORT;

	if (tempkeyvalue==NOKEY_PRESS)
		return NOKEY_PRESS;	
	
	Delay(4);

	KEYPORT			=	0xFF;
	tempkeyvalue	=	KEYPORT;

	if (tempkeyvalue==NOKEY_PRESS)
		return NOKEY_PRESS;	

	if (BeepOnOff)
	    Beep(1);

	Key_Continue(DTime);

	do
	{//等键松开
		KEYPORT			=	0xFF;
		tempkeyvalue0	=	KEYPORT;
		if(tempkeyvalue0!=ENTER && tempkeyvalue0!=ESC)
		{//连按处理
		 	if(KeyBool==TRUE)
			{
				KeyBool=FALSE;
				DTime=24;
				goto KeyExit;
			}
		}
			
	}while(tempkeyvalue0!=NOKEY_PRESS  );
	DTime=0;
KeyExit:	
	return tempkeyvalue;
}

/************************************************************************************************************
***************************************** END OF FILE *******************************************************
************************************************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -