On Sun, 6 Dec 2009, Jim Wagner wrote: >> #define UCSRC _SFR_IO8(0x20) >> #define UBRRH _SFR_IO8(0x20) > If I recall correctly, those two DO share the address and require a > data bit to distinguish which is which. It is NOT a compiler error. Thanks for your input, Jim. I originally used the USART C code from the data sheet, which worked fine with ATtiny2313. The C code in the data sheet for the ATmega8 is identical, and as such I'd expect the program to port cleanly between these microcontrollers by simply specifying a different -mmcu flag. Strangely, the code didn't work on atmega8 as soon as I specified -mmcu=atmega8, but it did when I specifield -mmcu=attiny2313. After the changes that I outlined in my previous post, the code ports and works transparantly on either uC, as I would have expected. If the ATmega8 would need setting a data bit to distinguish between UCSRC and UBRRH, then my proposed change to the header file would not have made it work; this evidence suggests that there was, in fact, a bug in the mentioned header file. As the ATmega8 *does* send data through the USART now, I wonder if I'm overlooking something trivial? Best, Marc
Message
Re: [AVR-Chat] avr-gcc ATMega8 USART trouble, was: Compile problem
2009-12-06 by Marc R.J. Brevoort
Attachments
- No local attachments were found for this message.