Tool/software:
Hi All,
Question about auto conversion
When ON: CMPAHR = (fanction(PWMduty*PWMperiod)<<8
When OFF: CMPAHR = (fanction(PWMduty*PWMperiod)*MEP scale factor + constant)<<8
From this formula, I recognise that the difference between ON and OFF is that the MEP scale factor and We recognise that the difference is whether the constant is entered automatically or manually.
When ON, is the result of constant = TBCLK/MEP time per step automatically entered?
Or is the default of 0.5 automatically entered?
Best Regards,
Ito
Hello Ito,
If auto-conversion is enabled, CMPAHR = fraction(PWMduty*PWMperiod)<<8. The scale factor optimization software calculates the MEP scale factor in the background code and automatically updates the HRMSTEP register with the calculated number of MEP steps per coarse step. The MEP Calibration Module then uses the values in the HRMSTEP and CMPAHR registers to automatically calculate the appropriate number of MEP steps represented by the fractional duty cycle and moves the high-resolution ePWM signal edge accordingly.
If auto-conversion is disabled, the CMPAHR register behaves like a type 0 HRPWM module and CMPAHR = (fraction(PWMduty * PWMperiod) * MEP Scale Factor + 0.5)<<8). All calculations need to be performed by your code in this mode, and the HRMSTEP register is ignored.