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.
Thank you people for reply message.
My intention in this part of program is to use only 4-bits of Port register for one function and other 4-bits of same Port register for other function, with out disturbing each other nibbles.
And also to access the same Port register as a byte of data for another function.
So, if there is any other method to do this please suggest me.