BASIC programs run best when left to run continuously with functions controlled by setting values in the global VR varables. However sometimes it is necessary to put a program in a "paused" state while another program takes control of something. The commands to put a process on hold and then run again are the ones usually used by Motion Perfect. They are STEPLINE and TROFF.
STEPLINE puts the program in step-by-step mode
TROFF turns off the "trace" mode and allows the program to continue on from the current line number.
Here is a short example that controls a program called PROGRAM_1.
' pause and restart another process
' PROC_STATUS values
' 0 stopped: no program OR task is running ON the PROCESS
' 1 running: a task OR program is running
' 2 stepping: PROCESS is stepping line by line
RUN "PROGRAM_1", 4 ' running on process 4
PRINT PROC_STATUS PROC(4)
WA(133)
STEPLINE "PROGRAM_1"
PRINT PROC_STATUS PROC(4), PROC_LINE PROC(4)
WA(200)
TROFF "PROGRAM_1"
PRINT PROC_STATUS PROC(4)
The example uses PRINT to confirm the state of PROGRAM_1. PROC_STATUS can be used in a program to confirm that the named program is running or not, and then some decision can be made based on that. e.g. restarting the program or showing an alarm to the operator if the status is not as expected.