程序如下: #include <avr/io.h> #include <avr/interrupt.h> #include <avr/signal.h> #include <avr/delay.h> #include <stdio.h>
int main(void) {DDRA=0XFF; PORTA=0XFF; } 错误如下: -------- begin -------- avr-gcc (GCC) 3.4.6 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: IO.c avr-gcc -c -mmcu=atmega8 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=IO.lst -std=gnu99 -MD -MP -MF .dep/IO.o.d IO.c -o IO.o In file included from IO.c:4: C:/WinAVR/avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>." In file included from IO.c:5: C:/WinAVR/avr/include/avr/delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>." IO.c: In function `main': IO.c:9: error: `DDRA' undeclared (first use in this function) IO.c:9: error: (Each undeclared identifier is reported only once IO.c:9: error: for each function it appears in.) IO.c:10: error: `PORTA' undeclared (first use in this function) IO.c:11:2: warning: no newline at end of file make.exe: *** [IO.o] Error 1
> Process Exit Code: 2 > Time Taken: 00:0 makefile如下:
# MCU name MCU = atmega8
# Processor frequency. # This will define a symbol, F_CPU, in all source code files equal to the # processor frequency. You can then use this symbol in your source code to # calculate timings. Do NOT tack on a 'UL' at the end, this will be done # automatically to create a 32-bit value in your source code. F_CPU = 8000000
# Output format. (can be srec, ihex, binary) FORMAT = ihex
# Target file name (without extension). TARGET = IO
# List C source files here. (C dependencies are automatically generated.) SRC = $(TARGET).c |