PWM Programming in LPC2148
LPC2148 supports 2 types of PWM:
1) Single edge PWM - The pulse starts with the new period, ie the pulse is always at the beginning
2) Double Edge PWM - Pulse can be anywhere within the Period
A PWM block, such as a timer block, has a timer counter and an associated Prescale record along with the matching records. These work in exactly the same way as in the case of Timers. I have explained them in the introductory part of the Lpc214x Timer @ Here tutorial. Matching registers 1 to 6 (except 0) are set to LPC214x, ie the corresponding outputs are diverted to the actual pins in LPC214x MCU. The PWM function must be selected for these pins to obtain the PWM output.
In LPC214x we have 7 match records within the PWM block. Generally, the first match register PWMMR0 is used to generate the PWM period and therefore, there are 6 match records PWMMR1 to PWMMR6 to generate 6 single edge PWM signals or 3 double edge PWM signals. The double-row PWM uses 2 match registers, so we can only get 3 double-edge outputs.