Скачал, поставил, WinAVR-20060421. Но что-то не сложилось . Взял пример из книги, при компиляции выдаёт ошибку. Как победить?
Код
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
unsigned char OverflowC;
unsigned int EdgeR, EdgeF;
unsigned long PulseClocks;
INTERRUPT(SIG_OVERFLOW1)
{
OverflowC++;
}
INTERRUPT(SIG_INPUT_CAPTURE1 )
{
if ((PIND & 0x40) != 0)
{
EdgeR = ICR1;
TCCR1B = TCCR1B & 0xBF;
OverflowC = 0;
}
else
{
EdgeF = ICR1;
TCCR1B = TCCR1B | 0x40;
PulseClocks = (unsigned long)EdgeF -
(unsigned long)EdgeR +
(unsigned long)OverflowC * 0x10000;
PORTC = PulseClocks / 500;
}
}
int main (void)
{
DDRC = 0xFF;
TCCR1B = 0xC2;
TIMSK = 0x24;
sei();
while(1);
}
Цитата
Compiling: PulsWdth.c
avr-gcc -c -mmcu=at90s8515 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=PulsWdth.lst -std=gnu99 -Wp,-M,-MP,-MT,PulsWdth.o,-MF,.dep/PulsWdth.o.d PulsWdth.c -o PulsWdth.o
PulsWdth.c:13: warning: return type defaults to `int'
PulsWdth.c:13: warning: function declaration isn't a prototype
PulsWdth.c: In function `INTERRUPT':
PulsWdth.c:13: warning: type of "__vector_6" defaults to "int"
PulsWdth.c: At top level:
PulsWdth.c:18: warning: return type defaults to `int'
PulsWdth.c:18: warning: function declaration isn't a prototype
PulsWdth.c:18: error: redefinition of 'INTERRUPT'
PulsWdth.c:13: error: previous definition of 'INTERRUPT' was here
PulsWdth.c: In function `INTERRUPT':
PulsWdth.c:18: warning: type of "__vector_3" defaults to "int"
make.exe: *** [PulsWdth.o] Error 1
> Process Exit Code: 2
> Time Taken: 00:01
Сообщение отредактировал ShuraM - Mar 23 2007, 00:47