I cannot understand this. Why its better not using continuously running? Its very difficult for me to change the whole program.
I have a while loop which execute code every some milliseconds. The loop runs until a binary-switch is true. After a certain time running the loop I decide to start a generator. Now I must send one command over the rs232. Then my process works. Sometimes later I want to stop the generator and send one another command via RS232. The whole time the while-loop execute its code every second or so. Last I can stop the loop with the binary switch, store data and something else. If I use a while loop as you have said, the whole process stopped if the loop is finished. Than I can=B4t do anything other with my program. I think it must be possible to execute code for one time also in continuous mode.