Hi
I have a PWM generation working with duty cycle as integer number in percentage (like for example 30%)
I would like to have a duty cycke with decimal (like for example 30.5).
I'm using the set duty function coming from HET.C driver
void pwmSetDuty(hetRAMBASE_t * hetRAM, uint32 pwm, uint32 pwmDuty)
{
uint32 action;
uint32 pwmPolarity =0U;
uint32 pwmPeriod = hetRAM->Instruction[(pwm << 1U) + 42U].Data + 128U;
pwmPeriod = pwmPeriod >> 7U;
if(hetRAM == hetRAM1)
{
pwmPolarity = s_het1pwmPolarity[pwm];
}
else
{
}
if (pwmDuty == 0U)
{
action = (pwmPolarity == 3U) ? 0U : 2U;
}
else if (pwmDuty >= 100U)
{
action = (pwmPolarity == 3U) ? 2U : 0U;
}
else
{
action = pwmPolarity;
}
hetRAM->Instruction[(pwm << 1U) + 41U].Control = ((hetRAM->Instruction[(pwm << 1U) + 41U].Control) & (~(uint32)(0x00000018U))) | (action << 3U);
hetRAM->Instruction[(pwm << 1U) + 41U].Data = (((pwmPeriod * pwmDuty) / 100U) << 7U) + 128U;
}
and I'm working with period 10KHz.
How can I modify the set duty?
Thanks
Fabio
