Main Content

Add Hardware Interrupt Trigger Block for Current Control Loop

In the Simulink®Library Browser, select and add the C28x Hardware Interrupt block fromEmbedded Coder®Support Package for Texas Instruments™ C2000™ Processors>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 Block Settings

CPU interrupt numbers

[1]

PIE interrupt numbers

[2]

In the current control subsystem, add aTriggerblock and set theTrigger typeblock parameter tofunction-call. Connect this subsystem trigger input to theC28x Hardware Interruptblock as shown in this figure.

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

Add aFunction-Call Generatorblock in variant source to support the model simulation. In theFunction-Call Generatorblock, set theSample timeparameter asTs(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.