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