Fehler bei winavr

OP #2657120
Lesenswert?

Hallo zusammen,

bin neuling ...

ich habe einen seltsamen Fehler mit winavr (Gestern installiert)



es sollen auf einem pollin evulationboard 2.0 abwechselnt die led 
blinken
habe einen atmega644 verwendet.

die make datei scheint ok..


hier ist mein code:




#include <avr/io.h>
#include <util/delay.h>




int main ()




{
  DDRD = 0b01100000;


  while (1)
  {
  PORTD = 0b00100000;
  _delay=(100);
  PORTD = 0b00000000;
  _delay_ms=(100);
  PORTD = 0b01000000;
  _delay_ms=(100);
  PORTD = 0b00000000;
  _delay_ms=(100);

  }

}



jedesmal wenn ich compiliere meckert der compiler das etwas nicht mit 
der delay funktion stimmt...


error: lvalue required as left operand of assignment



kann jemand helfen ?

Chris
Gast #2657139
Lesenswert?

Chris Franke schrieb:
> Kannst Du mir ein C Buch empfehlen ?
Brian W. Kernigham & Dennis M. Ritchie: The C Programming Language, 
second edition

bzw. auf deutsch

Brian Kernighan & Dennis Ritchie, "Programmieren in C", 2. Ausgabe(!),
Hanser-Verlag

Die "Bibel" der C-Programmierer von den Erfindern der Sprache persönlich 
verfasst.
OP #2657159
Lesenswert?

jetzt kommt die fehlermeldung



> "make.exe" all

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 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 C: main.c
avr-gcc -c -mmcu=atmega644 -I. -gstabs -DF_CPU=8000000UL -Os 
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall 
-Wstrict-prototypes -Wa,-adhlns=./main.lst  -std=gnu99 -MMD -MP -MF 
.dep/main.o.d main.c -o main.o
main.c:11: warning: function declaration isn't a prototype
main.c: In function 'main':
main.c:18: warning: implicit declaration of function '_delay'

Linking: main.elf
avr-gcc -mmcu=atmega644 -I. -gstabs -DF_CPU=8000000UL -Os 
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall 
-Wstrict-prototypes -Wa,-adhlns=main.o  -std=gnu99 -MMD -MP -MF 
.dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref 
-lm
main.o: In function `main':
main.c:18: undefined reference to `_delay'
make.exe: *** [main.elf] Error 1

> Process Exit Code: 2
> Time Taken: 00:02





was hat es damit auf sich ?



Chris
Gast #2657188
Lesenswert?

>>> main.c:18: undefined reference to `_delay'
1
#include <avr/io.h>
2
#include <util/delay.h>
3

4
int main()
5
{
6
  DDRD = 0b01100000;
7
  while (1)
8
  {
9
  PORTD = 0b00100000;
10
  _delay_ms(100);       // <==== statt _delay=(100);
11
  PORTD = 0b00000000;
12
  _delay_ms(100);
13
  PORTD = 0b01000000;
14
  _delay_ms(100);
15
  PORTD = 0b00000000;
16
  _delay_ms(100);
17
  }
18
}
OP #2657191
Lesenswert?

und kann jemand etwas zu diesem Fehler sagen ...


nachdem ich die = Zeichen gelöscht habe bei _delay

kommt jetzt dieser Fehler ...


> "make.exe" all

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 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 C: main.c
avr-gcc -c -mmcu=atmega644 -I. -gstabs -DF_CPU=8000000UL -Os 
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall 
-Wstrict-prototypes -Wa,-adhlns=./main.lst  -std=gnu99 -MMD -MP -MF 
.dep/main.o.d main.c -o main.o
main.c:11: warning: function declaration isn't a prototype
main.c: In function 'main':
main.c:18: warning: implicit declaration of function '_delay'

Linking: main.elf
avr-gcc -mmcu=atmega644 -I. -gstabs -DF_CPU=8000000UL -Os 
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall 
-Wstrict-prototypes -Wa,-adhlns=main.o  -std=gnu99 -MMD -MP -MF 
.dep/main.elf.d main.o --output main.elf -Wl,-Map=main.map,--cref 
-lm
main.o: In function `main':
main.c:18: undefined reference to `_delay'
make.exe: *** [main.elf] Error 1

> Process Exit Code: 2
> Time Taken: 00:02




Chris

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