Es sieht so aus als ob das Display sich am Ende der Zeile 3 nicht so
verhält wie von der Library erwartet.
Aus der lcd.c:
1 | void lcd_putc(char c)
|
2 | {
|
3 | uint8_t pos;
|
4 |
|
5 |
|
6 | pos = lcd_waitbusy(); // read busy-flag and address counter
|
7 | if (c=='\n')
|
8 | {
|
9 | lcd_newline(pos);
|
10 | }
|
11 | else
|
12 | {
|
13 | #if LCD_WRAP_LINES==1
|
14 | #if LCD_LINES==1
|
15 | if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
|
16 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
|
17 | }
|
18 | #elif LCD_LINES==2
|
19 | if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
|
20 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE2,0);
|
21 | }else if ( pos == LCD_START_LINE2+LCD_DISP_LENGTH ){
|
22 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
|
23 | }
|
24 | #elif LCD_LINES==4
|
25 | if ( pos == LCD_START_LINE1+LCD_DISP_LENGTH ) {
|
26 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE2,0);
|
27 | }else if ( pos == LCD_START_LINE2+LCD_DISP_LENGTH ) {
|
28 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE3,0);
|
29 | }else if ( pos == LCD_START_LINE3+LCD_DISP_LENGTH ) {
|
30 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE4,0);
|
31 | }else if ( pos == LCD_START_LINE4+LCD_DISP_LENGTH ) {
|
32 | lcd_write((1<<LCD_DDRAM)+LCD_START_LINE1,0);
|
33 | }
|
34 | #endif
|
35 | lcd_waitbusy();
|
36 | #endif
|
37 | lcd_write(c, 1);
|
38 | }
|
39 |
|
40 | }/* lcd_putc */
|
Ändere ich die Zeile
1 | }else if ( pos == LCD_START_LINE3+LCD_DISP_LENGTH ) {
|
in
1 | }else if ( pos == LCD_START_LINE3+LCD_DISP_LENGTH-1 ) {
|
so funktioniert der Umbruch in die vierte Zeile, aber ein Zeichen zu
früh natürlich. Ohne die -1 wird wieder in Zeile zwei gesprungen.
Oben in der Funktion wird der aktuelle Adresszähler des Displays
ausgelesen. Im Display-RAM ist die Organisation ja etwas eigentümlich,
wohl um Displays mit weniger Zeilen und mehr Zeichen pro Zeile zu
unterstützen. Offenbar scheint aber nun mein spezielles (oder alle 4x20
Displays mit dem HD44780?) nach der Zeile drei von selbst einen "Line
Wrap" zu machen auf die Display-Zeile 2.
Verwendet sonst keiner die Fleury Lib mit einem 4x20? Hat jemand eine
andere Lib im Einsatz für ein 4x20? Würde mich interessieren ob der
"Bug" auch bei anderen 4x20 existiert oder ob sonst andere Libs
existieren, die z.B. den Adresszähler selbst vorhalten. Die Fleury Lib
ist ja sonst recht vollständig, würde gern dabei bleiben. Habe aber auch
nicht so viel Lust, ein Workaround einzubauen...
[edit]Habe gerade hier nochmal ein Speicher"diagramm" irgendwo geklaut:
1 | 2x40 display:
|
2 | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 01 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27
|
3 | 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67
|
4 |
|
5 | 4x20 display:
|
6 | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
|
7 | 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53
|
8 | 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27
|
9 | 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 64 65 66 67
|
Es ist genau die Stelle 27, bei der das Display offenbar von selbst
wrapped auf die Stelle 40[/edit]