How to set bit of MSB in a 16bit micro controller?

Status
Not open for further replies.

Vadivukkarasi.k

Newbie level 2
Joined
Sep 2, 2006
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
chennai
Activity points
1,289
micro controller

how to set (example the 10th bit of MSB) in a micro controller of 16 bit
 

Re: micro controller

Vadivukkarasi.k said:
how to set (example the 10th bit of MSB) in a micro controller of 16 bit
Here's a snippet of C code that will set bit 10 within a 16 bit value:
Code:
value |= (1 << 10);
If the value is accessed by multiple threads then it might be a good idea to do it this way to ensure an atomic operation is performed:
Code:
DisableInterrupts();
value |= (1 << 10);
EnableInterrupts();
 

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