This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to update different CMP register in ePWM module in F28335?

HI,
when I using SIN wave as CMPA and two different CMPB. Positive half of SIN has different CMPB and negative has another CMPB. My question is how to updated it? I search it but not find any helps from controlSUITE. If you have any link than please provide.

Thanks and Regards,

Anish

  • Hi Anish,

    It is not directly clear to me what you are trying to do. 

    Are you trying to output a sinusoidal PWM out of PWM*A?  Based on what I am reading (and looking at one of your previous posts) this is working.

    It then appears that you are trying to output a duty cycle of one value during the positive cycle and of a different value during the negative cycle.

    ===

    Assuming I'm mostly correct:
    If you are not already, I would recommend generating an ISR every PWM period.  The ePWM peripheral allows you to do this.  In this ISR you will then set CMPA and CMPB as you wish for the next period.  You'll set CMPA based on the next value of sine you need to output (using a sine table or by calculating it) and then set CMPB as value_x if CMPA is greater than some value and value_y if CMPA is less than some value.


    Thank you,
    Brett

  • Hi Brett Sir,
    Thank you so much.

    Regards,
    Anish