Hallo zusammen,
ich habe mir folgendes LCD bestellt:
http://www.ebay.de/itm/12864-128x64-LCD-SPI-serial-Graphic-Display-Module-For-Arduino-r3-Raspberry-Pi-y-/201159581980?pt=LH_DefaultDomain_77&hash=item2ed60ba11c
Heute wollte ich es an meinen Atmega328P anschließen und wenigstens das
"Hello world" Beispiel der u8glib Library anzeigen lassen.
Hier der Code:
1 | #include "u8g.h"
|
2 | #include <avr/interrupt.h>
|
3 | #include <avr/io.h>
|
4 |
|
5 | u8g_t u8g;
|
6 |
|
7 | void draw(void)
|
8 | {
|
9 | u8g_SetFont(&u8g, u8g_font_6x10);
|
10 | u8g_DrawStr(&u8g, 0, 15, "Hello World!");
|
11 | }
|
12 |
|
13 | int main(void)
|
14 | {
|
15 | /* select minimal prescaler (max system speed) */
|
16 | CLKPR = 0x80;
|
17 | CLKPR = 0x00;
|
18 | /*
|
19 | CS: PORTB, Bit 2 --> PN(1,2)
|
20 | A0: PORTB, Bit 1 --> PN(1,1)
|
21 | SCK: PORTB, Bit 5 --> PN(1,5)
|
22 | MOSI: PORTB, Bit 3 --> PN(1,3)
|
23 | */
|
24 | //u8g_InitSPI(&u8g, &u8g_dev_st7565_dogm132_sw_spi, PN(1, 5), PN(1, 3), PN(1, 2), PN(1, 1), U8G_PIN_NONE);
|
25 | u8g_InitI2C(&u8g, &u8g_dev_ssd1306_128x64_i2c, U8G_I2C_OPT_NONE);
|
26 |
|
27 | for(;;)
|
28 | {
|
29 | u8g_FirstPage(&u8g);
|
30 | do
|
31 | {
|
32 | draw();
|
33 | } while ( u8g_NextPage(&u8g) );
|
34 | u8g_Delay(100);
|
35 | }
|
36 | }
|
Ich weiß, dass ich dort zunächst mal den falschen Controller anspreche
(SSD1306 statt ST7920), jedoch funktioniert das Compilieren bei mir
nicht einmal...
Hier der Fehler aus dem Programmers Notepad:
1 | > "make.exe" all
|
2 |
|
3 | -------- begin --------
|
4 | avr-gcc (WinAVR 20100110) 4.3.3
|
5 | Copyright (C) 2008 Free Software Foundation, Inc.
|
6 | This is free software; see the source for copying conditions. There is NO
|
7 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
8 |
|
9 |
|
10 | Compiling C: main.c
|
11 | avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./main.lst -std=gnu99 -MMD -MP -MF .dep/main.o.d main.c -o main.o
|
12 |
|
13 | Linking: main.elf
|
14 | avr-gcc -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.o -std=gnu99 -MMD -MP -MF .dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref -lm
|
15 | main.o: In function `draw':
|
16 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:9: undefined reference to `u8g_font_6x10'
|
17 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:9: undefined reference to `u8g_font_6x10'
|
18 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:9: undefined reference to `u8g_SetFont'
|
19 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:10: undefined reference to `u8g_DrawStr'
|
20 | main.o: In function `main':
|
21 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:25: undefined reference to `u8g_dev_ssd1306_128x64_i2c'
|
22 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:25: undefined reference to `u8g_dev_ssd1306_128x64_i2c'
|
23 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:25: undefined reference to `u8g_InitI2C'
|
24 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:29: undefined reference to `u8g_FirstPage'
|
25 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:33: undefined reference to `u8g_NextPage'
|
26 | D:\Dokumente\1_Elektrotechnik\1_Projekte\Bench Supply\SW\Atmega328p/main.c:34: undefined reference to `u8g_Delay'
|
27 | make.exe: *** [main.elf] Error 1
|
28 |
|
29 | > Process Exit Code: 2
|
30 | > Time Taken: 00:01
|
Ich habe nun wirklich lange nach dem Fehler "undefined reference"
gegoogled, habs jedoch nicht zum Laufen gebracht.
Weiß hier jemand Bescheid?
Bin für jede Hilfe dankbar!
Gruß
DM