![]() |
Interface for Dot-Matrix LCDs 0.8
|
|
⇒ back to Project Page |
00001 00002 /****************************************************************************/ 00037 /*********************************************************************************************/ 00093 /*********************************************************************************************/ 00094 00095 00096 #ifndef LCD_H_INCLUDED 00097 #define LCD_H_INCLUDED 00098 00099 00100 00101 /****************************************** 00102 \internal 00103 General definitions 00104 *******************************************/ 00105 00106 //values (Do not modify - to be used for mode settings!) 00107 #ifndef TRUE 00108 #define TRUE 1 00109 #endif 00110 #ifndef FALSE 00111 #define FALSE 0 00112 #endif 00113 #define HIGH_RES 1 //!< 5x11 dots 00114 #define LOW_RES 0 //!< 5x8 dots 00115 #define CURSOR_ON 1 //!< cursor on 00116 #define CURSOR_OFF 0 //!< cursor off 00117 #define BLINK_ON 1 //!< cursor blinking on 00118 #define BLINK_OFF 0 //!< cursor blinking off 00119 00120 #define USE_LCD_RW_PIN FALSE //!< R/W Pin connected [TRUE] or not [FALSE] 00121 00122 00123 /****************************************** 00124 \internal 00125 Adapt the following parameters 00126 depending on your LCD: 00127 *******************************************/ 00128 00129 //modes 00130 #define DISPLAY_RESOLUTION LOW_RES //!< 1 line and 5x11 dots [HIGH_RES] or 2 lines and 5x8 dots [LOW_RES] 00131 #define DISPLAY_CURSOR CURSOR_OFF //!< switches cursor on [CURSOR_ON] or off [CURSOR_OFF] 00132 #define DISPLAY_CURSOR_BLINK BLINK_OFF //!< cursor blinking on [BLINK_ON] or off [BLINK_ON] 00133 00134 //disable tho following two items if text is scrambled on display 00135 #define AUTOWRAP_AROUND TRUE //!< automatically wrap to next (or back to first) line if string exceeds current line 00136 #define PROCESS_NEWLINE TRUE //!< go to next line if newline character in string was detected 00137 00138 //display parameters 00139 #define DISPLAY_NUMBER_ROWS 2 //!< number of display rows (valid only for 5x8 dots!) 00140 #define DISPLAY_NUMBER_COLUMNS 8 //!< number of display columns 00141 #define DDRAM_OFFSET 0x40 //!< address offset for 2. line (for 2-line-mode) 00142 00143 //timing 00144 #define DISPLAY_ENABLE_TIME_US 1 //!< width of enable pulse [us] 00145 #define DISPLAY_ADDRESS_HOLD_TIME_US 1 //!< address hold time (after enable pulse) [us] 00146 #define DISPLAY_DATATRANSFER_TIME_US 45 //!< wait time after data transfer [us] 00147 #define DISPLAY_COMMANDTRANSFER_TIME_US 45 //!< wait time after command transfer [us] 00148 #define DISPLAY_CLEAR_WAIT_TIME_MS 3 //!< wait time after clear command [ms] 00149 #define DISPLAY_CURSORHOME_WAIT_TIME_MS 3 //!< wait time after cursor home command [ms] 00150 #define DISPLAY_RESET_WAIT_TIME_MS 50 //!< wait time after reset [ms] 00151 #define DISPLAY_INIT_WAIT_TIME01_MS 5 //!< wait time after 1. init message (function set 8 Bit) [ms] 00152 #define DISPLAY_INIT_WAIT_TIME02_MS 2 //!< wait time after 2. init messages (function set 8 Bit) [ms] 00153 #define DISPLAY_INIT_WAIT_TIME03_MS 2 //!< wait time after 3. init messages (function set 8 Bit) [ms] 00154 #define DISPLAY_INIT_WAIT_TIME04_MS 2 //!< wait time after 4. init message (function set 4 Bit) [ms] 00155 #define DISPLAY_INIT_WAIT_TIME_MS 1 //!< standard wait time after 4 Bit init message [ms] 00156 00157 00158 00159 00160 /****************************************** 00161 \internal 00162 LCD commands - Do not change! 00163 *******************************************/ 00164 00165 #define CLEAR_DISPLAY 0x01 //!< Clear Display and DDRAM 00166 #define CURSOR_HOME 0x02 //!< move Cursor to Home position 00167 #define SET_DDRAM_ADDRESS 0x80 //!< set DDRAM Address (DB0...DB6 transport address) 00168 00169 #define LCD_BL_SWITCH_OFF 0 //!< switch off backlight 00170 #define LCD_BL_SWITCH_ON 1 //!< switch on backlight 00171 #define LCD_BL_ALTERNATE 2 //!< alternate backlight 00172 00173 #define LCD_BL_OFF 0 //!< LCD backlight state "off" 00174 #define LCD_BL_ON 1 //!< LCD backlight state "on" 00175 00176 00177 /****************************************** 00178 \internal 00179 Function prototypes 00180 *******************************************/ 00181 00182 void lcd_send_data(unsigned char data); 00183 void lcd_send_command(unsigned char command); 00184 void lcd_set_cursor(uint8_t column, uint8_t row); 00185 void lcd_send_string(const char *data, uint8_t flash_mem); 00186 void lcd_enable(void); 00187 void lcd_clear(void); 00188 void lcd_cursor_home(void); 00189 void lcd_init(void); 00190 void lcd_pin_init(void); 00191 void lcd_blpin_init(void); 00192 void lcd_set_backlight(uint8_t); 00193 00194 00195 00196 #endif // LCD_H_INCLUDED