Hallo, iche ersuche gerade verzweifelt mein LCD von Reichelt Displaytech 164A im 4-Bit-Modus zu initialisieren. Ich habe mich so gut es ging an das Datenblatt gehalten. folgender Anschlussplan: PB0-->DB4 PB1-->DB5 PB2-->DB6 PB3-->DB7 PB4-->RS PB5-->R/W PB6-->EN Code:
1 | void Enable(void) |
2 | {
|
3 | // Enable = HIGH
|
4 | // 1us warten
|
5 | // Enable = LOW
|
6 | EN = 1; |
7 | delay_us(1); |
8 | EN = 0; |
9 | |
10 | }
|
11 | |
12 | void Init_LCD(void) |
13 | {
|
14 | // Port B initialisieren
|
15 | DDRB = 0x7F; |
16 | PORTB = 0x00; |
17 | // mind. 15ms warten damit der Controller initialisiert ist
|
18 | delay_ms(16); |
19 | // 0x30 senden
|
20 | PORTB = 0x03; |
21 | Enable(); |
22 | delay_ms(6); |
23 | Enable(); |
24 | delay_us(300); |
25 | Enable(); |
26 | // auf 4-Bit Modus umstellen
|
27 | PORTB = 0x02; |
28 | Enable(); |
29 | delay_ms(5); |
30 | // 2-Zeilen 5x8 Dot
|
31 | PORTB = 0x08; |
32 | Enable(); |
33 | delay_us(50); |
34 | // Clear Display
|
35 | PORTB = 0x00; |
36 | Enable(); |
37 | PORTB = 0x01; |
38 | Enable(); |
39 | delay_us(5); |
40 | // Display an; Cursor an; Blinken an
|
41 | PORTB = 0x00; |
42 | Enable(); |
43 | PORTB = 0x08; |
44 | |
45 | }
|
Habe es auch schon mit dem Tutorial verglichen und kann keinen Fehler entdecken. Ich hoffe Ihr könnt mir helfen! Vielen Dank