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

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

Re: [avr-gcc-list] strange _BV() stuff


From: Torsten Hahn
Subject: Re: [avr-gcc-list] strange _BV() stuff
Date: Tue, 15 Jul 2003 13:43:17 +0200


Am Dienstag, 15.07.03, um 13:27 Uhr (Europe/Berlin) schrieb Torsten Hahn:

Hi Folk,

i wanted to set the a port on my atmega chip to an specific output using the _BV() macro defined in the avr-libc.

example:

#define DDS_WR 0
#define DDS_RB 1

...

PORTB = (_BV(DDS_WR | DDS_RB));

This should set the pin0 and the pin1 of PORTB to high. But it does not !

_BV((DDS_WR | DDS_RB) evaluates to 2, but it should evaluate to 3 if pin0 and pin1 should be set.

Do i miss something ?

avr-gcc --version
avr-gcc (GCC) 3.2 20020614 (experimental)



OK, i get it.

It has to be

PORTB = _BV(DDS_WR) | _BV(DDS_RB);


stupid mistake, sorry ... :)



reply via email to

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