I'm a newbie to AVR & GCC and I'm trying to learn the
use of c to program my avr microcontrollers Atmega128.
I found a problem when I tried to handle INTERRUPT
on UART:
If "SIGNAL" is used to define the handler function
it works, is I use "INTERRUPT" the function halts.
I think I need "INTERRUPT" because in real application
multiple events can happen at the same time.
I'm using WINAVR.
Thank you
[EMAIL PROTECTED]
Here is the simple code a wrote to test these
functions.
#include <avr/io.h>
#include <stdlib.h>
#include <stdio.h>
#include <avr/signal.h>
#include <avr/interrupt.h>
INTERRUPT(__vector_default)
{
}
INTERRUPT(SIG_UART0_RECV)
{
char c;
c = UDR0;
loop_until_bit_is_set(UCSR0A, UDRE0); //Send echo
UDR0 = c;
}
int main (void) {
//UART0 19200 8 N 1
//RX Interrupt = ENABLE
UBRR0H = 0x00;
UBRR0L = 0X0B;
UCSR0A = 0x00;
UCSR0B = 0x98;
UCSR0C = 0x06;
sei();
while (1) {
}
}
___________________________________
Nuovo Yahoo! Messenger: E' molto pi� divertente: Audibles, Avatar, Webcam,
Giochi, Rubrica� Scaricalo ora!
http://it.messenger.yahoo.it
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev