Valid format input to HRPWM module duty cycle control in F28388D

조회 수: 4 (최근 30일)
Lior Ben Yehuda
Lior Ben Yehuda 2021년 12월 21일
답변: Kothuri 2024년 11월 15일 16:06
I am using TI's F28388D DSP, and need to use HRPWM block from the C2000 support package.
My intent is to use the duty cycle input to change the duty cycle. The design uses double percision floating point numbers
as input to the HRPWM block. Will the block clip the number to the closest possible value, or should I convert the floting point input to
fixed point number with the correct format? If so, what is the correct format?

답변 (1개)

Kothuri
Kothuri 2024년 11월 15일 16:06
The “HRPWM” block in the C2000 support package with Simulink can typically handle floating-point numbers as inputs but internally it will clip or convert these numbers to a fixed-point representation based on the resolution of the hardware and the configuration of the PWM module.
  • The HRPWM block typically expects duty cycle inputs in a fixed-point format. This is because the hardware operates with fixed-point arithmetic to control the PWM signal.
  • The input is usually represented as a fraction of the PWM period, where 0 corresponds to 0% duty cycle and 1 corresponds to 100% duty cycle.
  • If your design uses double precision floating-point numbers (ranging from 0.0 to 1.0 for duty cycle), you need to convert these to a fixed-point representation.
  • The correct format often involves using a scaled integer representation that matches the resolution of the PWM hardware. For instance, a 16-bit PWM might expect values in a range from 0 to 65535 to represent 0% to 100%.
  • You can use “Data Type Conversion” block to convert the floating-point input to a fixed-point format. Set the output data type to uint16 or another appropriate fixed-point type based on your PWM resolution.
  • You can use a “Saturation” block to ensure that the converted value stays within the valid range (0 to 65535 for 16-bit).
  • The “floor” function is used in the conversion to ensure that the floating-point value is rounded down to the nearest integer.
You can refer the below links for more info on:

카테고리

Help CenterFile Exchange에서 C2000 Microcontroller Blockset에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by