For those who are starting to write XMEGA A programs, here's a warning -- there's a difference in writing 16-bit registers in XMEGA A vs. AVR: XMEGA A requires the low byte to be written first whereas the AVR requires the high byte to be written first. For those like myself who have cross-MCU / cross-compiler compatibility macros and are using XMEGA A's, it's time to modify them for 16-bit register write access on XMEGA A.
XMEGA 16-bit register write difference
Thanks for the 'head up', Kevin. I had received my two samples yesterday...
Have fun.
Hmmm--there has been discussion on the compiler boards since WAAYY back on the merits and demerits of having the compiler do "frog = TCNT1;" and "TCNT1 = frog;" when TCNT1H/L are out of I/O space. Especially when the access is "hidden" via a pointer access. And consider the case where someone gets "tricky" in a tight piece of code and only read or wrote the "safe" half.
CodeVision handled the "general" case by doing code generation for 16-bit reads & writes in the "proper" AVR order as a matter of course which covered all but the tricky cases.
So I suppose that will have to change for Xmega targets for writes. That will be a good thing to check when I get my samples and try some programs.
Lee
All good points, Lee. For myself, I've moved away from compiler generated 16-bit access to writing 8-bit access to multi-byte registers. Both approaches have merits.