Werbung
Kopieren, SPEICHERN, maken, flashen
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
dann kommt das dabei raus
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o
test.c:5: error: parse error before "MyPollSwitch"
test.c:6: warning: return type defaults to `int'
test.c: In function `MyPollSwitch':
test.c:7: error: `uint16_t' undeclared (first use in this function)
test.c:7: error: (Each undeclared identifier is reported only once
test.c:7: error: for each function it appears in.)
test.c:7: error: parse error before "i"
test.c:19: error: `i' undeclared (first use in this function)
test.c: In function `SwitchTest':
test.c:30: error: `uint8_t' undeclared (first use in this function)
test.c:30: error: parse error before "i"
test.c:31: error: `uint16_t' undeclared (first use in this function)
test.c:33: error: `i' undeclared (first use in this function)
test.c:35: warning: implicit declaration of function `SerPrint'
test.c:36: warning: implicit declaration of function `PrintInt'
test.c:39: error: `adval' undeclared (first use in this function)
test.c:44: error: `j' undeclared (first use in this function)
test.c:46: error: `mval' undeclared (first use in this function)
test.c:53: warning: implicit declaration of function `Msleep'
test.c:67:2: warning: no newline at end of file
make: *** [test.o] Error 1
> Process Exit Code: 2
Wir kommen weiter. Versuche mal den Quellcode von mir aus dem obrigen Beitrag.
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
#include "asuro.h"
int main()
{
Init();
int i=0;
for (i=0;i<100;++i)
{
BackLED (OFF, ON);
Msleep(200);
BackLED (ON, OFF);
Msleep(200);
}
BackLED (OFF, OFF);
while (1); //ansonsten endlos
return 0; //wird nicht erreicht
}
das probiere ich gerade mal ! msleep kriegt er nur nicht hin ! mach ich nur sleep gehen beide leds an und bleiben an
ich bin kurz vorm verstaendniss![]()
So vielleicht?
(ungetestet)Code:#include "asuro.h" int main(void) { void Msleep(unsigned int dauer) // dauer in millisekunden { if(dauer) while(dauer--) Sleep(72); // Sleep(72) dauert 1 ms } int i=0; Init(); for (i=0;i<100;++i) { BackLED (OFF, ON); Msleep(200); BackLED (ON, OFF); Msleep(200); } BackLED (OFF, OFF); while(1) {StatusLED(RED); Msleep(20); StatusLED(OFF); Msleep(200);} //ansonsten endlos return 0; //wird nicht erreicht }
Spannenderweise kann ich das auch mit meiner v2.3er-Version fehler- und warnungsfrei kompilieren, weil die neue Funktion Msleep() lokal in main() ist? Wieder was gelernt.
Gruß
mic
Geändert von radbruch (20.10.2011 um 14:07 Uhr) Grund: unsigned int ist besser ;)
![]()
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Lesezeichen