Topic: DMD0145 ENTASK - Enable Task |
|
The Enable Task (ENTASK) instruction is used to enable a user-defined Task to run as part of the subsequent PLC scan. This instruction does NOT cause the CPU to immediately begin execution of the Task, rather it configures the Task to run when the CPU gets to it as part of its normal scan processing. If the Task exists later in the execution order the Task will begin execution on the same scan. If the Task exists earlier in the execution order the Task will begin execution on the subsequent scan.
By default, user-created Tasks will be executed in the order that they are added to the project. The execution order of the code-blocks in a project can be modified through the Project Browser.
|
|
Parameters:Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.
Task is the name of the Task to enable. This can be a Task that already exists, or follow the steps below to create a new Task code-block:
If a name was entered that is NOT an existing Task, this Create Task message box will be displayed. This could have happened because the Task name was misspelled, or because the programmer wants to create a new Task.
If an existing ENTASK instruction is being edited and the Task name is changed to a Task that does not exist, a different Create Task message box will be displayed. Again, this could have happened because the Task name was misspelled, or because the programmer wants to create a new Task.
Click Yes to create a new Task using the name provided in the Task field. This does NOT create the code-block, this is only the heap item. The code-block can be created in the next step. Click No to return to the Editor for the ENTASK instruction so that a different name can be entered.
Enable specifies when and how often the Task will run:
Note: during their termination scan, Tasks will run the termination logic for each individual instruction that is contained within the Task, then will run its own termination logic. All of the Output Coil (OUT) instructions, and any output coil in any instruction that has one as a parameter (for example TIMEPROP) are turned OFF. All of the Timers and Counters are reset. When Enable Task runs a Task one time, the termination logic is executed when the Task completes. When Enable Task runs a Task recurrently, the termination logic is executed when the ENTASK itself is disabled. The Task's associated structure will be initialized (clearing internal flags, counters, etc.) in preparation for being restarted.
|
|
See Also:
ENTASK - Enable Task
RESTART - Restart Program or Task
SUSPEND - Suspend Program or Task
|
|
Related Topics:
Overview of Code Blocks (Programs, Tasks, Subroutines and Interrupt Service Routines)
Using Interrupt Subroutines on BRX PLCs
Modifying the Execution Order of Programs and Tasks
|
|
Rung Example:
|
|