Gast
#168462
Ich will eine Verzögerung programmieren, und habe es wie folgt gemacht:
void warte(uint16_t t) { //
Funktion "Warteschleife"
uint16_t i, j;
for (i=0;i<t;i++) { //
Verschachtelte Schleife mit Befehl NOP="Tue nichts", damit
for (j=1;j<200;j++) { // die
Schleife
nicht wegoptimiert wird.
asm volatile ("nop");
}
}
}
Ich rufe die Funktion mit warte(2000) in main auf...
Leider bekomme ich prompt eine Fehlermeldung:
Compiling: main.c
avr-gcc -c -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=8000000UL -Os
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=main.lst -std=gnu99 -MD -MP -MF
.dep/main.o.d main.c -o main.o
main.c: In function `main':
main.c:20: warning: implicit declaration of function `warte'
main.c: At top level:
main.c:30: error: conflicting types for 'warte'
main.c:20: error: previous implicit declaration of 'warte' was here
main.c:38:2: warning: no newline at end of file
make.exe: *** [main.o] Error 1
Was mache ich falsch ?