Ich bin glaub ich wie immer mal zu blöd dazu! Ich versuch einfach mal ein simples lcd anzusteuern aba es funktioniert nicht! Ich Krieg nur Blödsinn aufs LCD und der kontrast is von erster zu 2. Zeile extrem unterschiedlich! verwende die lib vom lieben fleury! Programm: ---------------------------------------------------------------------- /* Simple lcd ansteuerung */ #include <avr\io.h> #include <lcd.h> /** * @name Definitions for Display Size * Change these definitions to adapt setting to your display */ #define LCD_LINES 2 /**< number of visible lines of the display */ #define LCD_DISP_LENGTH 16 /**< visibles characters per line of the display */ #define LCD_LINE_LENGTH 0x40 /**< internal line length of the display */ #define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */ #define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */ #define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */ #define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */ #define LCD_WRAP_LINES 0 /**< 0: no wrap, 1: wrap at end of visibile line */ #define LCD_IO_MODE 1 /**< 0: memory mapped mode, 1: IO port mode */ #if LCD_IO_MODE /** * @name Definitions for 4-bit IO mode * Change LCD_PORT if you want to use a different port for the LCD pins. * * The four LCD data lines and the three control lines RS, RW, E can be on the * same port or on different ports. * Change LCD_RS_PORT, LCD_RW_PORT, LCD_E_PORT if you want the control lines on * different ports. * * Normally the four data lines should be mapped to bit 0..3 on one port, but it * is possible to connect these data lines in different order or even on different * ports by adapting the LCD_DATAx_PORT and LCD_DATAx_PIN definitions. * */ #define LCD_PORT PORTC /**< port for the LCD lines */ #define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */ #define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */ #define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */ #define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */ #define LCD_DATA0_PIN 0 /**< pin for 4bit data bit 0 */ #define LCD_DATA1_PIN 1 /**< pin for 4bit data bit 1 */ #define LCD_DATA2_PIN 2 /**< pin for 4bit data bit 2 */ #define LCD_DATA3_PIN 3 /**< pin for 4bit data bit 3 */ #define LCD_RS_PORT LCD_PORT /**< port for RS line */ #define LCD_RS_PIN 4 /**< pin for RS line */ #define LCD_RW_PORT LCD_PORT /**< port for RW line */ #define LCD_RW_PIN 5 /**< pin for RW line */ #define LCD_E_PORT LCD_PORT /**< port for Enable line */ #define LCD_E_PIN 6 /**< pin for Enable line */ #elif defined(_AVR_AT90S4414_) || defined(_AVR_AT90S8515_) || defined(_AVR_ATmega64_) || \ defined(_AVR_ATmega8515_)|| defined(_AVR_ATmega103_) || defined(_AVR_ATmega128_) || \ defined(_AVR_ATmega161_) || defined(_AVR_ATmega162_) /* * memory mapped mode is only supported when the device has an external data memory interface */ #define LCD_IO_DATA 0xC000 /* A15=E=1, A14=RS=1 */ #define LCD_IO_FUNCTION 0x8000 /* A15=E=1, A14=RS=0 */ #define LCD_IO_READ 0x0100 /* A8 =R/W=1 (R/W: 1=Read, 0=Write */ #else #error "external data memory interface not available for this device, use 4-bit IO port mode" #endif int main(void) { unsigned char data = 'H'; lcd_init(LCD_DISP_ON_CURSOR_BLINK); lcd_puts("Hallo"); return 0; } lcd verwend ich jenes das als anhang beigelegt ist! verwend die oberen 4 datenbits und halt die steuerleitungen!
Passt der Controller von diesem LCD-Modell zur Library? Wie ist es an welchen µC angeschlossen? Sind die Definitionen bereits angepasst oder noch nicht?
ich weiß leider nicht welcher controller auf dem lcd drauf is! is an einem ATmega 8515 an PORTC 0..3 angschlossen! Steuerleitungen sind auf PORTC 4..6! so wie beschrieben! Ja die Definitionen sind bereits angepasst! (Zeilen, Zeichen usw..)
Stelle den Block mit den DEFINES vor die Include-Anweisungen, damit die Header-Datei lcd.h die Defines auch mitbekommt. Warum hast du eigentlich die DEFINES aus der lcd.h rausgezogen oder ist das nur hier bei der Frage so? Dann hoffen, dass der Controller im LCD mit dem Controller in der Library kompatibel ist. Ggf. mal den anderen probieren ;-) #define LCD_CONTROLLER_KS0073 0 // Use 0 for HD44780 controller, 1 for KS0073 controller Und die Definition des Taktes (#define XTAL) finde ich bei deinem Code nicht. Bei einem Nicht-4MHz-Quarz und dem Defaultwert (4000000) könnten die Warteschleifen (delay timer) in die Hose gehen, so dass sich das LCD verschluckt... Nicht schlagen, nur der Vollständigkeit wegen: lcd.c muss ebenfalls mit deinen angepassten DEFINES übersetzt werden.
Nachtrag: Der KS0073 ist glaub ich von Samsung und im LCD-Datenblatt steht was von Samsung Controller...
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.