I wanted to know if I can modify the pulse_period interval just by modifying the parameter variable map.
In the PWM update function, as shown in the figure, there is a map of variables tending to 100%, can I change it to this value of 255 and only with that change the PWM resolution?
And if not this way, how could I change the PWM resolution of this controller?
Regards,
Hi,
The PWM resolution is ONLY dependent on the PWM module driving clock frequency, you do not say the LPC part number you are using, I give an example based on LPC5516.
This is CTimer driving clock source, if you select main_clk which is 150MHz at most fro lpc5516, the ctimer PWM signal will have the best the resolution, you can see the PWM as a divider.
If you do not use LPC5516, pls check the SYSCON chapter in the UM.
Hope it can help you
BR
XiangJun Rong
I am using an LPC54S018, allowing a PWM from 0 to 100% of the duty cycle. But I wanted to increase this resolution and expand this duty cycle value between 0 and 255,
Could you enlighten me for this part number?
Regards,
Hi,
I come to know your question.
First of all, the code you modified is correct I suppose.
But the actual PWM resolution is dependent on the PWM module driving clock frequency as well as the PWM signal frequency.
For example,for LPC54018, the PWM module driving clock is 180MHz, if your required PWM signal frequency is 180Hz, the PWM period register is 180MHz/180Hz=1000_000, of course, you can get 255 step resolution, the one step is 1000_0000/255=3921.
But if your required PWM signal frequency is 1MHz, the PWM period register is 180MHz/1MHz=18, of course, the duty cycle can be from only 0 to 17, you can not get 255 step resolution.
Hope it can help you
BR
XiangJun Rong