第三次优化代码,增加支持keil4的注释,此外优化LCD1602显示

This commit is contained in:
Andy0613
2026-07-07 09:15:23 +08:00
parent 6c23af74d4
commit eb0ae8ee8a
13 changed files with 4976 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#ifndef __LCD_H_
#define __LCD_H_
/*
* 使用4位数据线时取消注释 LCD1602_4PINS,
* 使用8位数据线时注释掉即可
*/
#define LCD1602_4PINS
/* 包含头文件 */
#include<reg51.h>
/* 数据类型重定义 */
#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif
/* 引脚定义 */
#define LCD1602_DATAPINS P0 /* LCD数据口 */
sbit LCD1602_E=P2^7; /* 使能信号 */
sbit LCD1602_RW=P2^5; /* 读写选择 */
sbit LCD1602_RS=P2^6; /* 指令/数据选择 */
/* 函数声明 */
void Lcd1602_Delay1ms(uint c); /* 延时函数(12MHz) */
void LcdWriteCom(uchar com); /* 写命令 */
void LcdWriteData(uchar dat); /* 写数据 */
void LcdInit(); /* 初始化LCD */
#endif