Hey Leute, hab ein ähnliches Problem wie dieses hier möchte zum
erstenmal mein LCD mit meinem mega8 ansteuern:
Beitrag "Fleurys LCD Library - undefined reference to..."
habe die Tips dort verfolgt nur leider kam ich nicht zum erfolg.
Meine Hardware:LCD 202A :: LCD-MODUL 20X2
http://www.reichelt.de/?;ACTION=3;LA=444;GROUP=A5211;GROUPID=3005;ARTICLE=31658;START=0;SORT=artnr;OFFSET=16;SID=26@Ln3DawQARoAABxw45Qe9735b0fe9fa86f55d674378a999f79f
*Meine Fehlerausgabe im Debuger:*
../../../../../WinAVR-20100110/avr/include/lcd.c: In function
'lcd_write':
../../../../../WinAVR-20100110/avr/include/lcd.c:109: error:
'LCD_DATA_PORT' undeclared (first use in this function)
../../../../../WinAVR-20100110/avr/include/lcd.c:109: error: (Each
undeclared identifier is reported only once
../../../../../WinAVR-20100110/avr/include/lcd.c:109: error: for each
function it appears in.)
../../../../../WinAVR-20100110/avr/include/lcd.c: In function
'lcd_read':
../../../../../WinAVR-20100110/avr/include/lcd.c:160: error:
'LCD_DATA_PORT' undeclared (first use in this function)
../../../../../WinAVR-20100110/avr/include/lcd.c: In function
'lcd_puts_p':
../../../../../WinAVR-20100110/avr/include/lcd.c:380: warning: implicit
declaration of function 'PRG_RDB'
../../../../../WinAVR-20100110/avr/include/lcd.c: In function
'lcd_init':
../../../../../WinAVR-20100110/avr/include/lcd.c:402: error:
'LCD_DATA_PORT' undeclared (first use in this function)
make: *** [lcd.o] Error 1
Build failed with 5 errors and 1 warnings...
Das ist mein Code:
1 |
|
2 | #include <avr/io.h>
|
3 | #include <util/delay.h> // Headerdadei für delay Funktion
|
4 | #include <avr/sleep.h>
|
5 | #include <avr/pgmspace.h>
|
6 | #include "lcd.h"
|
7 |
|
8 |
|
9 | int main (void)
|
10 | {
|
11 |
|
12 |
|
13 | /* Initialisiere Display, Cursor aus */
|
14 | lcd_init(LCD_DISP_ON);
|
15 |
|
16 | /* loesche das LCD Display und Cursor auf 1 Zeile, 1 Spalte */
|
17 | lcd_clrscr();
|
18 |
|
19 | /* String auf Display anzeigen */
|
20 | lcd_puts("Hello world.");
|
21 |
|
22 |
|
23 |
|
24 | }
|
*Anschluss vermutlich noch unintressant... :*
DB 4 -> Pc2
DB 5 -> Pc3
DB 6 -> Pc4
DB 7 -> Pc5
RS -> PB5
R/W -> PB6
E -> PB7
lcd.h:
1 | ....
|
2 | #define LCD_LINES 2 /**< number of visible lines of the display */
|
3 | #define LCD_DISP_LENGTH 20 /**< visibles characters per line of the display */
|
4 | #define LCD_LINE_LENGTH 0x40 /**< internal line length of the display */
|
5 | #define LCD_START_LINE1 0x00 /**< DDRAM address of first char of line 1 */
|
6 | #define LCD_START_LINE2 0x40 /**< DDRAM address of first char of line 2 */
|
7 | #define LCD_START_LINE3 0x14 /**< DDRAM address of first char of line 3 */
|
8 | #define LCD_START_LINE4 0x54 /**< DDRAM address of first char of line 4 */
|
9 | #define LCD_WRAP_LINES 0 /**< 0: no wrap, 1: wrap at end of visibile line */
|
10 |
|
11 |
|
12 | #define LCD_IO_MODE 1 /**< 0: memory mapped mode, 1: IO port mode */
|
13 | #if LCD_IO_MODE
|
14 | ....
|
15 |
|
16 |
|
17 | ....
|
18 | #define LCD_PORT PORTC /**< port for the LCD lines */
|
19 | #define LCD_DATA0_PORT LCD_PORT /**< port for 4bit data bit 0 */
|
20 | #define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */
|
21 | #define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */
|
22 | #define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */
|
23 | #define LCD_DATA0_PIN 2 /**< pin for 4bit data bit 0 */
|
24 | #define LCD_DATA1_PIN 3 /**< pin for 4bit data bit 1 */
|
25 | #define LCD_DATA2_PIN 4 /**< pin for 4bit data bit 2 */
|
26 | #define LCD_DATA3_PIN 5 /**< pin for 4bit data bit 3 */
|
27 | #define LCD_RS_PORT PORTD /**< port for RS line */
|
28 | #define LCD_RS_PIN 5 /**< pin for RS line */
|
29 | #define LCD_RW_PORT LCD_PORT /**< port for RW line */
|
30 | #define LCD_RW_PIN 6 /**< pin for RW line */
|
31 | #define LCD_E_PORT LCD_PORT /**< port for Enable line */
|
32 | #define LCD_E_PIN 7 /**< pin for Enable line */
|
33 | ....
|
Hoffe ihr könnt mir Helfen (-: *Wo liegt der Fehler? liegt es an der
lcd.c die erkennt er doch ode? Müsste doch alles korrekt eingebunden
sein?* An der lcd.c habe ich nichts verändert habe ich irgendwo ausem
Netz mir geladen...
Gruß
TZU