- CTR = Zero
- CTR = Incrementing and equal to COMPB
- CTR = Decrementing and equal to COMPB
How to set flag in c2000 blockset code of Matlab for ADC SOC?
1 view (last 30 days)
Show older comments
I am using DSP f28335 for my code. I am giving 3 separate set of ADC SOC from EPWM. One is at EPWM (ctr=Zero),EPWM (ctr= incrementing and equal to comp B), EPWM (ctr= decrementing and equal to comp B).I need to check the correct instance of ADC Soc, for ADC SOC at EPWM (ctr=Zero) using a flag
. But in the blockset i am not getting how to set a flag and latch its output at some GPIO pin for comparison.

0 Comments
Answers (1)
Amish
on 27 Mar 2025
Hi Ankita,
To achieve the required functionality on the Texas Instruments DSP F28335, you need to set up a mechanism to trigger ADC conversions at specific events and then latch a flag to a GPIO pin for monitoring.
Configure your ePWM module to generate ADC Start of Conversion (SOC) triggers at the desired events and then use the ePWM block to set these events and connect them to the ADC SOC triggers.
Next, you will have to use the ADC block in Simulink to configure the ADC module. Make sure to set it to start conversion based on the ePWM SOC triggers. Use a logical block or a custom function block to detect when the ADC SOC is triggered at CTR = Zero. Implement a flag that is set when the SOC occurs at CTR = Zero. You can use the Data Store Memory block to hold the flag value.
Once you have the ADC setup and the flag configured, you can latch it to the GPIO. Use the GPIO block in Simulink to configure a specific GPIO pin for output. Create logic to latch the flag to the GPIO pin. This can be done using a simple logical operation or a Stateflow chart to ensure the flag is latched only when needed.
Also, if the logic becomes complex, consider using Stateflow to manage states and transitions for setting and resetting the flag.
Hope this helps in giving you a fair idea!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!