Witam, od długiego czasu staram się uruchomić odbiornik IR w mojej atmedze, kiedy wydawało mi się, że "tym razem to juz musi działać" pojawiły się błędy z którymi już nie wiem co zrobić postanowiłem zapytać Was.
Kontra uparty PN =[]
Jesteście moją ostatnią deską ratunku
Poprawiłem tytuł - Regulamin. [c_p]
#include <avr/io.h>
#include <avr/interrupt.h>
#include "remote.h"
#define OSC 4
#define LED_ON PORTC |= 0x01
#define LED_OFF PORTC &= 0xFE
unsigned int licznik=0;
void waitms(unsigned char x)
{
unsigned char a, b; // zmnienne licznikowe
for( ; x > 0; --x) // ta pętla zostanie wykonana x-razy
for(b = 10; b > 0; --b) // a ta 10 razy
for(a = 25 * OSC; a > 0; --a) // natomiast ta 100 razy
__asm("nop"); // dodatkowa instrukcja opóźniająca o 1 cykl
// razem to da opóźnienie ok. x * 1ms
// x od 0 do 255
// gdy x = 0 to opóźnienie = 256ms
}
int main (void)
{
LED_ON;
waitms (10);
LED_OFF;
// teraz, przed wejściem do nieskończonej pętli
// uruchamiamy przerwanie INT0 od opadającego zbocza sygnału
ENABLE_INTO_FALLING;
//czekamy chwilę, aż zakończy się stan nieustalony
// spowodowany zmianą trybu pracy wejścia INT0
waitms (10);
//uruchamiamy obsługę systemu przerwań przez mikrokontroler
sei();
// Program wchodzi do nieskończonej pętli
// I jedyne co robi to resetowanie watchdoga
for (;;)
{
asm volatile (
"WDR"::);
}
return (0);
}
SIGNAL(SIG_INTERRUPT0)
{
if(przelacznik==0)
{
LED_ON;
przelacznik=1;
waitms (100);
}
else
{
LED_OFF;
przelacznik=0;
waitms (100);
}
}Kontra uparty PN =[]
> "make.exe" all
avr-gcc -g -Wall -O2 -mmcu=atmega8 -c -o remote.o remote.c
remote.c: In function 'main':
remote.c:40: warning: implicit declaration of function 'cbi'
remote.c:40: warning: implicit declaration of function 'sbi'
remote.c:40: warning: implicit declaration of function 'outp'
avr-gcc -g -Wall -O2 -mmcu=atmega8 -Wl,-Map,remote.map -o remote.elf remote.o
remote.o: In function `main':
D:\Documents and Settings\Michał\Pulpit\I R\remote/remote.c:40: undefined reference to `cbi'
D:\Documents and Settings\Michał\Pulpit\I R\remote/remote.c:40: undefined reference to `sbi'
D:\Documents and Settings\Michał\Pulpit\I R\remote/remote.c:40: undefined reference to `outp'
make.exe: *** [remote.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:00
Jesteście moją ostatnią deską ratunku
Poprawiłem tytuł - Regulamin. [c_p]