Hallo
also hat mir schon einmal geholfen danke. Aber wenn ich diesen code einfüge zeigt es ein fehler an. Das clean und make tool habe ich richtig eingestelt diese funktionieren auch nur jetzt zeigt es mir diese fehler an.
Kann mir jemand sagen was der fehler daran ist. Ich hab auch auf die richtige datei usw geachtet.
Code:
/*******************************************************************************
*
* File Name: RechteckDemo.c
* Project : Demo
*
* Description: This file contains RechteckDemo
*
* Ver. Date Author Comments
* ------- ---------- -------------- ------------------------------
* 1.00 14.08.2003 Jan Grewe build
* 2.00 22.10.2003 Jan Grewe angepasst auf asuro.c Ver.2.10
*
* Copyright (c) 2003 DLR Robotics & Mechatronics
*****************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* any later version. *
***************************************************************************/
#include "asuro.h"
#define LEFT 0
#define RIGHT 1
#define LINE 0
#define EDGE 1
SIGNAL (SIG_ADC)
{
static unsigned char tmp[2],flag[2],toggle;
static unsigned char state = LINE, posFlag[2] = {FALSE,FALSE};
static unsigned char pos[2] = {0,0};
static unsigned char rightSpeed = 200, leftSpeed = 200;
tmp[toggle]= ADCH;
if (toggle) ADMUX = (1 <<ADLAR) | (1 <<REFS0) | WHEEL_RIGHT;
else ADMUX = (1 <<ADLAR) | (1 <<REFS0) | WHEEL_LEFT;
if ( (tmp[toggle] < 128) && (flag[toggle] == TRUE)) {
pos[toggle] ++;
flag[toggle] = FALSE;
}
if ( (tmp[toggle] > 128) && (flag[toggle] == FALSE)) {
pos[toggle] ++;
flag[toggle] = TRUE;
}
toggle ^= 1;
if (state == LINE) {
if (pos[LEFT] > 100) {
leftSpeed = 0;
pos[LEFT] = 0;
posFlag[LEFT] = TRUE;
}
if (pos[RIGHT] > 100) {
rightSpeed = 0;
pos[RIGHT] = 0;
posFlag[RIGHT] = TRUE;
}
if (posFlag[RIGHT] == TRUE && posFlag[LEFT] == TRUE) {
state = EDGE;
leftSpeed = 180;
}
}
if (state == EDGE) {
if (pos[LEFT] > 50) {
leftSpeed = 0;
pos[LEFT] = 0;
posFlag[LEFT] = posFlag[RIGHT] = FALSE;
state = LINE;
leftSpeed = rightSpeed = 200;
}
}
MotorSpeed(leftSpeed,rightSpeed);
}
void RechteckDemo(void)
{
Init();
cli();
MotorSpeed(200,200);
DDRC &= ~ ((1<<PC0) | (1<<PC1)); // Input => no break LED
ODOMETRIE_LED_ON;
ADCSRA = (1<<ADEN) | (1<<ADFR) | (1<<ADIE) | (1<<ADSC) | (1<<ADPS0) | (1<<ADPS1) | (1<<ADPS2); // clk/128
ADMUX = (1<<ADLAR) | (1<<REFS0) | WHEEL_LEFT; // AVCC reference with external capacitor
sei();
for(;;);
}
dann kommt der fehler
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=asuro.lst asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
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.
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
avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c -o asuro.o
avr-gcc -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.o test.o asuro.o --output test.elf -Wl,-Map=test.map,--cref -lm
C:\WinAVR\bin\..\lib\gcc-lib\avr\3.3.1\..\..\..\..\avr\lib\avr4\crtm8.o(.in it9+0x0): undefined reference to `main'
make: *** [test.elf] Error 1
> Process Exit Code: 2
Lesezeichen