Files
STC89C51-Perpetual-Calendar/Keil Code/Revise_3/lcd.h
T

35 lines
726 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#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