avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] Interrupt and signal on UART


From: gianni rossi
Subject: [avr-libc-dev] Interrupt and signal on UART
Date: Mon, 9 May 2005 11:48:33 +0200 (CEST)

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
address@hidden

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]