[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Volatile "Word" registers
From: |
David Brown |
Subject: |
Re: [avr-gcc-list] Volatile "Word" registers |
Date: |
Tue, 28 Oct 2003 09:13:48 +0100 |
> I saw this thread maybe a while back, but can't find references.. Is it
> "safe" in GCC to access 16-bit timer1 registers (OCR1A, etc.) as word-wide
> variables, or explicitly divide the operation into bytes. I'm not worried
> about splitting accesses across an interrupt, etc. (this has to be managed
> either way), but I am worried about the compiler accessing the halves in
> proper order. Looking at code, it *seems* to in the cases I see, but is
> this just happenstance or a feature of AVR-GCC?
>
> Thanks.
>
In short, yes it is safe. I can't remember off hand the order you have to
use when reading or writing the 16-bit timers, but avrgcc knows and gets it
right.
mvh,
David