Implementing epwm_ex12_monoshot_mode.c in Simulink
Show older comments
Hi,
I am using the TMS320F28379D launchpad from Texas instruments and want to implement the example code epwm_ex12_monoshot_mode.c from texas instrumens, but now in Simulink. I got the epwm_ex1_trip_zone.c example working but am lost with setting up digital compare. Any advice would be appreciated!
To add more context. I am trying to use GPIO67 as a rising edge trigger to enable GPIO0 to make a single PWM.
Answers (1)
Harsh
on 17 Jul 2025
0 votes
To set up the "ePWM" Digital Compare so that "GPIO67" (routed via the Input "X‑BAR" and ePWM X‑BAR as "TRIP4") generates a one‑shot pulse on "GPIO0", follow the below steps:
- Open your "ePWM Type 1–4 block" and go to the "Digital Compare" tab.
- Under "DCA/Event Source", select "TRIP4" (the X‑BAR input from GPIO67).
- Assign that source to "DCAEVT2", and set "Event Condition" to “On Rising Edge.”
- Scroll down to "DCAEVT2 → Trip Zone", choose "CBC Trip", and select "Force ePWMxA" (or ePWMxB) as the action.
- Enable the "Trip Zone Interrupt" for "DCAEVT2" so you can clear the latch afterward.
For more information please refer to the following example from mathworks documentation - https://www.mathworks.com/help/ti-c2000/ug/xbar-example.html
You may also refer to the following documentation to understand how to configure the Digital Compare Submodule - https://www.mathworks.com/help/ti-c2000/ug/sub-modules-of-epwm-type-1-4.html#mw_91d9bcb4-1173-4dbb-bb8d-77f36b299bf7:~:text=Technical%20Reference%20Manual.-,Configure%20Digital%20Compare%20Submodule,-Configuring%20digital%20compare
Categories
Find more on Texas Instruments C2000 Processors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!