Gast
#177329
Hallo.
Ich arbeite gerade an einem Projekt:
Also 2 uC atmega8 und direkte Verbindung über USART. Senden und
empfangen ohne Interrupt funktioniert. Ich möchte aber nicht dauernd
abfragen, ob da was gekommen ist....., also Interrupt:
#include <avr/io.h>
#include <avr/signal.h>
#include <avr/interrupt.h>
...
...
int main (void){
Init_Usart();
sei();
for(;;){
// Set_LED(); /* function alt */
}
}
Bei der Initialisierung habe ich alles so belassen, ausser die Freigabe
fürs Interrupt:
UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
Und dann natürlich statt Set_LED():
SIGNAL(SIG_USART0_RECV){ // aus avr-lib
while(!(UCSRA & (1<<RXC))); // aus datasheet
udr = UDR;
PORTC = udr;
// for (i = 0; i<0x7fff; i++){} // alt
// PORTC = 0x00; //alt
// for (i=0; i<0x7ffe; i++){} //alt
}
Was mache ich falsch??????
Wer kann helfen?????