Dear all,
I want to generate asymmetric triangle waves (the slope of the triangle wave is not the same on both sides). So I placed the ePWM clock divider bits CLKDIV and HSPCLKDIV on the interrupt. Each time the code enters the main interrupt, it changes the frequency division factor. I don't know Is this idea achievable?
The following code is placed in the main interrupt, but changing the size of its value, as if it had no effect on the triangular wave, the value of the TBCTL register has not changed.
(*ePWM[1]).TBCTL.bit.HSPCLKDIV = HSPCLKDIV_PRESCALE_X_10;
(*ePWM[2]).TBCTL.bit.HSPCLKDIV = HSPCLKDIV_PRESCALE_X_10;
(*ePWM[3]).TBCTL.bit.HSPCLKDIV = HSPCLKDIV_PRESCALE_X_10;
(*ePWM[1]).TBCTL.bit.CLKDIV = CLKDIV_PRESCALE_X_128;
(*ePWM[2]).TBCTL.bit.CLKDIV = CLKDIV_PRESCALE_X_128;
(*ePWM[3]).TBCTL.bit.CLKDIV = CLKDIV_PRESCALE_X_128;
1. How to realize asymmetric triangular wave?
2. Is there any problem with the above operation?
Thank you very much! ! !