Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

Vadivukkarasi.k

Newbie level 2
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top