[Top][All Lists]

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

Re: [avr-gcc-list] using UART to send from within SIGNAL(SIG_UART_RECV)

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] using UART to send from within SIGNAL(SIG_UART_RECV) function
Date: Tue, 2 Apr 2002 12:05:07 +0200 (MET DST)

Karsten Becker <address@hidden> wrote:

> When I try to send from within the SIGNAL(SIG_UART_RECV)  function, the 
> sending stops after one character.
> Is there any way to make it possible to send from within this function?

Guess you gotta post your code in order to get help.

Anyway, it's IMHO a bad idea to abuse an interrupt service routine to
do this kind of task, in particular since you're most likely using a
busy-wait loop in order to see when to start sending the next

It's usually better to minimize the code inside the ISRs, and just set
a bit that can be evaluated inside the program's main loop.  Something

volatile struct {
        uint8_t rx_int: 1;
} intflags;

volatile uint8_t rxbuff;

        uint8_t c;

        c = inp(UDR);
        if (bit_is_clear(UCSRA, FE))
                rxbuff = c;
                intflags.rx_int = 1;



        for (;;) {


                if (intflags.rx_int) {
                        intflags.rx_int = 0;
                        <insert your stuff here>

J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/
avr-gcc-list at http://avr1.org

reply via email to

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