[Top][All Lists]

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

Re: [avr-gcc-list] efficiency of assigning bits

From: Parthasaradhi Nayani
Subject: Re: [avr-gcc-list] efficiency of assigning bits
Date: Sun, 13 Mar 2005 07:12:25 -0800 (PST)

--- Jamie Morken <address@hidden> wrote:
> Hi,
> I am trying to turn two bits off on a port as
> quickly as possible, how do these two methods
> compare:
> PORTD = (PORTD & ~PD1) & ~PD4;
> or:
> cbi(PORTD, PD1); 
> cbi(PORTD, PD4);

To turn two bits off, the method I would adopt is

  PORTD &= 0B11101101;

This is the fastest method.

The cbi and sbi instructions are removed in the latest
version of winavr and can not be used. Moreover the
two instructions take more time and more space
compared to the above example.


Do you Yahoo!? 
Make Yahoo! your home page 

reply via email to

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