Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] C Question in AVR GCC and codevision

2007-06-18 by Dave Hylands

On 6/17/07, larry barello <yahoo@barello.net> wrote:
>
> PORTA &= _BV(PA1);
> If (random value)
>         PORTA |= _BV(PA1);
>
> You can define PORTA as a bit-field and have the compiler do the work for
> you.

It seems to me that if ( random value) is going to be 1 except when
random value is 0.

I expect that what you really want is something like combining a bit
field and using

PORTA.bit0 = randomValue & 1;

-- 
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.