Zitat Zitat von Nadors
moin,
hab grade mit AVR angefangen. benutze winavr.
nun habe ich folgendes problem, wenn ich mein programm so schreibe

#include <io.h>

int main(void) {
DDRB = 0xff;
PORTB = 0x07;
}

und auf "make all" drücke compiliert er und es läuft alles wunderbar

wenn ich es aber so schreibe

#include <io.h>

int main(void) {
outp (0xff,DDRB);
outp (0x07,PORTB);
}

dann bekomme ich folgende meldung

> "make.exe" all

-------- begin --------
avr-gcc (GCC) 3.4.5
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling: bubu.c
avr-gcc -c -mmcu=atmega8 -I. -gstabs -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=bubu.lst -std=gnu99 -MD -MP -MF .dep/bubu.o.d bubu.c -o bubu.o
bubu.c:1:16: io.h: No such file or directory
bubu.c: In function `main':
bubu.c:4: warning: implicit declaration of function `outp'
bubu.c:4: error: `DDRB' undeclared (first use in this function)
bubu.c:4: error: (Each undeclared identifier is reported only once
bubu.c:4: error: for each function it appears in.)
bubu.c:5: error: `PORTB' undeclared (first use in this function)
bubu.c:6:2: warning: no newline at end of file
make.exe: *** [bubu.o] Error 1

> Process Exit Code: 2
> Time Taken: 00:01

kann mir jemand sagen woran das liegt ?

danke,

Nadors
Beim 1. Teil da machst Du eine Zuweisung von je einer Variablen mit einem Wert. Diese Variablen musst Du irgendwo deklariert haben, sonst hättest Du auch schon Fehlermeldungen gehabt.

Beim 2. Teil benutzt Du ione Funktion outp mit 2 Parametern. Wahrscheinlich hast Du falsche Parameter übergeben oder die Funktion ist nicht bekannt (Includefile nicht angegeben).