define bit in lpc2148 processor

Status
Not open for further replies.

embpic

Advanced Member level 3
Joined
May 29, 2013
Messages
742
Helped
80
Reputation
160
Reaction score
77
Trophy points
1,308
Location
india
Visit site
Activity points
5,213
hello masters
i am started to program lpc2148 processor but getting problem in defining bit. and i saw some example and there define and use of BOOL function but this is not work for me.then how to define bit or BOOL data-type for lpc2148.
thanx...
 

Hi embpic,

You can use structure bitfields instead..through which you write and read individual bits ..like this


typedef struct bits
{
unsigned char bit0 : 1; // 8 individual bits
unsigned char bit1 : 1; // "
unsigned char bit2 : 1; // "
unsigned char bit3 : 1; // "
unsigned char bit4 : 1; // "
unsigned char bit5 : 1; // "
unsigned char bit6 : 1; // "
unsigned char bit7 : 1; // "
}bits_;

bits_ bit_access;


access the bits just like this :-
bit_access.bit0 = 1;
bit_access.bit0 = 0;

good wishes
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…