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

📄 lcdv1.h

📁 finger print based security system
💻 H
字号:
/****************************************************************************************
	Module     :	LcdV2 - Lcd Interfacing module Version 1.
	Version    :	1.0
		K. KARTHIKEYAN , S.R.Labs, Hyd., India.

	
	Description:    This module is to interface Lcd to the microcontroller.
			It is interfaced on P0 in 4-bit mode.
******************************************************************************************/
# include <8052.h>

# ifndef __LCD_V1__
# define __LCD_V1__

/* ******************************************************************** Macro Definitions */
# define LCD_DELAY 400

# define LCD_PORT  P0
# define RS        P0_0
# define RW        P0_1
# define EN        P0_2

# define INIT_CMD  0x0F
# define NEW_LINE  0xC0

/* ********************************************************************* Global Variables */
bit gbStatus = 0;

/* *************************************************************************************** */
void Delay(unsigned int j)
{
	unsigned int i;
	for(i = 0; i < j ; i++);
}

/* *************************************************************************************** */
void LcdInitWrite(unsigned char ucCmd)
{
	RS = 0;
	RW = 0;
	LCD_PORT = ucCmd;
}

/* *************************************************************************************** */
void LcdCmd(unsigned char ucCmd)
{
	unsigned char ucTemp;
        
        if(gbStatus)
        {
		gbStatus=0;
		goto NEXT;
	}
	RS = 0;
NEXT:
	RW = 0;
	ucTemp = ucCmd;
	ucTemp &= 0xf0;
	LCD_PORT |= ucTemp;
	EN = 1;
	ucTemp = (ucCmd << 4);
	ucTemp &= 0xf0;
	LCD_PORT |= ucTemp;
	EN = 1;
}

/* *************************************************************************************** */
void LcdData(unsigned char ucData)
{
	gbStatus = 1;
	RS = 1;
	LcdCmd(ucData);
}

/* *************************************************************************************** */
void LcdInit(void)
{
	Delay(LCD_DELAY);
	LcdInitWrite(0x30);
	Delay(LCD_DELAY);
	LcdInitWrite(0x30);
	Delay(LCD_DELAY);
	LcdInitWrite(0x30);
	Delay(LCD_DELAY);
	LcdInitWrite(0x20);
	Delay(LCD_DELAY);
	LcdCmd(0x28);
	Delay(LCD_DELAY);
	LcdCmd(4);
	Delay(LCD_DELAY);
	LcdCmd(0x85);
	Delay(LCD_DELAY);
	LcdCmd(6);
	Delay(LCD_DELAY);
	LcdCmd(1);
	Delay(LCD_DELAY);
}

/* *************************************************************************************** */
void LcdPuts(unsigned char *ucStr)
{
	unsigned int i;
	
	for(i = 0; ucStr[i] !=0 ; i++)
		LcdData(ucStr[i]);

}

/* *************************************************************************************** */
void LcdPutc(unsigned char ucCh)
{
	LcdData(ucCh);
}

/* *************************************************************************************** */
void LcdGotoXy(unsigned char x, unsigned char y)
{
	if(x == 0)
	{
		LcdCmd(0x80 + y);
	}
	if(x == 1)
	{
		LcdCmd(0xc0 + y);
	}
}
/* *************************************************************************************** */
void LcdClear(void)
{
	LcdCmd(0x01);
}
/* *************************************************************************************** */

# endif

⌨️ 快捷键说明

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