Chris Liechti wrote: [... why is SREG preserved over even a short interrupt handler?...]
> I have no clue, but it could be that the processor uses segmented > memory, and that __SREG__ selects the page with the memory > mapped peripherals? No, the AVR doesn't a a paged or indirected memory architecture for anything, except accesses to the EEPROM. I think it's quite a nice processor to program - in assembly language! I wouldn't program it in C at all, personally. Grant Edwards wrote: > Everything is so much cleaner on the MSP430 except for the > MSP430's lack of a TX holding register empty flag and lack > of a TX shift register empty interrupt. At least Atmel got that > right in the AVR ATmega parts. The MSP430 does have a transmit complete flag, it's called TXEPT and it's in UxCTL. You're right it doesn't have a transmit complete interrupt, the AVR is good in that respect. I think the huge interrupt function size is due to the prologue and epilogue code in the interrupt handler. Looking at the problem as an assembly language programmer, you can see most of it isn't needed for your simple example, but I doubt the compiler has that level of insight. > And AVR parts are _expensive_. I honestly don't see why > they're popular at all... I guess they're a good "first microcontroller" for beginners and students. They're available in DIP packages, you can build your own programmer, and the basic development tools are free. None of those things are true of the MSP430, though I'd readily admit that the MSP430 is a much nicer device in almost all respects. I think Atmel realise the benefit of providing an architecture that is easy to start working with. New programmers feel comfortable with it, and carry that familiarity and experience into their first job, so they will choose the AVR architecture if that is feasible. A viral marketing approach, I guess :-) I think the MSP430 is aimed more at the experienced developers, who don't mind paying for tools because their cost is small compared to the money involved with a volume design, and the benefits of a C-friendly architecture have a clear and significant value. Kris k...@abbey.co.nz Kris Heidenstrom Embedded systems design engineer / programmer Abbey Systems Ltd Telemetry specialists Wellington New Zealand Voice +64 -4 -385-6611 Fax +64-4-385-6848