Danke für deine Hilfe Bernhard!!!
Guck dir butte das an:
Ich bekomme folgende Fehlermeldungen:Code:/*****************************************************************************/ // Includes: #include "RP6ControlLib.h" // The RP6 Control Library. // Always needs to be included! //#include "RP6I2CmasterTWI.h" /*****************************************************************************/ /*****************************************************************************/ //***********************************************// // VOID USLEEP // Wartet fuer 100*usec Mikro-Sekunden // = msleep mit 10x hoeherer Aufloesung // msleep(1) entspricht usleep(10) //***********************************************// void usleep(unsigned char usec) { for (int s=0; s<usec; s++) { for (long int i=0; i<140; i++) { asm volatile("nop"); asm volatile("nop"); } } } /*****************************************************************************/ /*****************************************************************************/ //Auszug aus ibex_header_v117.h //(c) Bernhard Stiehle 2008-2010 //***********************************************// // INT USONIC // liefert den Abstand des Ultraschallsensors // in Zentimetern. Es muss die Type SRF05 sein. // Rueckgabewert -1 = Modul reagiert nicht/ außerhalb Bereich //***********************************************// int usonic() { int ustime=0; //Eine Variable bitte ... danke ! int failure=0; //Sicherheit cbi(DDRA,2); //Anschluss als Eingang cbi(PORTA,2); //Pull-ups sicherheitshalber ausschalten sbi(DDRA,2); //Anschluss als Ausgang cbi(PORTA,2); //Low-Pegel ausgeben usleep(1); //Wartezeit sbi(PORTA,2); //High-Impuls ausgeben (-> Sensor misst) usleep(1); //Warten cbi(PORTA,2); //Impuls Ende cbi(DDRA,2); //Anschluss als Eingang cbi(PORTA,2); //Pull-ups sicherheitshalber ausschalten usleep(1); //warten while( !(PINA & 4) ) //warten, bis der Sensor sein Signal { //zurueckgibt (warten solange low) asm volatile("nop"); asm volatile("nop"); failure++; //Sicherheit: wenn kein Signal nach bestimmter Zeit kommt if(failure>2500) {return -1;} //dann -1 zurueck liefern (= kein Modul angeschlossen) } failure=0; while(PINA & 4) //Signal hat begonnen (=high) { ustime++; //Dauer des Impulses messen usleep(1); //Die Variable will eine Einheit (hier 0,1 ms) failure++; //Sicherheit: wenn Signal nach bestimmter Zeit nicht endet if(failure>5000) {return -1;} //dann -1 zurueck liefern (= kein Modul angeschlossen) } mSleep(35); //Wartezeit (Echo soll verhallen, sonst Fehlmessung) return int( float(ustime)*float(1.408) ); //Rueckgabewert in Zentimeter, bitte ! } /*****************************************************************************/ // Main function - The program starts here: int16_t main(void) { initRP6Control(); // Always call this first! The Processor will not work // correctly otherwise. // Play a sound to indicate that our program starts: sound(100,40,64); sound(170,40,0); mSleep(400); setLEDs(0b0000); initLCD(); // Initialize the LC-Display (LCD) // Always call this before using the LCD! showScreenLCD(" SRF05 ", " Messung "); mSleep(500); //int abstand=usonic(); //FunktionsAufruf // .... (abstand); Ausgabe auf dem LCD return 0; } /*****************************************************************************/
Muss ich an "Makefile" was ändern?Code:-------- begin -------- avr-gcc (GCC) 4.1.2 (WinAVR 20070525) Copyright (C) 2006 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: srf05new.c avr-gcc -c -mmcu=atmega32 -I. -gdwarf-2 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=srf05new.lst -I../../RP6lib -I../../RP6lib/RP6control -I../../RP6lib/RP6common -std=gnu99 -MD -MP -MF .dep/srf05new.o.d srf05new.c -o srf05new.o srf05new.c:39: warning: function declaration isn't a prototype srf05new.c: In function 'usonic': srf05new.c:44: warning: implicit declaration of function 'cbi' srf05new.c:47: warning: implicit declaration of function 'sbi' srf05new.c:82: error: expected expression before 'int' make.exe: *** [srf05new.o] Error 1 > Process Exit Code: 2 > Time Taken: 00:01







Zitieren

Lesezeichen