[Top][All Lists]

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

Re: [avr-gcc-list] [newbie]Toggle a bit value

From: David Kelly
Subject: Re: [avr-gcc-list] [newbie]Toggle a bit value
Date: Wed, 12 Oct 2005 21:37:00 -0500

On Oct 12, 2005, at 8:39 PM, Sumeet Pal Singh wrote:

How do a toggle a value at one pin of port the current value i do not know
i know the pin can be set or cleared using _BV and ~_BV resp.
but when I tried to do


How is PORTA1 defined?

the compiler gives error
main.cpp:20: error:non-lvalue in assignment

can someone tell me what i am doing wrong and why (i wish to understand how the compiler handled this line
Also how to do this

In sdcc for 8051 i used PortA.1=!PortA.1 and it worked well

Notice how you wrote it differently in two places? Try this to toggle bit 0 of PORTA:

PORTA ^= (1<<0);

The caret '^' is exclusive-or.

David Kelly N4HHE, address@hidden
Whom computers would destroy, they must first drive mad.

reply via email to

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