Pinout: 1 GND 2 +5V 3 Kontrast, ca. -4.1V 4 RS 5 RW 6 E 7 DB0 8 DB1 9 DB2 10 DB3 11 DB4 12 DB5 13 DB6 14 DB7 15 AT27 Pin 30 > A13 16 AT27 Pin 31 > A14 Display ist MS = +5V = 68 Series Interface Pins 15 & 16 schalten die Zeichenbänke im AT27 um. Im AT27 sind große Zeichen, 8x16 Pixel, 24 Zeichen pro Zeile A13 und A14 = 0 = Normaler ASCII Zeichensatz + Sonderzeichen Andere Kombinationen = Normale Zeichen + Japanische Zeichen Für weitere Funktionen wie Textcursor, blinken, etc. ins Datenblatt des LC7980 schauen Routinen zum Schreiben des Kommando- sowie Datenregisters. Die Pausenzeiten müssen halt je nach µC angepasst werden. void lcd_write_cmd(unsigned char cmd) { static unsigned short tout; LCD_RW = 0; LCD_RS = 1; LCD_E = 0; LCD_DATA_DIR = DATA_DIR_OUT; LCD_DATA_OUT = cmd; for(tout = 0; tout < 200; tout++) { _asm NOP _endasm; } LCD_E = 1; for(tout = 0; tout < 200; tout++) { _asm NOP _endasm; } LCD_E = 0; } void lcd_write_data(unsigned char dta) { static unsigned short tout; LCD_RW = 0; LCD_RS = 0; LCD_E = 0; LCD_DATA_DIR = DATA_DIR_OUT; LCD_DATA_OUT = dta; for(tout = 0; tout < 100; tout++) { _asm NOP _endasm; } LCD_E = 1; for(tout = 0; tout < 100; tout++) { _asm NOP _endasm; } LCD_E = 0; } Code für Disaplay-Init im Grafikmodus, 192 x 32 Pixel: void lcd_init_gfx(void) { unsigned short cnt; // display control lcd_write_cmd (0b00000000); lcd_write_data(0b00000010); // character pitch lcd_write_cmd (0b00000001); lcd_write_data(0x77); // num chars lcd_write_cmd (0b00000010); lcd_write_data(23); // display duty lcd_write_cmd (0b00000011); lcd_write_data(32); // cursor postition lcd_write_cmd (0b00000100); lcd_write_data(0); // display start lower lcd_write_cmd (0b00001000); lcd_write_data(0); // display start upper lcd_write_cmd (0b00001001); lcd_write_data(0); // cursor lower lcd_write_cmd (0b00001010); lcd_write_data(0); // cursor upper lcd_write_cmd (0b00001011); lcd_write_data(0); // write data -> all 0 -> clear display // display clar for(cnt = 0; cnt < 768; cnt++) { lcd_write_cmd (0b00001100); lcd_write_data(0); } // display control lcd_write_cmd (0b00000000); lcd_write_data(0b00100010); } Code für Display-Init im Textmodus, 5x8 Pixel Zeichen interner Zeichensatz, 32 zeichen pro Zeile, 4 Zeilen: void lcd_init_txt_internal_cg(void) { unsigned short cnt; // display control lcd_write_cmd (0b00000000); lcd_write_data(0b00000000); // character pitch lcd_write_cmd (0b00000001); lcd_write_data(0x75); // num chars lcd_write_cmd (0b00000010); lcd_write_data(30); // display duty lcd_write_cmd (0b00000011); lcd_write_data(32); // cursor postition lcd_write_cmd (0b00000100); lcd_write_data(0); // display start lower lcd_write_cmd (0b00001000); lcd_write_data(0); // display start upper lcd_write_cmd (0b00001001); lcd_write_data(0); // cursor lower lcd_write_cmd (0b00001010); lcd_write_data(0); // cursor upper lcd_write_cmd (0b00001011); lcd_write_data(0); // write data -> clear display for(cnt = 0; cnt < 128; cnt++) { lcd_write_cmd (0b00001100); lcd_write_data(32); } // display control lcd_write_cmd (0b00000000); lcd_write_data(0b00100000); } Code für Display-Init im Textmodus, 8x16 Pixel Zeichen externer Zeichensatz, 24 zeichen pro Zeile, 2 Zeilen: void lcd_init_txt_external_cg(void) { unsigned short cnt; // display control lcd_write_cmd (0b00000000); lcd_write_data(0b00000001); // character pitch lcd_write_cmd (0b00000001); lcd_write_data(0xF7); // num chars lcd_write_cmd (0b00000010); lcd_write_data(22); // display duty lcd_write_cmd (0b00000011); lcd_write_data(32); // cursor postition lcd_write_cmd (0b00000100); lcd_write_data(0); // display start lower lcd_write_cmd (0b00001000); lcd_write_data(0); // display start upper lcd_write_cmd (0b00001001); lcd_write_data(0); // cursor lower lcd_write_cmd (0b00001010); lcd_write_data(0); // cursor upper lcd_write_cmd (0b00001011); lcd_write_data(0); // write data -> clear display for(cnt = 0; cnt < 48; cnt++) { lcd_write_cmd (0b00001100); lcd_write_data(32); } // display control lcd_write_cmd (0b00000000); lcd_write_data(0b00100001); }