In the Simulink® Library Browser, select and add the C28x Hardware Interrupt block from Embedded Coder® Support Package for Texas Instruments™ C2000™ Processors > Scheduling.
In the block parameters dialog box, update the settings to configure the hardware interrupt ADCINT1. In the block parameters dialog box, identify and update the PIE and CPU interrupts for the hardware interrupt ADCINT1.
Parameter in C28x Hardware Interrupt Block | Settings |
---|---|
CPU interrupt numbers | [1] |
PIE interrupt numbers | [2] |
In the current control subsystem, add a Trigger block and set the
Trigger type parameter to
function-call
. Connect this subsystem trigger input to
the 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 for simulation.