That was what I was going to say
.
You have to remember that the function you are using is/ should be cycling between 0 and 100 ms. So at least 10 times a second.
Your code will be executed this many times. If you have a timer for example, the code will execute, look at the status for the timer and if it is not done yet, it will not execute whatever that timer is controlling.
So you should have:
1. A bit that starts the function
2. In between every step of your program that you want to control, the same bit that will make it jump to the end of that function.
3. A status integer, which will "remember" what particular part of the program you are at.
If you are beginning, it would be smart to put every separate part in its own function(block) and use the integer + the start bool to start every function sequentially.
You CANNOT stop the program from running. Imagine it did, how would you ever evaluate the status of your start or stop button?