This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Main Loop



Hello,

Been having some issues with my understanding of how hardware is supposed to work. My launchpad has been working great these last couple of days but I noticed that all the Lab example have a while(1) loop at the end of the code to maintain the execution on one loop. I would like to have the behavior that I should be seeing that the hardware keep executing itself forever. Thing is, when I remove the while(1), the code explodes when it reached that segment of the code (hits return 0) with: No source available for "C$$EXIT() at C:\StellarisWare\boards\MyLaunchPadBoard\Lab3\ccs\Debug\Lab3.out:{3} 0xde8{4}" . How can I fix this, I'm supposed to do something different? Or encase my code in a while(1) and let it go from there based on flags, etc. 

Thanks, 

  • Hi,

    In the embedded world exit from main is not allowed, since you don't have an operating system like in an usual computer - so the need of while(1) to keep all things there. This loop can contain some code (i.e. is doing something) or can be empty, like in many TI examples. While this can work, it can be the source of  unusual/unexpected behavior if abused or used without care, so I suggest to put something in the while loop and communicate from there with the interrupts. Getting more experience with the micros will allow you to use such thing (empty while) if needed.

    Petrei