This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

struct and address

hello every one,

I am trying to use bitfield in my project. i want to assign the port address to the byte which i have created using bitfield.

/* following is the code i have tried */
typedef union { byte Byte; struct { byte Pb0 :1; byte Pb1 :1; byte Pb2 :1; byte Pb3 :1; } Bits; struct { byte Pbyte :8; } MergedBits;
} Ppins;
extern volatile Ppins _PTAD @0x00000000;
#define FByte _PTAD.Byte
#define Bit1 _PTAD.Bits.Pb0
#define Bit2 _PTAD.Bits.Pb1
#define Bit3 _PTAD.Bits.Pb2
#define Bit4 _PTAD.Bits.Pb3

can i give the address in this way or is there any other way to do this. Please help me out.

0