??? 02/03/09 08:50 Read: times |
#161977 - Your problem has _nothing_ to do with the ADC. Responding to: ???'s previous message |
but my code continues to loop forever.
No, it does something that's much worse than just looping forever. More below. What am I missing? You're missing the fact that there is nothing for your main function to return to. Unlike PC programs, there's no operating system that will gracefully wait for user input to start the next program or something - the compiler will just put a RET instruction at the end of your main function, which will pop the (nonexistent!) return address from the stack and jump there. This will put the MCU into an undefined state - in your case, it probably executes garbage instructions until it finally his the reset vector again, and then the program starts over. The solution: When writing a program that doesn't have anything to return to at the end of main(), don't let main return. Make it an endless loop, or just disable the interrupts and put a for(;;); at the end of main if you want the MCU to stop doing stuff. |
Topic | Author | Date |
ADUC845 Unable to stop ADC Interrupts | 01/01/70 00:00 | |
Your problem has _nothing_ to do with the ADC. | 01/01/70 00:00 | |
Excellent Advice![]() | 01/01/70 00:00 | |
More advice. | 01/01/70 00:00 |