avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] cbi/sbi


From: Christopher X. Candreva
Subject: Re: [avr-gcc-list] cbi/sbi
Date: Mon, 18 Jul 2005 10:09:07 -0400 (EDT)

On Mon, 18 Jul 2005, Reza Naima wrote:

> dissapearing.  Given that there are a huge number of emails in that
> thread, I was hoping someone could just tell me what replacement of
> cbi/sbi is, or point me to some documentation that describes it.   After

sbi (sfr,bit) can be replaced by  sfr |= _BV(bit)

ie: sbi(PORTB, PB1);  is now PORTB |= _BV(PB1);

This actually is more flexible than having sbi directly, as the optimizer 
will use a hardware sbi if appropriate, or a read/or/write if not.

Likewise, cbi (sfr,bit) is now   sfr &= ~(_BV(bit));


This has gone beyond a FAQ -- this really needs to be put into the avr-libc 
documentation.  Two simple lines (with possibly a sentence about the 
optimizer) will save everyone a lot of time.


==========================================================
Chris Candreva  -- address@hidden -- (914) 967-7816
WestNet Internet Services of Westchester
http://www.westnet.com/




reply via email to

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