Name:
suspend
Syntax:

SUSPEND task

Task - is a variable/constant which indicates which task to suspend.

Description:

Suspend (pause) a task.

M2 parts can process a number of tasks in parallel. The suspend command is used to pause a task. All other tasks continue as normal. If the task is already suspended the command is ignored. If your program requires the task to be suspended as the chip resets, use a suspend command as the first command in that task. It will then suspend itself as soon at the chip resets. Do not suspend all tasks at the same time!  Tasks can be started again using the resume command.

Applies To:
08M2, 14M2, 18M2, 20M2
See Also:
Related Create:
    Share:
    Print:

    Suspend and resume task 0

    Task 1 controls task 0 - letting it run for 5 seconds, suspending it for 5 seconds, and repeating

    Code Example:
    start0:
    	high B.0	; B.0 high
    	pause 100	; wait for 0.1 second
    	low B.0		; B.0 low
    	pause 100	; wait for 0.1 second
    	goto start0	; loop
    
    start1:
    	pause 5000	; wait 5 seconds
    	suspend 0	; suspend task 0
    	pause 5000	; wait 5 seconds
    	resume 0	; resume task 0
    	goto start1	; loop
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.

    Comments

    • Login to leave a comment.