avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Is this a Stack problem?


From: Eric Fu
Subject: Re: [avr-gcc-list] Is this a Stack problem?
Date: Sat, 24 Jan 2004 10:51:46 +1100

It turns out the problem was with the unused IO locations. I was trying to
use TWBR, TWDR, TWAR as flag and variables for the software UART. And I
defined them as:
#define UART1FLAG    TWBR //IO for TWI not used, used here for bit operation
#define BUSY 0 // 1=UART1 is busy. if only this bit is set, UART is
receiving
#define TD  1 // 1=Transmitting data
#define RDR  2 // 1=Receive data ready
#define START_BIT 3 // 1=start bit has completed
#define TDC  4  //  1=Transmit data complete

#define BIT_CNTR     TWDR //IO for TWI not used, used here for bit operation
#define UDR1   TWAR

I finally defined the following, and erverything works fine:
volatile byte UART1FLAG;
volatile byte BIT_CNTR;
volatile byte UDR1;

My question is: Aren't IO locations volatile by nature?
                        What's wrong with ' #define UART1FLAG    TWBR  ' ?
                        What is the correct way to use the unused IO?
Thanks.

Eric Fu

----- Original Message ----- 
From: "Bjarne Laursen" <address@hidden>
To: <address@hidden>
Sent: Thursday, January 22, 2004 6:43 PM
Subject: Re: [avr-gcc-list] Is this a Stack problem?


> At 21:18 20-01-2004, you wrote:
> >INTERRUPT(SIG_OUTPUT_COMPARE0) //timer0 compare match INT
>
> You may want to use SIGNAL  instead of INTERRUPT.
> INTERRUPT will reenable global interrupt and alllow the interrupt to
> interrupt itself. You must be careful if you use this methode.
> Running out of stack is just one of the problems you will have.
>
> SIGNAL does the same as INTERRUPT but does not reenable global interrupt.
>
> -Bjarne
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list




reply via email to

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