00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef LCD_H
00025 #define LCD_H
00026
00027 #include "global.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #define LCD_PORT_INTERFACE
00052
00053
00054
00055 #ifdef LCD_PORT_INTERFACE
00056 #ifndef LCD_CTRL_PORT
00057
00058 #define LCD_CTRL_PORT PORTC
00059 #define LCD_CTRL_DDR DDRC
00060
00061 #define LCD_CTRL_RS PC2
00062 #define LCD_CTRL_RW PC3
00063 #define LCD_CTRL_E PC4
00064 #endif
00065 #ifndef LCD_DATA_POUT
00066
00067 #define LCD_DATA_POUT PORTA
00068 #define LCD_DATA_PIN PINA
00069 #define LCD_DATA_DDR DDRA
00070
00071 #define LCD_DATA_4BIT
00072 #endif
00073 #endif
00074
00075
00076 #ifdef LCD_MEMORY_INTERFACE
00077 #ifndef LCD_CTRL_ADDR
00078
00079 #define LCD_CTRL_ADDR 0x1000
00080 #endif
00081 #ifndef LCD_DATA_ADDR
00082
00083 #define LCD_DATA_ADDR 0x1001
00084 #endif
00085 #endif
00086
00087
00088
00089
00090 #define LCD_LINES 2 // visible lines
00091 #define LCD_LINE_LENGTH 24 // line length (in characters)
00092
00093
00094
00095 #define LCD_CLR 0 // DB0: clear display
00096 #define LCD_HOME 1 // DB1: return to home position
00097 #define LCD_ENTRY_MODE 2 // DB2: set entry mode
00098 #define LCD_ENTRY_INC 1 // DB1: increment
00099 #define LCD_ENTRY_SHIFT 0 // DB2: shift
00100 #define LCD_ON_CTRL 3 // DB3: turn lcd/cursor on
00101 #define LCD_ON_DISPLAY 2 // DB2: turn display on
00102 #define LCD_ON_CURSOR 1 // DB1: turn cursor on
00103 #define LCD_ON_BLINK 0 // DB0: blinking cursor
00104 #define LCD_MOVE 4 // DB4: move cursor/display
00105 #define LCD_MOVE_DISP 3 // DB3: move display (0-> move cursor)
00106 #define LCD_MOVE_RIGHT 2 // DB2: move right (0-> left)
00107 #define LCD_FUNCTION 5 // DB5: function set
00108 #define LCD_FUNCTION_8BIT 4 // DB4: set 8BIT mode (0->4BIT mode)
00109 #define LCD_FUNCTION_2LINES 3 // DB3: two lines (0->one line)
00110 #define LCD_FUNCTION_10DOTS 2 // DB2: 5x10 font (0->5x7 font)
00111 #define LCD_CGRAM 6 // DB6: set CG RAM address
00112 #define LCD_DDRAM 7 // DB7: set DD RAM address
00113
00114 #define LCD_BUSY 7 // DB7: LCD is busy
00115
00116
00117
00118 #ifdef LCD_DATA_4BIT
00119 #define LCD_FDEF_1 (0<<LCD_FUNCTION_8BIT)
00120 #else
00121 #define LCD_FDEF_1 (1<<LCD_FUNCTION_8BIT)
00122 #endif
00123 #define LCD_FDEF_2 (1<<LCD_FUNCTION_2LINES)
00124 #define LCD_FUNCTION_DEFAULT ((1<<LCD_FUNCTION) | LCD_FDEF_1 | LCD_FDEF_2)
00125 #define LCD_MODE_DEFAULT ((1<<LCD_ENTRY_MODE) | (1<<LCD_ENTRY_INC))
00126
00127
00128 #define LCDCHAR_PROGRESS05 0 // 0/5 full progress block
00129 #define LCDCHAR_PROGRESS15 1 // 1/5 full progress block
00130 #define LCDCHAR_PROGRESS25 2 // 2/5 full progress block
00131 #define LCDCHAR_PROGRESS35 3 // 3/5 full progress block
00132 #define LCDCHAR_PROGRESS45 4 // 4/5 full progress block
00133 #define LCDCHAR_PROGRESS55 5 // 5/5 full progress block
00134 #define LCDCHAR_REWINDARROW 6 // rewind arrow
00135 #define LCDCHAR_STOPBLOCK 7 // stop block
00136 #define LCDCHAR_PAUSEBARS 8 // pause bars
00137 #define LCDCHAR_FORWARDARROW 9 // fast-forward arrow
00138 #define LCDCHAR_SCROLLUPARROW 10 // scroll up arrow
00139 #define LCDCHAR_SCROLLDNARROW 11 // scroll down arrow
00140 #define LCDCHAR_BLANK 12 // scroll down arrow
00141 #define LCDCHAR_ANIPLAYICON0 13 // animated play icon frame 0
00142 #define LCDCHAR_ANIPLAYICON1 14 // animated play icon frame 1
00143 #define LCDCHAR_ANIPLAYICON2 15 // animated play icon frame 2
00144 #define LCDCHAR_ANIPLAYICON3 16 // animated play icon frame 3
00145
00146
00147 #define PROGRESSPIXELS_PER_CHAR 6
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 void lcdInitHW(void);
00159
00160 void lcdBusyWait(void);
00161
00162 void lcdControlWrite(u08 data);
00163
00164 u08 lcdControlRead(void);
00165
00166 void lcdDataWrite(u08 data);
00167
00168 u08 lcdDataRead(void);
00169
00170
00171
00172
00173
00174
00175
00176
00177 void lcdInit(void);
00178
00179
00180 void lcdHome(void);
00181
00182
00183 void lcdClear(void);
00184
00185
00186
00187 void lcdGotoXY(u08 row, u08 col);
00188
00189
00190
00191
00192 void lcdLoadCustomChar(u08 lcdCharNum, u08 romCharNum);
00193
00194
00195 void lcdPrintData(char* data, u08 nBytes);
00196
00197
00198
00199
00200
00201 void lcdProgressBar(u16 progress, u16 maxprogress, u08 length);
00202
00203 #endif