This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PWM tips.

Assume a constant frequency PWM.
Assume that a period begins on the low to high transition. Suppose an application needs to change the duty cycle.
Question 1. Should (must) changes to the duty cycle be done on the same edge (i.e. low to high)? Can the change be done on _any_ part of the cycle?

Question 2. Are there scenarios where the duty cycle should be changed gradually? For example, consecutive cycles could see only one bit change until the new duty cycle is reached.

Parents
  • As for the first question, it's written in the microcontroller manual. I'm using ST10F168, and the manual says that the pulse width register is updated at the beginning of every new PWM cycle.
    If you want to implement gradual change of the duty cycle, you could use PWM interrupt and PEC to update the pulse width register. I can't see a faster way of updating the duty cycle.
    I'm assuming that the questions were about the C166/ST10 microcontroller PWM module.

    Regards,
    Mike.

Reply
  • As for the first question, it's written in the microcontroller manual. I'm using ST10F168, and the manual says that the pulse width register is updated at the beginning of every new PWM cycle.
    If you want to implement gradual change of the duty cycle, you could use PWM interrupt and PEC to update the pulse width register. I can't see a faster way of updating the duty cycle.
    I'm assuming that the questions were about the C166/ST10 microcontroller PWM module.

    Regards,
    Mike.

Children
No data