Main Content

Add Hardware Interrupt Trigger Block for Current Control Loop

In the Simulink® Library Browser, select and add the C28x Hardware Interrupt block from C2000™ Microcontroller Blockset > Scheduling.

In the block parameters dialog box, update the settings to configure the hardware interrupt ADCINT1. Also, identify and update the CPU and PIE interrupts for the hardware interrupt ADCINT1.

Parameter in C28x Hardware Interrupt BlockSettings

CPU interrupt numbers


PIE interrupt numbers


In the current control subsystem, add a Trigger block and set the Trigger type block parameter to function-call. Connect this subsystem trigger input to the C28x Hardware Interrupt block as shown in this figure.

In the Rate Transition block input to Current Control subsystem, change the Output port sample time to -1.

Add a Function-Call Generator block in variant source to support the model simulation. In the Function-Call Generator block, set the Sample time parameter as Ts (50e-6).

Simulate the model with the updated driver blocks and check the simulation results in the Simulation Data Inspector. Variants ensure that ADC, PWM drivers, and interrupts are not active during simulation.