Professional Documents
Culture Documents
PWM Registers
PWM Registers
PWMLER PWM Latch Enable Register– Enables use of new PWM Match values
PWMPCR PWM Control Register– Enables PWM outputs and selects PWM
channel types as either single edge or double edge controlled.
Steps necessary to setup PWM in LPC2148 ARM7 an output
a single value:
• Setup the Pin Select Register to select PWM for the port we want
• Setup the Clock Divider Register for the PCLK (VPBDIV)
• Setup the PWM Timer Prescale Register
• Setup the IO direction for the PWM pin you plan to use as output
• Enable the particular PWM channel you want to use in the PWM Control Register(PWMCR)
• Set the maximum number of counts in one cycle. This is done in Match Register 0 (PWMMR0)
• Set the value for duty cycle in the particular match register you want to use (PWMMRx where
“x” is from 1 to 6)
• Setup the PWM Match Control Register to cause a counter reset when the match register occurs
(PWMMCR)
• Set the PWM latch Enable Register to enable the use of match value (PWMLER)
• Reset the timer counter using a bit in the PWM Timer Control Register (PWMTCR)
• Enable the timer counter and enable the PWM mode using the PWM timer control register
(PWMTCR).
PWM output
•t is used to control the update of the PWM Match Registers when they
are used for PWM generation.
•When a value is written to a PWM Match Register while the timer is in
PWM mode, the value is held in the shadow register. The contents of
the shadow register are transferred to the PWM Match Register when
the timer resets (PWM Match 0 event occurs) and if the corresponding
bit in PWMLER is set.
Web Link
https://binaryupdates.com/pwm-in-lpc2148-arm7/
https://www.electronicwings.com/arm7/lpc2148-
pwm#:~:text=LPC2148%20has%207%20PWM%20match,in%20Double
%20Edge%20Controlled%20PWM.