Main Content

C29x Hardware Interrupt

Trigger downstream function-call subsystems from interrupt service routine

Since R2025a

  • Hardware Interrupt block

Libraries:
C2000 Microcontroller Blockset / F29H85x

Description

Use the Hardware Interrupt block to create an interrupt service routine (ISR) automatically in the generated code of your model to react to the events selected. The ISR executes the downstream function-call subsystem associated with event ports of the block.

The function call subsystem associated with the event output port run at same priority as that of ISR priority.

Using this block you can:

  • Create ISRs.

  • Set ISR priority.

  • Enable or disable interrupt preemption.

This block generates code only for the specified ISR and selected events. To change the configuration, enable the interrupt and specific triggering options use the settings of the chosen peripheral.

For example, to create an ISR for the ADC peripheral on the Hardware Interrupt block:

  • Model must have an Analog to digital Converter (ADC) block.

  • Select Analog to digital converter (ADC) in the Interrupt group parameter and ADCA#_INT in the Interrupt name parameter from the hardware interrupt block.

  • Select EOC event or Overflow event event name in the Events to serve parameter.

To know more about when not to use the custom event, refer to Limitations (Embedded Coder).

Ports

Output

expand all

The output of this block is a function-call. The number of function call outputs will be same as events selected to serve in an ISR.

Parameters

expand all

Interrupt group lists all the ISR for a same type of peripherals. Selecting an interrupt group changes the list of values in the Interrupt name parameter.

The interrupt name specifies the ISR to be generated for the hardware interrupt block. The Interrupt name corresponds to the specific entry in the processor's interrupt vector table. The available ISRs depend on the interrupt group.

This read-only parameter indicates the position of the selected ISR in the interrupt vector table of your target hardware.

Select events or custom event and there respective events execution order from the Events to serve group to service events for the selected Interrupt name. You can select custom events to execute along with the other selected events. For more information, see Limitations (Embedded Coder).

Events to serve

The value you specify in this parameter sets the priority of the downstream function-call subsystem. The Simulink® task priority of the selected (ISR) is relative to the model base rate priority.

Note

The default model base sample rate priority is set to 40 with a lower priority value indicating a higher priority task. To achieve this the Higher priority value indicates higher task priority option must be enabled in Configuration Parameters > Solver pane.

Enable Run interrupt service routine as atomic unit to block all other interrupts while executing the selected interrupt service routine.

Select this parameter to clear event status in interrupt service routine after executing each event.

Limitations

Custom events should not be used, when interrupt or event generation is selected from the block or configuration parameter. You might observe that the generated code when executed on the hardware board can get stuck infinitely in the Hardware Interrupt service routine. Ensure that the supported event generation from the block should not be enabled when using the supported event as custom event.

Also, ensure that enabling of custom event should not be part of initialize subsystem. It should executed during run time.

Version History

Introduced in R2025a