Generate Versa Module Eurocard (VME) interrupt service routines (ISRs) that execute downstream subsystems or Task Sync blocks
Simulink Coder / Asynchronous / Interrupt Templates
A function call subsystem
A Task Sync block
A Stateflow® chart configured for a function call input event
Use the blocks in the Interrupt Templates block library (Async Interrupt and Task Sync) for simulation and code generation. These blocks provide starting point examples to help you develop custom blocks for a target environment.
Assumptions and Limitations
The block supports VME interrupts 1 through 7.
The block uses these RTOS (VxWorks) system calls:
Execution of large subsystems at interrupt level can have a significant impact on interrupt response time for interrupts of equal and lower priority in the system. Usually, it is best to keep ISRs as short as possible. Connect only function-call subsystems that contain a few blocks to an Async Interrupt block.
A better solution for large subsystems is using the Task Sync block to
synchronize the execution of the function-call subsystem to an RTOS task. Place the Task
Sync block between the Async Interrupt block and the function-call
subsystem. The Async Interrupt block then uses the Task Sync block
as the ISR. The ISR releases a synchronization semaphore (performs a
semGive) to the task, and returns immediately from interrupt level. The
example RTOS (VxWorks) then schedules and runs the task. See the description of the Task
Input — Simulated interrupt source
scalar | vector
A simulated interrupt source, specified as a scalar or vector.
Output — Control signal
scalar | vector
Control signals for these model elements, specified as a scalar or vector:
Task Sync block
Stateflow chart configured for a function call input event
VME interrupt number(s) — VME interrupt numbers for the interrupts to be installed
[1 2] (default) | integer array
An array of VME interrupt numbers for the interrupts to be installed. The valid range is
The width of the Async Interrupt block output signal corresponds to the number of VME interrupt numbers specified.
A model can contain more than one Async Interrupt block. However, if you use more than one Async Interrupt block, do not duplicate the VME interrupt numbers specified in each block.
VME interrupt vector offset(s) — Interrupt vector offset numbers corresponding to the VME interrupt numbers
[192 193] (default) | integer array
An array of unique interrupt vector offset numbers corresponding to the VME interrupt
numbers entered for parameter VME interrupt number(s). The Stateflow software passes the offsets to the RTOS (VxWorks) call
Simulink task priority(s) — Priority of downstream blocks
[10 11] (default) | integer array
The Simulink® priority of downstream blocks. Each output of the Async Interrupt block drives a downstream block (for example, a function-call subsystem). Specify an array of priorities corresponding to the VME interrupt numbers that you specify for parameter VME interrupt number(s).
Parameter Simulink task priority values are required to generate a rate transition code (see Rate Transitions and Asynchronous Blocks). Simulink task priority values are also required to maintain absolute time integrity when the asynchronous task must obtain real time from its base rate or its caller. The assigned priorities typically are higher than the priorities assigned to periodic tasks.
The Simulink software does not simulate asynchronous task behavior. The task priority of an asynchronous task is for code generation purposes only and is not honored during simulation.
Preemption flag(s); preemptable-1; non-preemptable-0 — Selects preemption
[0 1] (default) | integer array
Set this option to 1 if an output signal of the Async Interrupt block drives a Task Sync block.
Higher priority interrupts can preempt lower priority interrupts in the example RTOS
(VxWorks). To lock out interrupts during the execution of an ISR, set the pre-emption flag to
0. This setting causes generation of
intUnlock() calls at the beginning and end of the ISR code. Use
interrupt locking carefully, as it increases the interrupt response time of the system for
interrupts at the
intLockLevelSet() level and below. Specify an array of
flags corresponding to the VME interrupt numbers entered for parameter VME interrupt
The number of elements in the arrays specifying parameters VME interrupt vector offset(s) and Simulink task priority must match the number of elements in the array specified for parameter VME interrupt number(s).
Manage own timer — Select timer manager
on (default) | off
If selected, the ISR generated by the Async Interrupt block manages its own timer by reading absolute time from the hardware timer. Specify the size of the hardware timer with parameter Timer size.
Timer resolution (seconds) — Resolution of ISR timer
The resolution of the ISRs timer. ISRs generated by the Async Interrupt
block maintain their own absolute time counters. By default, these timers obtain their values
from the RTOS (VxWorks) kernel by using the
tickGet call. Parameter
Timer resolution determines the resolution of these counters. The
default resolution is
1/60 second. The
resolution for your board support package (BSP) can be different. Determine the
tickGet resolution for your BSP and enter it for parameter
If you are targeting an RTOS other than the
example RTOS (VxWorks), replace the
tickGet call with an equivalent call
to the target RTOS. Or, generate code to read the timer register on the target hardware. For
more information, see Timers in Asynchronous Tasks and Async Interrupt Block Implementation.
Timer size — Number of bits to store the clock tick
32bits (default) |
The number of bits to store the clock tick for a hardware timer. The ISR generated by the
Async Interrupt block uses the timer size when you select parameter
Manage own timer. The size can be
auto. If you select
auto, the code
generator determines the timer size based on the settings of parameteres Application
lifespan (days) and Timer resolution.
By default, timer values are stored as 32-bit integers. When parameter Timer
size is set to
auto, you can indirectly control the
word size of the counters by setting parameter Application lifespan
(days). If you set Application lifespan (days) to a value
that is too large for the code generator to handle as a 32-bit integer of the specified
resolution, the code generator uses a second 32-bit integer to address overflows.
Enable simulation input — Select add simulation input port
on (default) | off
If selected, the Simulink software adds an input port to the Async Interrupt block. This port is for simulation only. Connect one or more simulated interrupt sources to the simulation input.
Before generating code, consider removing blocks that drive the simulation input to
prevent the blocks from contributing to the generated code. Alternatively, you can use the
Variant Source block with the Variant control mode parameter set to
sim codegen switching, as explained in Dual-Model Approach: Code Generation. If you use the Variant Source block, the
sample times of driving blocks contribute to the sample times supported in the generated
Introduced in R2006a