Begin Task

Text Language Definition

procedure BeginTask(TaskAddress:pointer);

Description

This command causes a procedure in the controller to begin executing as an independent activity concurrent with other activities. Procedures can be run as concurrent tasks if they have no parameters. Tasks cannot be object methods. Procedures with parameters or Object Methods can be called as tasks through a wrapper without parameters that provides the parameters to the called procedure. Insure that such a wrapped procedure has re-entrant properties (operates only with local variables, not global variables) if multiple wrappers call the same procedure.

The MAC Family supports 64 concurrent tasks in addition to concurrent motion which does not consume task resources

Escapes

If all of the available task slots are filled an attempt to start another task will result in an Unable To Begin Task Escape Code.

Examples

This example defines a procedure which causes a red light to blink indefinitely and starts the process with the BeginTask command. Without a termination condition, the task continues until it is ended with the AbortTask command.

Related Topics

Yield
Abort Task
Schedule Task
TaskAddr