#include<avr\io.h>
#include<inttypes.h>
#include<avr\signal.h>
#include<avr\interrupt.h>
#include<avr\delay.h>
uint8_t g_AktWyswietlacz = 0;
uint8_t g_DaneWyswietlacza[4];
uint8_t g_DaneCom[4] = (~(1<<6),~(1<<5),~(1<<4),~(1<<3));
int main(void)
{
PORTB = 0xff;
DDRD = 1<<6 | 1<<5 | 1<<4 | 1<<3;
TCCR0 =1<<CS01 | 1<<CS00;
TIMSK = 1<<TOIE0;
sei();
g_DaneWyswietlacza[0] = ~(1<<1 | 1<<2);
g_DaneWyswietlacza[1]= ~( 1<<0 | 1<<1 | 1<<3 | 1<<4 | 1<<5);
g_DaneWyswietlacza[2]= ~( 1<<0 | 1<<1 | 1<<3 | 1<<4 | 1<<5);
g_DaneWyswietlacza[3]= ~( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<5);
for(;;)
{
}
return 0;
}
SIGNAL(SIG_OVERFLOW0) //0-ZERO
{
PORTD |= 1<<6 | 1<<5 | 1<<4 | 1<<3;
PORTB = g_DaneWyswietlacza[g_AktWyswietlacz];
PORTB &= g_DaneCom[g_AktWyswietlacz];
++g_AktWyswietlacz;
if (g_AktWyswietlacz > 3)
g_AktWyswietlacz=0;
}
Wyświetla taki komunikat:
> "make.exe" all
-------- begin --------
avr-gcc (WinAVR 20090313) 4.3.2
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: w_3znaki.c
avr-gcc -c -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./w_3znaki.lst -std=gnu99 -MMD -MP -MF .dep/w_3znaki.o.d w_3znaki.c -o w_3znaki.o
In file included from w_3znaki.c:3:
c:/winavr-20090313/lib/gcc/../../avr/include/avr\signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>."
In file included from w_3znaki.c:5:
c:/winavr-20090313/lib/gcc/../../avr/include/avr\delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>."
w_3znaki.c:9: warning: left-hand operand of comma expression has no effect
w_3znaki.c:9: warning: left-hand operand of comma expression has no effect
w_3znaki.c:9: warning: left-hand operand of comma expression has no effect
w_3znaki.c:9: error: invalid initializer
w_3znaki.c: In function 'main':
w_3znaki.c:16: error: 'TCCR0' undeclared (first use in this function)
w_3znaki.c:16: error: (Each undeclared identifier is reported only once
w_3znaki.c:16: error: for each function it appears in.)
make.exe: *** [w_3znaki.o] Error 1
> Process Exit Code: 2
> Time Taken: 00:00
Wiem, że jest coś nie tak m. in. z "TCCR0" - wydaje mi się że dyrektywą include załączyłem odpowiedni plik.
Z góry dziękuję