Hallo
Habe wieder ein Problem mit dem eDIP128 und Auswahl von
Font(Schriftarten)
Die Auswahl der Font mache ich mit
1 | void Graphik_Auswahl_Font(int8_t f) // Auswahl Font (Schrift)
|
2 | {
|
3 | int bcc;
|
4 | bcc = 0x11 + 0x04 + 0x1b + 'Z' + 'F' + f;
|
5 | i2c_start(slave_adresse_1);
|
6 | i2c_write(0x11); // DC1 0x11
|
7 | i2c_write(0x04); // len
|
8 | i2c_write(0x1b); // ESC 0x1b
|
9 | i2c_write('Z');
|
10 | i2c_write('F');
|
11 | i2c_write(f);
|
12 | i2c_write(bcc);
|
13 | i2c_start(slave_adresse_2);
|
14 | e = i2c_readAck();
|
15 | i2c_stop();
|
16 | itoa( e, Buffer, 10 );
|
17 | lcd_printlc(3,1,Buffer);
|
18 | }
|
Die Ausgabe des Textes erfolgt danach mit
1 | void Graphik_Text_ausgabe(int8_t x1, int8_t y1, char * Text)
|
2 | {
|
3 | int bcc,i;
|
4 | bcc = 0x11 + 0x06 + 0x1b + 'Z' + 'L' + x1 + y1 + strlen(Text);
|
5 | for (i=0; i<=strlen(Text); i++)
|
6 | bcc += Text[i];
|
7 | i2c_start(slave_adresse_1);
|
8 | i2c_write(0x11);
|
9 | i2c_write(0x06 + strlen(Text));
|
10 | i2c_write(0x1b);
|
11 | i2c_write('Z');
|
12 | i2c_write('L');
|
13 | i2c_write(x1);
|
14 | i2c_write(y1);
|
15 |
|
16 | for (i=0; i<=strlen(Text); i++)
|
17 | i2c_write(Text[i]);
|
18 | i2c_write(bcc);
|
19 |
|
20 | i2c_stop();
|
21 | }
|
Der Aufruf aus dem Programm erfolgt damit
1 | Graphik_Auswahl_Font(5); // ok
|
2 | _delay_ms(1);
|
3 | Graphik_Text_ausgabe(5,15,"Test Nr 1");
|
4 | _delay_ms(1);
|
Das funktioniert super.
Das eigentlich Problem dabei ist der mehrfache Aufruf bzw.
unterschiedliche Fonts.
Beispiel:
1 | Graphik_Auswahl_Font(2); // ok
|
2 | _delay_ms(1);
|
3 | Graphik_Text_ausgabe(5,5,"Test");
|
4 | _delay_ms(1);
|
5 |
|
6 | Graphik_Auswahl_Font(5); // ok
|
7 | _delay_ms(1);
|
8 | Graphik_Text_ausgabe(5,15,"Test Nr 1");
|
9 | _delay_ms(1);
|
Es werden zwei unterschiedliche Fonts (Font2 und Font5) aufgerufen. Die
Ausgabe ist gleich. Es werden beide Fonts in der gleichen Schriftart
dargestellt.
Warum ?
achim