00001 /* ************************************************************************************************ 00002 * 00003 * Copyright (C) 2008-2009 00004 * Manuel Moser (alias: el08b004), Email: el08b004@technikum-wien.at 00005 * 00006 * ************************************************************************************************ 00007 * 00008 * SVN Status Information: 00009 * 00010 * $Rev:: 108 $: Rivision of last commit 00011 * $Author:: el08b004 $: Author of last commit 00012 * $Date:: 2009-01-11 17:14:24 #$: Date of last commit 00013 * 00014 * ************************************************************************************************ 00015 * 00016 * The following part is important for the Doxygen Documentation: 00017 */ 00024 /* ************************************************************************************************ */ 00025 00026 #ifndef LCD_H 00027 #define LCD_H 00028 00029 #define LCD_12H_VISUALISATION 00030 00031 #define DD_SPI_LCD_CS PB6 00032 00033 #define LCD_PORT PORTB 00034 #define LCD_COMMAND_PIN PB5 00035 #define LCD_RESET_PIN PB7 00036 00037 #define PAGE0 0xB0 00038 #define PAGE1 0xB1 00039 #define PAGE2 0xB2 00040 #define PAGE3 0xB3 00041 #define PAGE4 0xB4 00042 #define PAGE5 0xB5 00043 #define PAGE6 0xB6 00044 #define PAGE7 0xB7 00045 #define PAGE8 0xB8 00046 00047 #define DISPLAY_blank_5PX 10 00048 #define DISPLAY_C_5PX 11 00049 #define DISPLAY_DEGREE_5PX 12 00050 00051 #define PIXEL_5PX 5 00052 #define PIXEL_7PX 7 00053 00054 /* 00055 #define DISPLAY_ON 0xAF //"10101111" 00056 #define DISPLAY_OFF 0xAE //"10101110" 00057 #define DISPLAY_RESET 0xE2 //"11100010" - Reset 00058 #define DISPLAY_POWER_CONTROL 0x28 //"00101000" 00059 #define DISPLAY_POWERSAVE 0x00 //"00000000" - Datasheet say's NOTHING (is 0x00 the same!?) 00060 #define DISPLAY_NO_OPERATION 0xE3 //"11100011" 00061 00062 #define DISPLAY_START_LINE 0x40 //"01000000" - |= mit gewünschter line 00063 #define DISPLAY_PAGE_ADDRESS 0xB0 //"10110000" - |= mit gewünschter Page adresse 00064 #define DISPLAY_COLUMN_UPPER_BIT 0x10 //"00010000" - Sets the most significant 4 bits of the display RAM column address. 00065 #define DISPLAY_COLUMN_LOWER_BIT 0x00 //"00000000" - Sets the least significant 4 bits of the display RAM column address. 00066 00067 #define DISPLAY_ADC_NORMAL 0xA0 //"10100110" - ADC Normal 00068 #define DISPLAY_ADC_REVERSE 0xA1 //"10100111" - ADC Reverse (mirrored visualization) 00069 #define DISPLAY_DISPLAY_NORMAL 0xA6 //"10100110" - DISPLAY Normal 00070 #define DISPLAY_DISPLAY_REVERSE 0xA7 //"10100111" - DISPLAY Reverse (mirrored visualization) 00071 00072 #define DISPLAY_ALL_POINTS_OFF 0xA4 //"10100100" - DISPLAY Normal 00073 #define DISPLAY_ALL_POINTS_ON 0xA5 //"10100101" - DISPLAY all points ON 00074 00075 #define DISPLAY_1_TO_9_BIAS 0xA2 //"10100010" - 1/9 Bias 00076 #define DISPLAY_1_TO_7_BIAS 0xA3 //"10100011" - 1/7 Bias 00077 00078 #define DISPLAY_NORMAL_OUTPUT_DIRECTION 0xC0 //"11000000" - normal direction 00079 #define DISPLAY_REVERSE_OUTPUT_DIRECTION 0xC8 //"11001000" - reverse direction 00080 00081 #define DISPLAY_INTERNAL_RESISTOR_RATIO 0x20 //"00100000" 00082 00083 #define DISPLAY_ELECTRIC_VOLUME_MODE 0x81 //"10000001" 00084 #define DISPLAY_ELECTRIC_VOLUME_REGISTER 0x00 //"00000000" 00085 00086 #define DISPLAY_STATIC_INDICATOR_ON 0xAD //"10101101" 00087 #define DISPLAY_STATIC_INDICATOR_OFF 0xAC //"10101100" 00088 #define DISPLAY_STATIC_INDICATOR_REGISTER 0x00 //"00000000" 00089 00090 #define DISPLAY_BOOSTER_RATIO_2x 0xF8 //"11111000" 00091 #define DISPLAY_BOOSTER_RATIO_3x 0xF8 //"11111000" 00092 #define DISPLAY_BOOSTER_RATIO_4x 0xF8 //"11111000" 00093 #define DISPLAY_BOOSTER_RATIO_5x 0xF9 //"11111001" 00094 #define DISPLAY_BOOSTER_RATIO_6x 0xFB //"11111011" 00095 #define DISPLAY_BOOSTER_STEP_UP_VALUE 0x00 //"00000000" 00096 */ 00097 00098 /* ************************************************************************************************ */ 00099 /* ********************************** Display Codes - How to use ********************************** */ 00100 /* ************************************************************************************************ */ 00101 00102 /* (1) Display ON/OFF 00103 * LCD Display ON/OFF 00104 * (0:OFF, 1:ON) 00105 */ 00106 #define DISPLAY_ON 0xAF //"10101111" 00107 #define DISPLAY_OFF 0xAE //"10101110" 00108 00109 /* ************************************************************************************************ */ 00110 00111 /* (2) Display start line set 00112 * Sets the Display RAM display start line address 00113 */ 00114 #define DISPLAY_START_LINE 0x40 //"01000000" - |= mit gewünschter line 00115 00116 /* ************************************************************************************************ */ 00117 00118 /* (3) Page address set 00119 * Sets the Display RAM Page address 00120 */ 00121 #define DISPLAY_PAGE_ADDRESS 0xB0 //"10110000" - |= mit gewünschter Page adresse 00122 00123 /* ************************************************************************************************ */ 00124 00125 /* (4) Column address 00126 * Sets upper/lower column address 00127 * (0:lower, 1:upper) 00128 */ 00129 /* Sets the most significant 4 bits of the display RAM column address. 00130 |= mit "most significant column address" */ 00131 #define DISPLAY_COLUMN_UPPER_BIT 0x10 //"00010000" - Sets the most significant 4 bits of the display RAM column address. 00132 /* Sets the least significant 4 bits of the display RAM column address. 00133 |= mit "least significant column address" */ 00134 #define DISPLAY_COLUMN_LOWER_BIT 0x00 //"00000000" - Sets the least significant 4 bits of the display RAM column address. 00135 00136 /* ************************************************************************************************ */ 00137 00138 /* (5) None 00139 * None 00140 */ 00141 00142 /* ************************************************************************************************ */ 00143 00144 /* (6) Display data write 00145 * Writes to the Display RAM (no OpCodes! (A0=1)) 00146 */ 00147 00148 /* ************************************************************************************************ */ 00149 00150 /* (7) None 00151 * None 00152 */ 00153 00154 /* ************************************************************************************************ */ 00155 00156 /* (8) ADC Select 00157 * Sets the display RAM address SEG output correspondence 00158 * (0:normal, 1:reverse) 00159 */ 00160 #define DISPLAY_ADC_NORMAL 0xA0 //"10100110" - ADC Normal 00161 #define DISPLAY_ADC_REVERSE 0xA1 //"10100111" - ADC Reverse (mirrored visualization) 00162 00163 /* ************************************************************************************************ */ 00164 00165 /* (9) Display normal/reverse 00166 * Sets the Display normal/ reverse 00167 * (0:normal, 1:reverse) 00168 */ 00169 #define DISPLAY_DISPLAY_NORMAL 0xA6 //"10100110" - DISPLAY Normal 00170 #define DISPLAY_DISPLAY_REVERSE 0xA7 //"10100111" - DISPLAY Reverse (mirrored visualization) 00171 00172 /* ************************************************************************************************ */ 00173 00174 /* (10) Display all Points (ON/OFF) 00175 * Display all Points 00176 * (0: normal display, 1: all points on) 00177 */ 00178 #define DISPLAY_ALL_POINTS_OFF 0xA4 //"10100100" - DISPLAY Normal 00179 #define DISPLAY_ALL_POINTS_ON 0xA5 //"10100101" - DISPLAY all points ON 00180 00181 /* ************************************************************************************************ */ 00182 00183 /* (11) LCD Bias set 00184 * Sets the LCD drive voltage bias ratio 00185 * (0: 1/9 bias, 1: 1/7 bias (ST7565R)) 00186 */ 00187 #define DISPLAY_1_TO_9_BIAS 0xA2 //"10100010" - 1/9 Bias 00188 #define DISPLAY_1_TO_7_BIAS 0xA3 //"10100011" - 1/7 Bias 00189 00190 /* ************************************************************************************************ */ 00191 00192 /* (12) None 00193 * None 00194 */ 00195 00196 /* ************************************************************************************************ */ 00197 00198 /* (13) None 00199 * None 00200 */ 00201 00202 /* ************************************************************************************************ */ 00203 00204 /* (14) Reset 00205 * Internal Reset 00206 */ 00207 #define DISPLAY_RESET 0xE2 //"11100010" - Reset 00208 00209 /* ************************************************************************************************ */ 00210 00211 /* (15) Common output mode select 00212 * Select COM output scan direction 00213 * (0: normal direction, 1: reverse direction) 00214 */ 00215 #define DISPLAY_NORMAL_OUTPUT_DIRECTION 0xC0 //"11000000" - normal direction 00216 #define DISPLAY_REVERSE_OUTPUT_DIRECTION 0xC8 //"11001000" - reverse direction 00217 00218 /* ************************************************************************************************ */ 00219 00220 /* (16) Power Control set 00221 * Select internal power supply operating mode 00222 * -> Last 3 Bit - Booster, Regulator, Follower 00223 */ 00224 #define DISPLAY_POWER_CONTROL 0x28 //"00101000" 00225 00226 /* ************************************************************************************************ */ 00227 00228 /* (17) V0 voltage regulator internal resistor ratio set 00229 * Select internal resistor ratio (Rb/Ra) mode 00230 * -> Last 3 Bit - Resistor ratio 00231 */ 00232 #define DISPLAY_INTERNAL_RESISTOR_RATIO 0x20 //"00100000" 00233 00234 /* ************************************************************************************************ */ 00235 00236 /* (18) Electric Volume mode set 00237 * Set the V0 output voltage 00238 */ 00239 #define DISPLAY_ELECTRIC_VOLUME_MODE 0x81 //"10000001" 00240 00241 /* (18) Electric Volume register set 00242 * Electronic volume register 00243 * -> |= mit gewünschtem Register 00244 */ 00245 #define DISPLAY_ELECTRIC_VOLUME_REGISTER 0x00 //"00000000" 00246 00247 /* ************************************************************************************************ */ 00248 00249 /* (19) Static Indicator (ON/OFF) 00250 * Sets the static indicator on/off 00251 * (0: OFF, 1: ON) 00252 */ 00253 #define DISPLAY_STATIC_INDICATOR_ON 0xAD //"10101101" 00254 #define DISPLAY_STATIC_INDICATOR_OFF 0xAC //"10101100" 00255 00256 /* (19) Static Indicator register set 00257 * Set the flashing mode 00258 * -> |= mit gewünschtem Mode (nur LSB) 00259 */ 00260 #define DISPLAY_STATIC_INDICATOR_REGISTER 0x00 //"00000000" 00261 00262 /* ************************************************************************************************ */ 00263 00264 /* (20) Booster ratio set 00265 * Select Booster Ratio 00266 */ 00267 #define DISPLAY_BOOSTER_RATIO_2x 0xF8 //"11111000" 00268 #define DISPLAY_BOOSTER_RATIO_3x 0xF8 //"11111000" 00269 #define DISPLAY_BOOSTER_RATIO_4x 0xF8 //"11111000" 00270 #define DISPLAY_BOOSTER_RATIO_5x 0xF9 //"11111001" 00271 #define DISPLAY_BOOSTER_RATIO_6x 0xFB //"11111011" 00272 00273 #define DISPLAY_BOOSTER_STEP_UP_VALUE 0x00 //"00000000" 00274 00275 /* ************************************************************************************************ */ 00276 00277 /* (21) Power Save 00278 * Display OFF and display all points ON compound command 00279 */ 00280 #define DISPLAY_POWERSAVE 0x00 //"00000000" - Datasheet say's NOTHING (is 0x00 the same!?) 00281 00282 /* ************************************************************************************************ */ 00283 00284 /* (22) NOP - No Operation 00285 * Command for non-operation 00286 */ 00287 #define DISPLAY_NO_OPERATION 0xE3 //"11100011" 00288 00289 /* ************************************************************************************************ */ 00290 00291 void init_lcd(void); 00292 void lcd_data(void); 00293 void lcd_clear(void); 00294 void lcd_command(void); 00295 void lcd_reset(uint8_t signal); 00296 void lcd_set_start(uint8_t x, uint8_t y); 00297 void lcd_set_column(uint8_t x); 00298 //uint8_t lcd_desgin_vertical(uint8_t x, uint8_t y, uint8_t end_y, uint8_t databit); 00299 //uint8_t lcd_desgin_horizontal(uint8_t x, uint8_t y, uint8_t end_x, uint8_t databit); 00300 //void lcd_goto_page(uint8_t page); 00301 uint8_t lcd_send_char(uint8_t x, uint8_t y, uint8_t px, uint8_t c); 00302 //uint8_t lcd_send_temp(uint8_t x, uint8_t y, uint8_t px, uint8_t c); 00303 //uint8_t lcd_send_char(uint8_t x, uint8_t y, uint8_t px, const char *c); 00304 uint8_t lcd_send_bitmask(uint8_t x, uint8_t y, uint8_t c); 00305 uint8_t lcd_send_string(uint8_t x, uint8_t y, uint8_t px, char *string); 00306 uint8_t mirror_byte(uint8_t value); 00307 void graphic_view(void); 00308 00309 00310 /*extern const char T[7]; 00311 extern const char e[7]; 00312 extern const char m[7]; 00313 extern const char p[7]; 00314 extern const char e[7]; 00315 extern const char r[7]; 00316 extern const char a[7]; 00317 extern const char t[7]; 00318 extern const char u[7]; 00319 extern const char r[7]; 00320 00321 extern const char space[7]; 00322 extern const char doppelpunkt[7]; 00323 extern const char grad[7]; 00324 extern const char C[7]; 00325 00326 extern const char S[7]; 00327 extern const char e[7]; 00328 extern const char n[7]; 00329 extern const char s[7]; 00330 extern const char o[7]; 00331 extern const char r[7]; 00332 */ 00333 #endif
1.5.8