Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Bit set/clear w/ gcc

2006-01-11 by Robert Adsett

At 04:54 PM 1/11/06 +0000, ee_gary wrote:
>Thanks Tom,
>
>I was looking for something that would let me do:
>
>if(LED1)
>   LED2 = 1;
>
>This would require associating LED1 and LED2 with a particular bit in
>the appropriate IOPIN register.  Judging from your response, this is
>not possible with GCC and ARM?

You could go to C++ and overload the assignment operator appropriately.  If 
the only benefit you are getting is bit manipulation that seems a little 
overboard to me but it would work.  Toms solution did rely on some C99 
construct which as yet are far from widespread.  The C++ version might 
actually be more portable.

Or you could simply realize that there is a legion of embedded 
microcontroller families out there without bit manipulation instructions 
and addressing and become comfortable with the common methods of dealing 
with those in C with out the use of either extensions to the language or 
C99s additions.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.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.