Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/04/09 18:21
Read: times


 
#169398 - FAQ
Responding to: ???'s previous message
Yash Chitalia said:
I now understand that the program goes into an automatic endless loop after my main function ends. Am I correct?

No, I'm afraid not!

Think again about my original question:
what happens after the closing brace of main?
ie, what happens when the main() function returns...?


See: http://www.8052.com/faqs.phtml?FAQ=143904
And: http://www.8052.com/forum/read/144125 - which refers to the above;
And: http://www.8052.com/forum/read/144131 - which is an addendum to the previous post.

2)The tutorial does say how to break the endless loop in the "hello world " program:
"Stop Running HELLO with the Halt command from the Debug menu or the toolbar. You may also type ESC in the Command page of the Output window."

That is just a means of stopping the debugger; in "real life", your program runs with no debugger - so you can't rely upon that!

4) Also, If I'm writing a more complicated code, say calling a delay function for making my LED's blink , in that case how do I stop my program after one loop?

That makes no difference - the principle remains exactly the same!
See the links above.

List of 13 messages in thread
TopicAuthorDate
A doubt about programming the P89v51RD2.            01/01/70 00:00      
   I'm programming in C for the first time            01/01/70 00:00      
      I take it that you are programming for the first time..            01/01/70 00:00      
         FAQ            01/01/70 00:00      
            Another Problem!            01/01/70 00:00      
               Large number            01/01/70 00:00      
                  How to post legible source code            01/01/70 00:00      
               Delay loops in 'C'...            01/01/70 00:00      
                  Thank you.            01/01/70 00:00      
                     Did you not notice?            01/01/70 00:00      
                        I did notice the indentation.            01/01/70 00:00      
                           skim through the FAQ's (edited)            01/01/70 00:00      
   what your (missing) comments state            01/01/70 00:00      

Back to Subject List