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.

What is the key word volatile and where is it used in embedded systems?

Status
Not open for further replies.

rameshbabu

Member level 2
Member level 2
Joined
Aug 1, 2007
Messages
46
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,663
what is the meaning of the key word volatile and where it is used exactly in embedded system programming ?
 

Embedded Systems

Volatile is the one of the keyword used in Embedded c for the variable declaration . Volatile keyword is used for the variable in which at every time power goes OFF, the variable will be reintialised in the memory.
 

Embedded Systems

Wow. Prabakaran - please don't post such a nonsense.
If I would write program on my PC with "volatile" qualifier for some variable, run and after that just shutdown computer. Will that variable still keep previous value if I will turn on my PC again and rerun program. Obviously not.

qualifier "volatile" is simply instruction to compiler telling that for this particular variable do not do any optimization. That simple. Otherwise compiler could place that variable into register or make some other clever stuff therefore this variable will not have always up to date value. Thus if thread will be preempted by other one or by interrupt, that variable (memory location) could have not latest value. There are some other use for volatile but they pretty much circle around "not optimize this"

Cheers
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top