Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Mon Nov 26, 2012 4:02 am |
|
|
| Quote: | | I've no chance to do as you all mentioned above to figure out one flag position, because I don't know where & when my interrupt occurs to terminate my big function. |
Yes. That's part of the idea of interrupts. You don't know when they'll occur. On the other hand, you don't care either. Your interrupt can handle many flags, you're not limited to one.
I was in your position over quarter of a century ago, writting huge spaghetti code, that had to be printed out so I could follow it. Then I discovered structured programming. I've not had to print out a program since.
Your 45 second function scares me. If you effectively jump out of any part of it after an interrupt something is left hanging in mid-air. Then, on the other hand, you're worried about something else getting into wrong states by not being serviced.
What we're ALL saying to you is sit down and redo your entire structure.
You're standing too close to the problem, fixated by your chosen route, and can't see a way out.
Stop and stand back a little, it's going to be painful. In the end you have little choice.
Mike |
|