Problem Compilieren myAVR Workpad Plus waitMs()

Gast #2166031
Lesenswert?

Hallo zusammen,

ich bekomme leider beim Compilieren immer eine Fehlermeldung.
Und kann mir leider nicht erklären von was diese kommen sollte.

Hinweis: Es wird die im Quelltext angegebene Einstellung des Programmer 
verwendet:
Hinweis: Es wird die im Quelltext angegebene Einstellung des Prozessors 
verwendet: ATmega8
compilieren ... Heckwarnabsicherung_u1300.cc  In function `void 
LED_left()':
Heckwarnabsicherung_u1300.cc:67  67: error: `waitMs' was not declared in 
this scope
Heckwarnabsicherung_u1300.cc  In function `void LED_right()':
Heckwarnabsicherung_u1300.cc:88  88: error: `waitMs' was not declared in 
this scope
Heckwarnabsicherung_u1300.cc  In function `void LED_flash()':
Heckwarnabsicherung_u1300.cc:109  109: error: `waitMs' was not declared 
in this scope


Das Programm ist mit myAVR Workpad Plus Demo geschrieben.

Vielen Dank für eure Unterstützung!

//---------------------------------------------------------------------- 
---
// Titel : Heckwarnabsicherung U1300
//---------------------------------------------------------------------- 
---
// Funktion : Der am PortD angelegte Schiebeschalter gibt eine von 3 
Funktionen vor
//            Left    = Lauflicht nach links;
//            Right    = Lauflicht nach rechts
//        Blinklicht  = alle 4 LED`s blinken abwechseln Paarweise
// Schaltung : S1 = PD0; S2 = PD1; S3 = PD2;
//             Speed_adc = PC4;
//             LED_0 = PC0;
//             LED_1 = PC1;
//             LED_2 = PC2;
//             LED_3 = PC3;
//---------------------------------------------------------------------- 
---
// Prozessor : ATmega8
// Takt : 3686400 Hz
// Sprache : C
// Datum : 25.04.2011
// Version : 1.0
// Autor : xxxxx
// Programmer: xxxxx
// Port :
//---------------------------------------------------------------------- 
---
// created by myAVR-CodeWizard
//---------------------------------------------------------------------- 
---
//
#define F_CPU   3686400
#include <avr\io.h>
#include <inttypes.h>
#include <avr\interrupt.h>
void LED_left();
void LED_right();
void LED_flash();
unsigned char getValueADCandWait();
int speed_adc;

SIGNAL(SIG_ADC)
{
}

//---------------------------------------------------------------------- 
--
// Initialisierungen
//---------------------------------------------------------------------- 
--
void init()
{
  // Ports initialisieren
  DDRD   = 0b00000000;
  PORTD  = 0b00011111;
  DDRC   = 0b00011110;
  ADMUX=0xE0; // Port, Referenzspannung und Auflösung
  ADCSRA=0x85; // Modus, Interrupt und Start
  sei();
}

unsigned char getValueADCandWait()
{
  sbi(ADCSRA,6); // Start ADC
  while(ADCSRA & 0x10) // Warten bis fertig
  {}
  int wert=ADCH; // Einlesen des Analogwertes
  return wert;
}

void LED_left()
{
  PORTC = 0b00011110;    // alle LEDs aus
  waitMs(4*speed_adc);

  PORTC = 0b00011100;    // LED0 ein
  waitMs(4*speed_adc);

  PORTC = 0b00011010;    // LED0 aus; LED1 ein
  waitMs(4*speed_adc);

  PORTC = 0b00010110;    // LED1 aus; LED2 ein
  waitMs(4*speed_adc);

  PORTC = 0b00001110;    // LED2 aus; LED3 ein
  waitMs(4*speed_adc);

  PORTC = 0b00011110;    // alle LEDs aus
  waitMs(4*speed_adc);
}

void LED_right()
{
  PORTC = 0b00011110;    // alle LEDs aus
  waitMs(4*speed_adc);

  PORTC = 0b00001110;    // LED3 ein
  waitMs(4*speed_adc);

  PORTC = 0b00010110;    // LED3 aus; LED2 ein
  waitMs(4*speed_adc);

  PORTC = 0b00011010;    // LED2 aus; LED1 ein
  waitMs(4*speed_adc);

  PORTC = 0b00011100;    // LED1 aus; LED0 ein
  waitMs(4*speed_adc);

  PORTC = 0b00011110;    // alle LEDs aus
  waitMs(4*speed_adc);
}

void LED_flash()
{
  PORTC = 0b00011110;    // alle LEDs aus
  waitMs(4*speed_adc);

  PORTC = 0b00010100;    // LED3 ein; LED1 ein;  LED2 aus; LED0 aus
  waitMs(4*speed_adc);

  PORTC = 0b00001010;    // LED2 ein; LED0 ein;  LED3 aus; LED1 aus
  waitMs(4*speed_adc);

  PORTC = 0b00010100;    // LED3 ein; LED1 ein;  LED2 aus; LED0 aus
  waitMs(4*speed_adc);

  PORTC = 0b00001010;    // LED2 ein; LED0 ein;  LED3 aus; LED1 aus
  waitMs(4*speed_adc);

  PORTC = 0b00011110;    // alle LEDs aus
  waitMs(4*speed_adc);
}

//////////////////////////////////////////////////////////////////////// 
/////
// Main-Funktion
//////////////////////////////////////////////////////////////////////// 
/////

main(void)
{
  init();   // Initialisierungen

  do
  {
    speed_adc = getValueADCandWait();

    //Abfrage LED_left S1
    if(!(PIND & 0b00000100))
    {
      LED_left();
    }
    //Abfrage LED_right S2
    if(!(PIND & 0b00001000))
    {
      LED_right();
    }
    //Abfrage LED_flash S1
    if(!(PIND & 0b00010000))
    {
      LED_flash();
    }

  }
  while (true);    // Mainloop-Ende
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren