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

📄 lcd_drive.h

📁 Lpc2103的小程序
💻 H
字号:
/*************************************** Copyright (c) *************************************************
*
*										POLAR STAR
*								北天星国际贸易(深圳)有限公司
*								http://www.po-star.com
*
*	文 件 名: LCD_DRIVE.H
*	文件描述:液晶驱动文件的相关定义声明。
*
*	说    明:请根据硬件设计及HD44780的DATASHEET说明阅读或修改文件内容
*
********************************************************************************************************/
#ifndef  __DRV_HD44780_CNFG
#define  __DRV_HD44780_CNFG

/* Max DDRAM Address */
#define HD44780_MAX_DDRAM   	  0x67
/* Max CGRAM Address */
#define HD44780_MAX_CGRAM   	  0x3F
/* Address counter auto increment/decrement definition */
#define HD44780_AC_DECREMENT	  0
#define HD44780_AC_INCREMENT	  1
/* Auto Display shift or cursor move definition */
#define HD44780_CURSOR_MOVE 	  0
#define HD44780_DISPLAY_SHIFT     1
/* MCU interface definition */
#define HD44780_4_BIT   		  0
#define HD44780_8_BIT   		  1
/* Number of line 1/2 definition */
#define HD44780_1_LINE  		  0
#define HD44780_2_LINE  		  1
/* Dot 5x8 or 5x10 definition */
#define HD44780_DOT_5_8 		  0
#define HD44780_DOT_5_10		  1
/* Dispaly On/Off definition */
#define HD44780_DISPLAY_OFF 	  0
#define HD44780_DISPLAY_ON  	  1
/* Cursor On/Off definition */
#define HD44780_CURSOR_OFF  	  0
#define HD44780_CURSOR_ON   	  1
/* Cursor Blink definition */
#define HD44780_CURSOR_NORM 	  0
#define HD44780_CURSOR_BLINK	  1


//extern void Dly100us( void* arg );
/* delay definition */
#define HD44780_POWER_UP_DLY          400     // 40 ms (tick 100us) 
#define HD44780_FIRST_COMM_DLY        41      // 4.1 ms (tick 100us)
#define HD44780_SECOND_COMM_DLY       1       // 100 us (tick 100us)
#define HD44780_MAX_COMM_DLY          30      // 3ms (tick 100us)

/* HD44780 command set */
#define HD44780_CLEAR                 0x01    // Clear dislplay
#define HD44780_RETURN                0x02    // Return dispaly to home

#define HD44780_ENTRY_MODE            0x04    // Set Cursor, Display move and direction
#define HD44780_ENTRY_MODE_CURSOR_S   0x00
#define HD44780_ENTRY_MODE_BOTH_S     0x01
#define HD44780_ENTRY_MODE_DEC        0x00
#define HD44780_ENTRY_MODE_INC        0x02

#define HD44780_DISPLAY_CTRL          0x08    // Set dispaly and cursor mode
#define HD44780_DISPLAY_CTRL_C_NORM   0x00
#define HD44780_DISPLAY_CTRL_C_BLINK  0x01
#define HD44780_DISPLAY_CTRL_C_OFF    0x00
#define HD44780_DISPLAY_CTRL_C_ON     0x02
#define HD44780_DISPLAY_CTRL_D_OFF    0x00
#define HD44780_DISPLAY_CTRL_D_ON     0x04

#define HD44780_DISPLAY_MOVE          0x10    // Dispaly and cursor move
#define HD44780_DISPLAY_MOVE_LEFT     0x00
#define HD44780_DISPLAY_MOVE_RIGHT    0x04
#define HD44780_DISPLAY_MOVE_C        0x00
#define HD44780_DISPLAY_MOVE_D        0x08

#define HD44780_FUNCTION_SET          0x20    // Set diplay function
#define HD44780_FUNCTION_SET_DOT_5_8  0x00
#define HD44780_FUNCTION_SET_DOT_5_10 0x04
#define HD44780_FUNCTION_SET_1_LINE   0x00
#define HD44780_FUNCTION_SET_2_LINE   0x08
#define HD44780_FUNCTION_SET_4_BIT    0x00
#define HD44780_FUNCTION_SET_8_BIT    0x10

#define HD44780_SET_CGRAM_ADD         0x40    //Set AC point to CGRAM
#define HD44780_SET_DDRAM_ADD         0x80    // Set AC point to DDRAM

/* HD44780 Read Status */
#define HD44780_STATUS_AC_MASK        0x7F    // AC Mask 
#define HD44780_STATUS_BUSY_MASK      0x80    // Busy Mask

#define HD44780_BUSY_CHECK            TRUE
#define HD44780_NOT_BUSY_CHECK        FALSE

/* Display address range definition */
#define HD44780_MIN_LINE1_ADD         0x00
#define HD44780_MAX_LINE1_ADD         0x27
#define HD44780_MIN_LINE2_ADD         0x40
#define HD44780_MAX_LINE2_ADD         0x67



/* HD44780 DRV Default setup data */
/* Horizontal Size of dispaly 8/16 symbols */
#define HD44780_HORIZONTAL_SIZE   16
/* Address conuter direction 
 for correct operation of HD44780_StrShow must be HD44780_AC_INCREMENT */
#define HD44780_AC_DIR  HD44780_AC_INCREMENT
/* Auto Display shift or cursor move */
#define HD44780_MOVE  HD44780_CURSOR_MOVE
/* MCU interface */
#define HD44780_INTERFACE  HD44780_4_BIT
/* Number of line */
#define HD44780_LINE  HD44780_2_LINE
/* Dot Matrix 5x8 or 5x10 */
#define HD44780_DOT_MATRIX  HD44780_DOT_5_8
/* Dispaly On/Off */
#define HD44780_DISPLAY_STATE HD44780_DISPLAY_ON
/* Cursor On/Off*/
#define HD44780_CURSOR_STATE HD44780_CURSOR_OFF
/* Cursor Blink*/
#define HD44780_CURSOR_MODE HD44780_CURSOR_NORM


/* Delay macro */
//#define HD44780_BUS_DLY()      for(uint8 dly = 8;dly>0;--dly);

#endif  /* __DRV_HD44780_CNFG */

⌨️ 快捷键说明

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