Idle Task - Create free-running task

Library

Core Support in Embedded IDE Link MU

Description

The Idle Task block, and the subsystem connected to it, specify one or more functions to execute as background tasks. All tasks executed through the Idle Task block are of the lowest priority, lower than that of the base-rate task.

Vectorized Output

The block output comprises a set of vectors—the task numbers vector and the preemption flag or flags vector. Any preemption flag vector must be the same length as the number of tasks vector unless the preemption flag vector has only one element. The value of the preemption flag determines whether a given interrupt (and corresponding task) is preemptible. Preemption overrides prioritization. A lower-priority, nonpreemptible task can preempt a higher-priority, preemptible task.

When the preemption flag vector has only one element, that element value applies to all functions in the downstream subsystem as defined by the task numbers in the task number vector. If the preemption flag vector has the same number of elements as the task number vector, each task defined in the task number vector has a preemption status defined by the value of the corresponding element in the preemption flag vector.

Dialog Box

Task numbers

Identifies the created tasks by number. Enter as many tasks as you need by entering a vector of integers. The default values are [1,2], to indicate that the downstream subsystem has two functions.

The values you enter determine the execution order of the functions in the downstream subsystem, while the number of values you enter corresponds to the number of functions in the downstream subsystem.

Enter a vector containing the same number of elements as the number of functions in the downstream subsystem. This vector can contain no more than 16 elements, and the values must be from 0 to 15 inclusive.

The value of the first element in the vector determines the order in which the first function in the subsystem is executed. Similarly, the value of the second element determines the order in which the second function in the subsystem is executed, and so on.

For example, entering the vector [2,3,1] in this field indicates that there are three functions to be executed, and that the third function is executed first, the first function is executed second, and the second function is executed third. After all functions are executed, the Idle Task block cycles back and repeats the execution of the functions in the same order.

Preemption flags

Higher-priority interrupts can preempt interrupts that have lower priority. To allow you to control preemption, use the preemption flags to specify whether an interrupt can be preempted.

When Task numbers contains more than one task, you can assign different preemption flags to each task by entering a vector of flag values, corresponding to the order of the tasks in Task numbers. If Task numbers contains more than one task, and you enter only one flag value in this field, that preemption setting applies to all tasks.

For example, the default settings [0 1] indicate the task with priority 1 in Task numbers is not preemptible, and the priority 2 task can be preempted.

Enable simulation input

When you select this option, Simulink® adds an input port to the Idle Task block. This port receives input only during simulation. Connect one or more simulated interrupt sources to the simulation input.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS