Best Practice - Program Loop
Posted: 04 June 2010, 12:39 PM
My application needs to continuously run through a looping series of sub routines, which right now are invoked in the Main() sub. I've tried two techniques for calling them:
1) I just use the Call Main() at the end of main to call itself. That seems to cause problems, I suspect because it's a looped subroutine call and a stack is getting smashed at some point? (the chip locks up after a few minutes).
2) I've set up a Goto and a point to make the Main sub loop. This works, but doesn't seem like a good coding practice to me.
3) I can set up a Do-Loop that will never break, which causes compiler warning and also doesn't feel right to me.
What's the best way to handle a situation like this?
-Jeff
1) I just use the Call Main() at the end of main to call itself. That seems to cause problems, I suspect because it's a looped subroutine call and a stack is getting smashed at some point? (the chip locks up after a few minutes).
2) I've set up a Goto and a point to make the Main sub loop. This works, but doesn't seem like a good coding practice to me.
3) I can set up a Do-Loop that will never break, which causes compiler warning and also doesn't feel right to me.
What's the best way to handle a situation like this?
-Jeff