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

📄 lcd.h

📁 单片机51环境下的字库代码122*32点阵的液晶显示
💻 H
字号:
#ifndef LCD_H
#define LCD_H



extern char DrawType;							//作图方式
enum{
	DrawType_Normal=0,			//覆盖
	DrawType_NotNormal=1,		//覆盖取反,非
//	DrawType_Xor=2,				//异或,不同则显示
	DrawType_And=3,				//与
	DrawType_Or=4,				//或
	DrawType_Mask=6,
	DrawType_NotMask=7
};

//基本函数
extern void LCDWriteCom1(unsigned char com);				//主片写命令
extern void LCDWriteDat1(unsigned char dat);				//主片写数据
extern unsigned char LCDReadDat1();					//主片读数据
extern void LCDWriteCom2(unsigned char com);				//从片写命令
extern void LCDWriteDat2(unsigned char dat);				//从片写数据 
extern unsigned char LCDReadDat2();					//从片读数据
extern void LCDInit();							//初始化LCD
extern void LCDClear();							//LCD清屏

#define LCDSetSlectDuty1(i) LCDWriteCom1(0xa8|(1&i))			//占空比设置 
#define LCDSetSlectDuty2(i) LCDWriteCom2(0xa8|(1&i)) 

#define LCDSetModifyWriteON1() LCDWriteCom1(0xe0)			//设置读写模式
#define LCDSetModifyWriteON2() LCDWriteCom2(0xe0)
#define LCDSetModifyWriteOFF1() LCDWriteCom1(0xee)
#define LCDSetModifyWriteOFF2() LCDWriteCom2(0xee)

#define LCDSetStartLine1(i) LCDWriteCom1(oxc0|(i|0x1f))			//设置起始行
#define LCDSetStartLine2(i) LCDWriteCom2(oxc0|(i|0x1f))

#define LCDSetDisplayON1() LCDWriteCom1(oxae)				//开关LCD显示
#define LCDSetDisplayON2() LCDWriteCom2(oxae)
#define LCDSetDisplayOFF1() LCDWriteCom1(oxaf)
#define LCDSetDisplayOFF2() LCDWriteCom2(oxaf)

#define LCDSetPage1(i) LCDWriteCom1(0xb8|(i&3))				//设置当前页
#define LCDSetPage2(i) LCDWriteCom2(0xb8|(i&3))
#define LCDSetCol1(i) LCDWriteCom1(i)					//设置当前行
#define LCDSetCol2(i) LCDWriteCom2(i)


//基本图形函数
unsigned char LCDGetDat(char col,char page);			//读数据
void LCDDrawRect(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,char color);
void LCDDrawPoint(unsigned char x0,unsigned char y0,char color);

void LCDDrawImg(unsigned char x0,unsigned char y0,unsigned char x1,unsigned char y1,char *pic,char mode);
#define LCDDrawImgE(x0,y0,w,h,pic,mode) LCDDrawImg(x0,y0,x0+w,y0+h,pic,mode)

void LCDDrawChar10(unsigned char x0,unsigned char y0,unsigned char *pic,char mode);
void LCDDrawText10(unsigned char x0,unsigned char y0,unsigned char size,unsigned int *dat,char mode);
void LCDDrawText8(char *str,unsigned char x0,unsigned char y0,char mode);

char code CharTable8[];						//8*8 ASCII码字型数据
char code CharTable10[];

void delay(long time);

#endif

⌨️ 快捷键说明

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