- Convert percentage-based duty cycles into hardware-specific compare values,
- Support both floating-point and fixed-point calculations,
- Simplify code generation across many device families and configurations.
Why R2024b C2000 ePWM Block generates useless "tbprdValue?Outputs" variable?
11 views (last 30 days)
Show older comments
As described in the title, after upgrading to R2024b, I found that each ePWM block will automatically generate a sentence like this:
uint16_T tbprdValue?Outputs = EPwm?Regs.TBPRD;
where ? represents the ePWM number. However, I found that this variable is not used in any file of the project.
Though it doesn't influce the functionality of the software, I wonder what's the purpose of adding this sentence to the code-gen result.
Thanks and best regards to anyone who found this post!
0 Comments
Answers (1)
Anudeep Kumar
on 28 Jul 2025
I came across your question and decided to dig deep. I found a Target Language Compiler file mentioning the value and Its main purpose seems to be to facilitate calculations related to the ePWM module's compare (CMP) values
I found the file '<Your MATLAB Root >/toolbox/c2b/tic2000/blocks/mex/tlc_c/c2802xpwm.tlc'.
There are multiple instances and defintions of 'tbprdValue%<pwmModule>Outputs' and the file states tbprdValue%<module> is used for calculation of CMPx values.
As far as I understood after going through the defintion of code
tbprdValue and its variants are not redundant—they are used throughout the generated code to:
Even if they appear unused in some configurations, they're essential for others, and their presence makes the code generation process robust and flexible.
Here is the documentation of Counter Compare in ePWM for your reference.
I hope this helped to some extent!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!