Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: Bit addressing

2006-03-01 by Richard Duits

Be carefull with bit fields larger then 8 bits, because they do not work 
the same on all compilers.
Check you assembler listing to see if the compiler generates the code 
you expected.

Richard.


Alexey Bishletov wrote:
> 3:47:56 PM, Wednesday, March 1, 2006, Mukund wrote:
>
> > Thanks for the mail.
> > I am porting huge code from 8052 involving lots of port and bit 
> variable.
> > I just want to know how a pin/bit is defined in header file of 
> LPC2138, so
> > that rest of my 8051 code remains unchanged.
> > In 8051 to set a bit we use
> > P1_7=1;
>
> typedef struct
>   {
>     unsigned long n0:1;
>     unsigned long n1:1;
>     unsigned long n2:1;
>     unsigned long n3:1;
>     unsigned long n4:1;
>     unsigned long n5:1;
>     unsigned long n6:1;
>     unsigned long n7:1;
>   } BITS32;
> #define P1 (*((volatile BITS32 *)  0xE0028014))
>
> #define P1_7 (P1.7)
>
>
> WBR,  Alex
>

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.