Main Content

Thread Trigger

Call downstream function-call subsystem when selected input edge transition occurs

Since R2020b

  • Thread Trigger block

Libraries:
Simulink Real-Time / Async

Description

When the selected input edge transition occurs, the Thread Trigger block calls the downstream Function-Call Subsystem block or Triggered Subsystem block and sets the interrupt priority of the task. The block checks for the edge transition at the block sample rate.

If the input transition occurs while the task is running, a CPU overload occurs on the target computer.

You can use a Thread Trigger block with a Function-Call Subsystem block that resides inside a referenced model as shown in the figure. This approach is compatible with Simulink® Coder™. Because the Thread Trigger block output signal is asynchronous and Simulink Coder does not permit an asynchronous output block inside a referenced model, place the Thread Trigger block at the top level of the model. This approach does not permit explicit partitioning. Remember to match the Asynchronous Task Specification priority (P:245) to the priority selected in the Thread Trigger block. For more information, see About RTOS Tasks and Priorities.

This model shows Thread Trigger block usage with referenced model.

Ports

Input

expand all

Detects the edge type that is selected by using the Trigger Edge parameter as 1 for detected and 0 for not detected..

Example: 0

Output

expand all

Outputs the call to the downstream function and provides the thread scheduling priority for the task

Parameters

expand all

Selects the trigger edge type that is detected by the block input.

Programmatic Use

Block Parameter: edge

Selects the interrupt service routine (ISR) task priority for the function call. You can select task priority values from 254 (highest priority) to 193 (lowest priority).

The Thread Trigger block provides means to call a Function-Call Subsystem block or Triggered Subsystem block that is a separate model thread. This thread can run with higher or lower priority than other execution threads. Each rate group in the model executes as a different execution thread. For more information, see About RTOS Tasks and Priorities.

Programmatic Use

Block Parameter: taskpri

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2020b

expand all