Home > other >  Second, the principle of PWM waveform:
Second, the principle of PWM waveform:

Time:11-06


Produce principle of waveform source: http://www.ndiy.cn/thread-31081-1-1.html
General timer pulse output, can use the GPIO pin is configured to compare the output, the PWM output function, capture/compare register TIMx_CCR is used as a comparison function, it is referred to as below to compare the registers,
Here illustrate the working process of the PWM output for timers directly: if the configuration TIMx_CNT pulse counter for counting up, and overloading register TIMx_ARR is configured to N, namely TIMx_CNT current count value X under the drive of TIMxCLK clock source continuously accumulate, when TIMx_CNT numerical X is greater than N, will reset TIMx_CNT value of 0 to count,
In TIMxCNT count at the same time, TIMxCNT will count value X and compare registers TIMx_CCR stores the value in advance A comparison, when the pulse counter TIMx_CNT numerical X is less than the value of the compare register TIMx_CCR A, output high level or low level, on the contrary, when the pulse counter value X is greater than or equal to compare the value of the register A, output low level (or high level),
Such circulation, the output pulse cycle for overloading register TIMx_ARR stored value (N + 1) times the trigger pulse clock cycle, the pulse width is to compare the register TIMx_CCR value multiplied by A trigger pulse clock cycle, the output of the PWM duty cycle for the A/(N + 1),
Prev:OLED