How to simulate C2000's eCAP, ePWM, ADC, and interrupt control functions in Simulink to implement power topology control.

11 views (last 30 days)
I want to design a power circuit topology and use the C2000 series 280049C for the control part. How can I simulate interrupt functions, ePWM, ADC, and eCAP functionalities in Simulink? If I have already written DSP code, can I run the code in Simulink for simulation?

Answers (1)

Soumya
Soumya 6 minutes ago
Hi @ui,
I understand you are trying to design a power electronics topology controlled by a Texas Instruments C2000 (TMS320F280049C) device and would like to simulate the complete control chain including interrupts, ADC sampling, ePWM generation, and eCAP capture within Simulink. You also want to know if your existing DSP (C/C++) code can be executed inside the Simulink simulation environment.
You can simulate C2000 peripherals using the C2000 Microcontroller Blockset:
  • ePWM: switching control and dead-time configuration
  • ADC: sampling synchronized with SOC trigger events
  • eCAP: timing/capture measurement of input signals
  • Interrupt Scheduling: modeled using Function-Call Subsystems triggered by ePWM/ADC events
To simulate the power stage (inverter, DC-DC converter, switching devices, sensors), integrate:
  • Simscape Electrical for closed-loop converter simulation
This approach preserves MCU-like timing behavior in Simulink.
Your written control code can be executed in the loop using:
  • Software-in-the-Loop (SIL): runs generated C code on the host PC
  • Processor-in-the-Loop (PIL): runs code directly on the F280049C hardware while the plant is simulated in Simulink
  • Legacy Code Tool / Custom Code Import: integrate existing ISRs or library functions into Simulink models
This enables testing functionality and timing before deploying to hardware
You can refer to the following documentations for more information:
I hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!