When to use:
When to use:
When NOT to use:


| Parameter | Variable | Description | Values |
|---|---|---|---|
| Interruption | Interruption | Select interrupt source from dynamic list of available peripheral interrupts. | โข Not defined | โข ADC1 | โข PWM1 Period | โข QEI1 Position | โข UART1 RX | โข SPI1 RX | โข (device/model-dependent) |
| Interrupt Priority | IntPriority | Interrupt priority level (if configurable). Higher number = higher priority. | 1-7 (dsPIC/PIC24) | 1-7 (PIC32) | 0-15 (ARM - 0=highest) |
| Disable FPU Context Save | FPUNoSave | (PIC32 with FPU only) Disable automatic FPU context save if ISR does not use floating-point operations (optimization). | on / off |
| Execute at Startup | StartupExecute | Execute subsystem once during initialization (before first interrupt). | on / off |
Changed in v3.63.x โ The legacy fire-every-step fallback has been removed. A triggered subsystem connected to an Interrupt block whose source is never raised at run-time is now reported as a build-time configuration error instead of silently firing at the model base rate. If an older model relied on that behaviour, connect the subsystem to a Timer-based trigger instead, or mark
StartupExecute=onwhen a one-shot initialisation is all that is needed. The Change Notification (CN) callback also emits a warning whenEVT_ENis empty but at least one channel is configured, to catch the same misconfiguration on CN-driven interrupts.
| Parameter | Variable | Description | Use Case |
|---|---|---|---|
| Time Source | Triggered_Sub_TimeSource | Timing reference for triggered subsystem sample time. | โข Base rate: Synchronized to model base rate | โข Periodic trigs: User-specified period | โข Hardware timer: Dedicated timer resource |
| Trigger Period | TrigsPeriod | (Periodic trigs mode) Subsystem sample time when using periodic trigger mode. | Any value matching trigger rate (e.g., 100e-6 for 10 kHz) |
| Timer Resolution | TIMER_Resolution | (Hardware timer mode) Select timer prescaler for desired resolution and max period. | Dynamic list based on device: | โข dsPIC: 1, 8, 64, 256 prescalers | โข PIC32: 1, 2, 4, 8, 16, 32, 64, 256 | โข SAM: 8, 32, 128 divisors |
The block automatically detects interrupts from peripheral blocks in your model:
| Peripheral | Interrupt Types | Example Usage |
|---|---|---|
| ADC | โข Conversion complete | โข Individual converter done |
| PWM | โข Period match | โข Trigger event |
| QEI | โข Position counter overflow | โข Index pulse |
| UART | โข RX data ready | โข TX buffer empty |
| SPI | โข Transfer complete | โข Buffer full/empty |
| I2C | โข Master/slave events | โข Address match |
| CAN | โข Message received | โข TX complete |
| Timer | โข Period match | โข Compare match |
Peripheral blocks advertise themselves to the Interrupt block through the MCHP_USER_INTERRUPTS mask parameter. The Interrupt block scans every block in the model with a non-empty MCHP_USER_INTERRUPTS field and aggregates the entries into the Interruption popup.
Declaration format โ one or more semicolon-separated entries, each with four {โฆ} fields:
{InterruptFlagRef}{ShortDescription}{LongDescription}{Parameters};
| Field | Purpose | Example |
|---|---|---|
InterruptFlagRef | C symbol used to reference the interrupt enable bit (e.g. CN1IE, U1RXIE, AD1IE). | CN1IE |
ShortDescription | Short label shown in the Interrupt block popup. | CN1 |
LongDescription | Descriptive label shown in the tooltip. | Change Notification - 1 |
Parameters | Space-separated Name(Value) tokens โ see below. For backward compatibility, a bare numeric value is accepted and treated as Priority(N). | VectorName(U1RXInterrupt) Config_BitSet(IEC0bits.U1RXIE=1) RegisterReadClear(IFS0bits.U1RXIF) Priority(-1) |
Parameter tokens (inside the fourth field)
| Token | Meaning |
|---|---|
VectorName(txt) | Name of the ISR vector. If empty, no new vector is generated โ the peripheral driver already owns the ISR and the Interrupt block generates a callable user function invoked by the driver via MCHP_CallUserISR() (see Driver / User ISR Coexistence below). If non-empty, the Interrupt block emits the full __attribute__((interrupt)) vector itself. |
Config_BitSet(txt) | Register bit(s) to set in order to enable the interrupt (e.g. IEC0bits.U1RXIE=1). |
RegisterReadClear(txt) | Register / bit to read-clear to acknowledge the interrupt flag. |
Priority(N) | Fixed priority, or -1 to let the Interrupt block mask expose a user-editable Interrupt Priority field. Priority ownership rule โ whichever block sets Priority is responsible for programming the associated IPC bits; other blocks must leave priority at -1. |
Example โ Change Notification (single channel) (from MCHP_CN_Callback.m):
NewMask.Values.MCHP_USER_INTERRUPTS = ...
['{CN1IE}{CN1}{Change Notification - 1}{' NewMask.Values.IntPriority '};'];
Because the fourth field is just a number, it is treated as Priority(N); VectorName is therefore empty โ the Interrupt block does not emit a duplicate vector for this entry.
Peripheral drivers and user-defined Interrupt blocks can request the same vector. The blockset resolves this with a three-tier architecture that is selected automatically from the MCHP_USER_INTERRUPTS declaration:
| Tier | Trigger | What is generated | Used by |
|---|---|---|---|
| Tier 1 โ Inline | VectorName empty, Priority present (numeric) | The peripheral TLC emits the ISR directly; the Interrupt block content is inlined at the end of the ISR. | Change Notification (CN). |
| Tier 2 โ Function call | VectorName non-empty and Priority โ -1 | The peripheral driver owns the __attribute__((interrupt)) function and calls MCHP_CallUserISR(IE_ref) at the end of its ISR; the Interrupt block emits a plain callable function with the user subsystem’s body. | Most peripherals โ ADC, UART, Timer, QEI, PWM events, etc. |
| Tier 3 โ Hardcoded | VectorName empty, fixed Priority(0) | Driver has an embedded ISR with a hardcoded call-site; the Interrupt block simply supplies the body. | SPI, I2C. |
Why it matters โ mixing up the rules produces either (a) a linker error from two symbols claiming the same vector, or (b) a silent failure where the user subsystem is never called because the driver ISR does not know about it. The callback enforces this automatically โ no user action required โ but when writing a new peripheral TLC you must follow the same conventions.
| Feature | Configuration | Notes |
|---|---|---|
| Priority Levels | 1-7 (7 = highest) | Default is level 4 |
| Nesting | Automatic if priorities differ | Higher priority can preempt lower |
| Vector Table | Auto-managed by blockset | IVT and AIVT support |
| Context Save | W0-W15, RCOUNT, SR | Automatic register preservation |
| Feature | Configuration | Notes |
|---|---|---|
| Priority Levels | 1-7 (7 = highest) | Sub-priority 0-3 also available |
| Shadow Registers | Automatic if configured | Fast context switch (no save) |
| FPU Context | Optional save/restore | Only if FP ops used in ISR |
| Multi-Vector Mode | Enabled by blockset | Each peripheral has dedicated vector |
| Feature | Configuration | Notes |
|---|---|---|
| Priority Levels | 0-15 (0 = highest) | NVIC priority grouping |
| Tail-Chaining | Automatic hardware optimization | Back-to-back ISRs without full context restore |
| Late Arrival | Hardware-managed preemption | Higher priority can preempt during stacking |
| FPU Lazy Stacking | Conditional FP context save | Only saved if FP registers used |
% Add block to model
add_block('MCHP_Blockset/System Functions/Interrupt', [mdl '/ISR']);
% Configure key parameters
set_param([mdl '/ISR'], 'Interruption', 'ADC1 Interrupt');
set_param([mdl '/ISR'], 'IntPriority', '6');
// PWM triggers ADC, ADC interrupt executes control loop
Simulink Model:
1. Add PWM_HS block with ADC trigger output
2. Add ADC block with interrupt enabled
3. Add Interrupt block
4. Configure interrupt block:
Interruption: 'ADC1 - Conversion Complete'
Triggered_Sub_TimeSource: 'is derived from model base rate'
IntPriority: 7 (highest - critical for motor control)
5. Create triggered subsystem connected to interrupt block
6. Add current control algorithm inside subsystem
Result: Current loop executes synchronously with PWM/ADC
// Process received data asynchronously
Configuration:
Interruption: 'UART1 - RX'
Triggered_Sub_TimeSource: 'is derived from trigs; trigs must be periodic'
TrigsPeriod: 1e-3 % 1 ms assumed for timing (actual rate is async)
IntPriority: 3 (medium priority)
StartupExecute: on (initialize buffers)
Subsystem:
- Read UART data from peripheral block
- Parse protocol
- Update command registers
// Custom periodic task independent of base rate
Configuration:
Interruption: 'User Timer1' (created by peripheral block)
Triggered_Sub_TimeSource: 'is derived from a hardware timer'
TIMER_Resolution: 'Resol: 32us - MaxPer: 2.1s' (prescaler 256)
IntPriority: 5
Result:
- Dedicated timer allocated automatically
- Interrupt triggers at specified rate
- Independent of Simulink sample times
// Extend encoder range with software counter
Configuration:
Interruption: 'QEI1 - Position Counter Overflow'
Triggered_Sub_TimeSource: 'is derived from model base rate'
IntPriority: 6 (high - timing critical)
Subsystem Logic:
if (QEI_DIR == FORWARD)
ExtendedPosition += 65536;
else
ExtendedPosition -= 65536;
end
| Problem | Cause | Solution |
|---|---|---|
| Interrupt not listed | Peripheral block not in model or interrupt not enabled | Add peripheral block, enable interrupt in peripheral config |
| Subsystem never executes | Interrupt source not configured correctly | Verify peripheral interrupt enable, check flag register |
| System hangs in ISR | Interrupt flag not cleared | Ensure RegisterReadClear is correct in peripheral definition |
| Priority not working | Architecture limitation or incorrect setting | Check device datasheet for valid priority range |
| FPU corruption (PIC32) | FPUNoSave enabled but FP ops in ISR | Disable FPUNoSave or remove FP operations from ISR |
Keep ISR execution time short - long ISRs can cause overload
Higher priority ISRs can preempt lower priority - ensure reentrancy
Hardware timer mode consumes one timer resource
StartupExecute useful for initializing communication protocols