Idle Task
Create free-running task
Description
The Idle Task block and the subsystem connected to it specify functions in the downstream subsystem to execute as background tasks. The tasks executed through the Idle Task block are of the lowest priority, lower than that of the base rate task.
This block is not supported on target computers that run an operating system.
Vectorized Output
Ports
Input
Port_1 — Simulated interrupt
scalar | vector
Optional simulated interrupt for testing asynchronous interrupt behavior during Simulink® simulation.
Port Dependencies
To enable this port, select parameter Enable simulation input.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Output
Port_1 — Task identifiers and preemption flags
vectors
Numbers that identify the background tasks and task preemption flags, represented as vectors. A task identifier vector stores numbers that identify the background tasks.
For each background task, the preemption flag vector stores a flag that indicates whether the task can be preempted. Unless the preemption flag vector contains one element, the number of elements in the preemption flag vector must match the length of the task identifier vector. If the preemption flag vector has the same number of elements as the task identifier vector, each task represented in the task identifier vector has the preemption setting defined by the value of the corresponding element in the preemption flag vector. When the preemption flag vector contains one element, the flag setting applies to the entire task identifier vector.
A higher-priority task cannot preempt a lower-priority task that cannot be preempted.
Data Types: uint8
Parameters
Task numbers — Identifiers for tasks created
[1 2] (default) | vector of integers in the range 0 to 15
Specify task identifiers for functions that are in the downstream subsystem as a
vector of integers in the range 0 to 15. The vector must contain the same number of
values as the number of functions in the downstream subsystem. For example, the default
vector [1 2]
indicates that the downstream subsystem contains two
functions.
The number of values that you enter corresponds to the number of functions in the
downstream subsystem. The values that you specify determine the execution order of the
functions. For example, the vector [2 3 1]
indicates that:
The subsystem contains three functions.
The third function executes first.
The first function executes second.
The second function executes third.
After the functions execute, the Idle Task block cycles back and repeats the execution of the functions in the same order.
Preemption flags — Preemption flags for specified tasks
[0 1] (default) | vector of 0 to 16 integers in the range [ 0, 1]
Specify preemption flags for the tasks specified by the Task numbers parameter as a vector of up to 16 ones and zeros. Higher-priority interrupts can preempt interrupts that have a lower priority. To control preemption, use the preemption flags to specify whether an interrupt can be preempted.
The value 1
indicates that the interrupt for the corresponding
task can be preempted. The value 0
indicates that the interrupt
cannot be preempted. You have the option of specifying:
One preemption value that applies to the entire vector that you specify for Task numbers.
A preemption value for each task identified in the vector that you specify for Task numbers. Specify the flag values in the order that corresponds to the order of the tasks in Task numbers.
For example, if you specify the vector [2 3 1]
for Task
numbers and [0]
for Preemption
flags, tasks 1
, 2
, and
3
cannot be preempted. If you specify [1 1 0]
for Preemption flags, tasks 2
and
3
can be preempted and task 1
cannot be
preempted.
Enable simulation input — Input signal for simulation
off (default) | on
Select this parameter to create an input port that receives interrupt input for model simulation. Use the port to connect and test asynchronous interrupt processing behavior for one or more simulated interrupt sources during Simulink model simulation.
Version History
Introduced in R2011a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)