I still can't get it running. Karl showed me the way to understand the docu - at least I felt like understanding it... Current code status: //testing PWM4 PINSEL0 |= 0x20000; // select pin 0.08 PWM4 function PWM_PR = 0x0000; // max prescale counter value PWM_MCR = 0x0002; // reset TC when PWMMR0 matches PWM_PCR = 0x7E00; // enable all PWM just to get the right one PWM_TCR = 0x000A; // reset TC counter (not yet needed?!) PWM_MR0 = 0x0400; // match register 0 trigger value PWM_LER |= BIT0; PWM_MR4 = 0x0150; // match register 4 trigger value PWM_LER |= BIT4; PWM_TCR = 0x0009; // set the TC counter and enable the PWMs But still getting the single 88.64 ms pulse. Any idea? Cheers, Kurt. --- In lpc2000@yahoogroups.com, "Karl Olsen" <kro@p...> wrote: > --- In lpc2000@yahoogroups.com, "killtheclock" <kurt.westphal@g...> > wrote: > > > I have an olimex lpc2106-mt pcb and try to program a PWM without > > success. The Docu is not especially detailed (I think). I tried a > lot > > of register settings(for hours). All I get is a single 88.64 ms > pulse > > on PWM4 at reset that does not change with the match register or > pre- > > scaler value. > > > > This code is one example that illustrates my understanding of that > > thing: > > //testing PWM4 > > PINSEL0 |= 0x20000; // select pin 0.08 PWM4 function > > PWM_PR = 0x0000; // max prescale counter value > > PWM_MCR = 0x0002; // reset when PWMMR0 matches > > PWM_PCR = 0x1000; // PWM4 enable, single edge > > PWM_MR0 = 0x0f00; // match register trigger value > > PWM_TCR = 0x0009; // set the TC counter and enable the PWMs > > > > I would expect a 1.92 kHz frequency from that... > > Obviously I do something completly wrong. > > You also need to set PWM_MR4, and then PWM_LER before the PWM_MRx > values take effect. > > Karl Olsen
Message
Re: PWM with olimex lpc2106-mt pcb - how to?
2004-07-21 by killtheclock
Attachments
- No local attachments were found for this message.