Topic: P169

Call Task (CALL) Instruction

Mnemonic (Keyboard Shortcut) = CALL

Icon / Button =

Purpose

Used to execute Tasks that are set to Run When Called.  When Enabled, Call Task will jump program execution immediately to the Called Task.  When the END statement of the Called Task is reached, program execution will return to the rung following the Call Task instruction. Tasks in the Run When Called folder can be called multiple times per scan.

Instruction Parameters

Parameter

Parameter Type

Requirements

Description

Enable

Ladder Input

Must Have

Level-driven.  When Enable is ON, the instruction will operate every scan.  When Enable is OFF, the instruction is not solved and its Outputs are not updated.

Task To Run

Task

Must Have

The specified Task to be run.


Note:  A Task must be located in the Run When Called folder of the Task Management Tool in order to select the Task To Run when configuring the Call Task instruction.


Note: Nesting of a Task (Calling a Task from within another Task) that has been placed in the Run When Called folder is not allowed and will generate an error when compiled.


Note: Tag Values are updated immediately as each Ladder Rung is executed, top to bottom.  However, Tag Values representing physical Outputs are only applied to the physical Output after the END statement of the last Task to be scanned is reached.  Outputs in Remote Base Groups have additional limitations regarding Update Intervals.


Instruction Configuration

When Call Task Instruction is selected the window shown below opens with defaults shown.


Parameter Configuration Table

Call Task

Instruction

(CALL)

Notes

Task To Run

                   

Select the Name of an existing Task in the Run When Called folder.


Application Example

In this application example, there are three temperature probes tied to analog input cards. Each requires linear scaling and validity calculation. Additionally, the scaled Fahrenheit measurement will be converted to Celsius. Each Temperature Probe will be processed with a Call Task instruction.


In the Main Program task, analog inputs and module status bits are copied to instances of a User-Defined Structure (UDS). These structures are then copied to a working copy of the UDS and the translation task is called. This task performs a linear scale (SCL) on the incoming analog signal based on the chosen resolution of the analog input card. The working copy of the UDS is then copied back to the original structure.


This is then repeated for every temperature probe in the program, utilizing the same Called Task. To configure the Called Task, go to the Task Management tool of the Productivity Suite Software. Add new Tasks in the Run When Called folder (right click) as shown below.


Then double-click on a newly created Task and edit the Called Task.


Return to the Main Program to configure a Call Task instruction.  Assign one of the Tasks by selecting its TaskName from the drop-down.

Rung Example


Logical Flow

  1. Raw analog data and status bits are loaded into a device structure.
  2. This structure is copied onto a ‘working copy’ of the same structure type.
  3. A task is called which examines the ‘working copy’ and modifies structure elements.
  4. When the task is finished, the ‘working copy’ is copied back onto the original device structure, whose elements can now be used throughout the program.