Multi-tasking

For some applications, you may want to control other equipment besides the robot, such as conveyors, pick and place units, etc. By using multi-tasking, you can control this other equipment with their own tasks.

SPEL+ supports up to 32 normal tasks and 16 background tasks (48 tasks in total) running simultaneously. A task is a function that has been started by the system or by the Xqt statement.

Use the Xqt statement to start another task from within a function. You can optionally specify a task number from 1 to 32 in the Xqt statement.

A task started from a background task is started as a background task. You can execute up to 16 background tasks simultaneously.

The table below shows the program instructions that are used for multitasking.

Statement Description
Xqt Starts a function as a task.
Halt Temporarily suspends execution of a task.
Resume Resumes a task that has been halted.
Quit Stops a task.
Signal Sends a signal to one or more tasks that are waiting for the signal using WaitSig.
SyncLock Locks a resource for use by the current task and blocks other tasks from using the resource until SyncUnlock is executed.
WaitSig Waits for a signal from another task.
Pause Pause all tasks.

One example for starting another task is to run a conveyor system for the robot work cell.

Program: MAINTASK.PRG

Function Main
  Xqt Conveyor    ' Start the conveyor task
  Do
    ...
    ...
  Loop
Fend

Program: CONVTASK.PRG

Function Conveyor
  Do
    Select True
      Case Sw(10) = On
        Off convCtrl
      Case Sw(11) = On
        On convCtrl
    Send
  Loop
Fend