??? 03/02/05 10:49 Read: times |
#88857 - break Responding to: ???'s previous message |
Rahul Sadagopan said:
I cant use polling for my timer because the list of statements are very long..that way i cant stop as soon as timer overflows. How can you have such a long list of statements and be able to abandon it at any arbitrary point? On exiting your loop, you will have no idea how far you had got through the loop! What if the interrupt occurs part-way through a 'C' statement?! You need to explain what it is that you're actually trying to achieve. How else can i break the loop and get out...will the "break;" statement help. Yes, that is precisely what the 'break' statement does - see your 'C' textbook! Using 'break' is still not a terribly well-structured technique, but it could be suitable here - again, further details of what you're actually trying to achieve are necessary to consider this further. You could have your timer ISR set a flag, then check that flag at strategic points in the loop and 'break' if the flag's set. Again, this is not a terribly well-structured technique - further info needed to tell if it might be appropriate in your application. If used, it would need to be very well commented. |