📄 use_1602_driver.h
字号:
# ifndef _USE_1602_DRIVER_H_
# define _USE_1602_DRIVER_H_
/*****************************************************************
* 声明库名称:1602液晶驱动配置库 *
* 版本: v0.01 *
* 作者: I ROBOT *
* 创建日期: Copyright (C) 2008年10月22日 *
*----------------------------------------------------------------*
* [支持库] *
* 支持库名称: *
* 支持库版本: *
* 支持库说明: *
*----------------------------------------------------------------*
* [版本更新] *
* 更新: I ROBOT *
* 更新日期: *
* 版本: *
*----------------------------------------------------------------*
* [版本历史] *
* v0.01 创建版本,配置1602与AVR的接口和数据流 *
*----------------------------------------------------------------*
* [使用说明] *
* 1.根据自己的使用需要和AVR环境配置AVR和1602的数据 *
* 和控制端口匹配的配置 *
*****************************************************************/
/********************
* 头 文 件 配 置 区 *
********************/
# include "AVR_Environment_Configure.h"
/********************
* 系 统 宏 定 义 *
********************/
/********************
* 常 数 宏 定 义 *
********************/
/*---------------------------------------------*
* 1602 指 令 宏 定 义 *
*---------------------------------------------*/
# ifndef _1602_INSTRUCTION
# define _1602_INSTRUCTION
# define _1602_MODE_SETTING 0X38
# define _1602_ON 0X0C
# define _1602_OFF 0X08
# define _1602_ICON_ON 0X0A
# define _1602_ICON_OFF (~(0X02))
# define _1602_ICON_FLASH_ON 0X09
# define _1602_ICON_FLASH_OFF (~(0X01))
# define _1602_PSTR_INCREASE 0x06
# define _1602_PSTR_DECREASE (~(0x02))
# define _1602_MOVE_LEFT_ON 0X07
# define _1602_MOVE_RIGHT_ON 0X05
# define _1602_MOVE_OFF (~(0X01))
# define _1602_CLEAR 0X01
# define _1602_PTR 0X80
# define _1602_ROW 0X40
# define _1602_COL_LIMIT 16
# endif
/*---------------------------------------------*
* 1602 状 态 宏 定 义 *
*---------------------------------------------*/
# ifndef _1602_STATE_LIST
# define _1602_STATE_LIST
# define _1602_BUSY 0X80
# endif
/********************
* 动 作 宏 定 义 *
********************/
/*---------------------------------------------*
* MCU 与 1602 接 口 宏 定 义 *
*---------------------------------------------*/
# ifndef MCU_1602_INTERFACE
# define MCU_1602_INTERFACE
# define _1602_RS_HIGH (PORTC |= BIT(PC0))
# define _1602_RS_LOW (PORTC &= ~BIT(PC0))
# define _1602_RW_HIGH (PORTC |= BIT(PC1))
# define _1602_RW_LOW (PORTC &= ~BIT(PC1))
# define _1602_E_HIGH (PORTC |= BIT(PC2))
# define _1602_E_LOW (PORTC &= ~BIT(PC2))
# endif
/*---------------------------------------------*
* MCU 与 1602 数 据 流 宏 定 义 *
*---------------------------------------------*/
# ifndef MCU_1602_DATA_STREAM
# define MCU_1602_DATA_STREAM
# define AVR_READ_1602 do\
{\
DDRD = 0X00;\
PORTD = 0XFF;\
}\
while (0);
# define AVR_WRITE_1602 (DDRD = 0XFF)
# define INPUT_TO_1602 (PORTD)
# define _1602_STATE (PIND)
# define DATA_FROM_1602 (PIND)
# endif
/********************
* 模块结构体定义区 *
********************/
/********************
* 函 数 声 明 区 *
********************/
extern void _1602_Hardware_Configure(void);
static void MCU_Register_Configure(void);
static void MCU_Port_Configure(void);
extern UINT8 Read_State_1602(void);
extern void Write_CMD_1602(UINT8 chCommand,UINT8 chDetect_Busy);
extern void Write_Data_1602(UINT8 chData,UINT8 chDetect_Busy);
extern void LCD_Init_1602(void);
extern UINT8 Read_Data_1602(UINT8 chDetect_Busy);
extern void Is_Busy_1602(void);
extern void CLEAR_LCD_1602(void);
extern void Write_String_1602(UINT8 chx,UINT8 chy,char *chStr_Data,UINT8 chStr_Length);
/********************
* 模块函数声明区 *
********************/
/********************
* 模块变量声明区 *
********************/
/********************
* 全局变量声明区 *
********************/
# endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -