Task - is a variable/constant which indicates which task to restart.
Restart the task.
M2 parts can process a number of tasks in parallel. The restart command is used to restart a single task back to its first line. If the task is suspended at that point it will also be resumed. All other tasks continue as normal. This command does not reset any variables, to do this a reset command would be needed to reset the entire chip.
Restart task 0
Restart task 0 after 10 seconds (via code running in task 1)
- Code Example:
start0: b3 = 0 ; reset b3 loop0: high B.0 ; B.0 high pause 1000 ; wait for 1 second low B.0 ; B.0 low pause 1000 ; wait for 1 second inc b3 ; increment variable goto loop0 ; loop start1: inc b4 ; increment variable if b4 > 10 then ; if b4 > 10 then restart 0 ; restart task 0. Var b3 will drop to 0 b4 = 0 end if debug ; display variables pause 1000 goto start1Copy Code Submit an Example
Submit Your Own Code!
You must be logged in to submit code examples. Login now.