From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

This query returns a Long value, indicating the state of the task. There are two conditions in which the regular task state is modified:

1) when the task is Locked

2) when the task is Interrupted

A task may be Locked in states 2, 4, and 10 if it is waiting for a system event to complete execution.

In this case, the value 256 (0x100) is added to the regular task state. This could occur when a task has three moves, one after the other. The interpreter is waiting to execute the second move until the first has completed.

If you enter a STOP command from the terminal, the task remains in the Running mode. Enter the IDLETASK command from the terminal and the task switches to a Stopped and Locked state. It is locked because it is waiting for the Proceed command to resume motion. A task is interrupted by either OnEvent or OnError. In this case, the value 512 (0x200) is added to the regular task state.

1: Running (TASK_RUNNING)

2: Stopped due to IDLETASK or after a STEPIN instruction (TASK_STOPPED)

3: The program is in the single step mode

4. Stopped due to runtime error (TASK_ERROR)

5: Terminated .

                     It can be seen momentary  that state at: 
                     1. Terminate program 
                     2. Unload

6: The program is in the single step mode, step-over command is in progress

7: Ready after LOAD (TASK_READY)

8: Momentary state upon "continuetask" command

9:  Incorrect state (probably kill task failed)


If the task is interrupted by an event, the task state has the value 512 added to it. If the task is Locked, the task state has the value 256 added to it.




All versions




Returned value: 1, 2, 4, 5, 7, 9, 10


Task or Terminal


Task must be loaded in memory



If Task1.prg.state = TASK_ERROR Then
                                           ‘Check if task is stopped due to run-time error

See Also