[Top][All Lists]

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

Re: [avr-libc-dev] RFC: avr/bits.h

From: Mike Murphree
Subject: Re: [avr-libc-dev] RFC: avr/bits.h
Date: Tue, 1 Mar 2005 16:10:09 -0600 (CST)

Joerg Wunsch said:
> As Nicolas Schodet wrote:
>> The interrupt flag bit is read as 1, and writen at 1, this clear the
>> interrupt bit! A warning could be added to the manual.
> There's a paragraph in the FAQ that explains why interrupt flags are
> written as 1 (in short: so that you *don't* need to use read-modify-
> write operations but can write your 1-bit directly).  If you want to
> improve on this description, please tell us so.  Obviously, that will
> only work for IO registers that are dedicated for interrupt flag bits,
> so in the TWCR case, you have to keep a copy of the remaining bits (that
> are not related to the interrupt) elsewhere.

I've always referred to these as bit clears when creating an interrupt
register or equivalent for a FPGA design.  It's simple and it guarantees
that the programmer doesn't clear anything that he didn't mean to...


reply via email to

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