Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

LPC2214 PWM configuration problem(s)

LPC2214 PWM configuration problem(s)

2005-05-13 by Remis Norvilis

I'm having difficulty setting up a PWM output for a LPC2214 (P0.21 
pin as PWM5 single-edge output) for a 50% duty cycle continuous 
pulse. I've seen a Keil LPC21xx example referencing a "PWMEMR" 
register (at address  0xE001403C) used to set the state of the match 
outputs. I can't find any reference to this in IAR or Philips 
documentation. The curious thing is that with the following setup 
code the PWM5 output will eventually begin to work (after several 
minutes running from internal flash or from a debug session in 
external RAM) . Is there anything that I'm missing (either in 
substance or sequence) in the following setup code for "reliable" 
operation?

void main(void)
{
   PINSEL1 |= 0x00000400; // set P0.21 pin is set for PWM5 output 
function
   
   PWMTCR = 0x0000000A; // disable PWM counter, reset PWM Timer and 
Prescale counters, enable PWM mode

   PWMPR  = 0x00000001; // PWM prescale counter division scaler value 
( / 2 ???) ???

   PWMPCR = 0x00002000;   // enable PWM5 output (single-edge control)

   PWMMCR = 0x00000002; // reset PWM timer on PWMMR0 count match ???

   PWMMR0 = 0x00000100; // set PWM match count value (for ~= 7 KHz @ 
14.7456 MHz XTAL) ???
   PWMMR5 = 0x00000080; // set PWM match 5 count value (1/2 PWM match 
0 ???) ???

   PWMLER = 0x00000021; // set PWM0 and PWM5 latch enables 

   PWMTCR = 0x00000009; // take PWM timer counter out of reset and 
enable PWM counter

   while (1); // output forever...
}

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.