PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Mein programm funktioniert nicht



tortelini66
28.07.2010, 09:15
Hey Leute,
nachdem mir hier schon ein paar mal geholfen wurde,
habe ich ein weiteres problem mit meinem Asuro.
Mein gehirn will einfach nicht darauf kommen was hier falsch ist. :-k :-k ](*,) helft mirhelft mirhelft mir


#include "asuro.h"

int main(void)
{
Init ();
MotorDir(FWD,FWD);
MotorSpeed(160,165);
StatusLED(GREEN);
while (PollSwitch()==0)
{
SerWrite("Alles OK!\n",10);
}
{
MotorDir(RWD,RWD);
MotorSpeed(160,165);
BackLED(ON,ON);
while (PollSwitch()==0)
{
SerWrite("Aua!\n",5);
}
{
MotorSpeed(0,0);
BackLED(OFF,OFF);
while (1)
}


Folgende Fehlermeldung kommt:


C:\ASURO_src\FirstTry>make all
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
-------- begin --------
avr-gcc --version
avr-gcc (GCC) 3.3.1
Copyright (C) 2003 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.

Size before:
test.elf :
section size addr
.text 1570 0
.data 18 8388704
.bss 1 8388722
.noinit 0 8388723
.eeprom 0 8454144
.stab 3216 0
.stabstr 1698 0
Total 6503


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: In function `main':
test.c:21: error: parse error before '}' token
make: *** [test.o] Error 1

> Process Exit Code: 2




viellecht könnt ihr mir noch ein weiteres mal helfen.

(Quelltext formatiert und in Codetags gesetzt von radbruch)

Skroete
28.07.2010, 10:31
Hallo Tortelini,

die geschweiften Klammern werden nicht einfach mal so nach Lust und Laune über das Programm verteilt.
In deinem Programm sind 2 x { die zuviel sind.

Gruss
Skroete

Valen
28.07.2010, 16:46
Und ein punkt komma zu wenig.
Am ende:

BackLED(OFF,OFF);
while (1)
}

Was Skroete vielleicht meint is das der "while (PollSwitch()==0)" schleifen nur ausführen was zwischen den nächsten {} klammern stehen. Also wird es biss anstoßen (oder analoge Störungen) bei Wiederholung SerWrite("Alles OK!\n",10); oder SerWrite("Aua!\n",5); senden. Den funktion anrufen da zwischen nur ein mal. Außerdem fehlt das return 0; Anruf und ein } am ende. Das Anzahl von { klammern muss stimmen mit das Anzahl von } klammern.

(Schaut nach links) \:D/ Ich bin einer "Roboter [b]Experte[b/]" In meiner Traumwelt!