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

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

Re: [avr-gcc-list] Question about gcc preprocessing and port/pin assignm


From: Ned Konz
Subject: Re: [avr-gcc-list] Question about gcc preprocessing and port/pin assignments
Date: Tue, 7 Dec 2004 22:44:12 -0800
User-agent: KMail/1.7.1

Sorry, ignore the _sfr references in what I wrote previously:

On Tuesday 07 December 2004 9:54 pm, I wrote:
> #define SOME_OUTPUT_PORT PORTD_sfr

#define SOME_OUTPUT_PORT PORTD

> #define SOME_OUTPUT_BIT 2
> #define SOME_OUTPUT_MASK (1<<SOME_OUTPUT_MASK)
>
> SOME_OUTPUT_PORT |= SOME_OUTPUT_MASK; /* set it the hard way */
>
> etc., or you could use macros. But I think my way is nicer.
>
> The compiler will combine these bitfield settings when the register isn't
> defined as volatile:
>
> PORTB2 = 1;
> PORTB3 = 1;
>
> will result in the same thing as:
>
> PORTB_sfr |= (1<<2) | (1<<3);

PORTB  |= (1<<2) | (1<<3);

-- 
Ned Konz
http://bike-nomad.com



reply via email to

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