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.

[Moved] embedded c for 8051 micro controller

Status
Not open for further replies.

abhishekzade

Newbie level 3
Joined
Oct 10, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,298
How to execute one conditon once in life time of code till the controller is not reset
 
Last edited by a moderator:


Code C - [expand]
1
2
3
4
5
6
7
8
main{
     condition code;
 
     while(1){
        your code;        
     }
 
}

 
Last edited by a moderator:

@silverwolfman

An explanation, albeit short, would typically accompany a post of example code.


BigDog
 

Hi abhishekzade,
Sorry I should have add some explanation, sometimes I thought code explains better :p
The micro-controller only runs the code in main function once, so anything you put into the main function will be executed at least once, in order to make your code loop and function none-stop, you could put the other code into while/for structure. So, the condition code will only run one time when power is up, and the rest of your code will be circular executed. Hopefully this will answer your question.


Code C - [expand]
1
2
3
4
5
6
7
8
9
main{
     
condition code;
 
     while(1){
        your code;        
     }
 
}

 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top