Yahoo Groups archive

Lpc2000

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

Message

PWM

2005-02-16 by Jack Xu

Hi all,
I try to use PWM2 on LPC2210. pclk is 5MHz

PCONP has default value:0x7FFFE;

I add following code before start PWM:
REG(PINSEL0)=0x800A8005;/*Set p0.7, p0.8, and p0.9 as
PWM2, PWM4, PWM6*/
REG(IO0DIR)|=0x00000380;//set PWM2, PWM4,PWM6 as
output

and then I start PWM:
REG(PWM0_PR)=0x0000; /*no prescaler - one cpu clk is
one PWMclk*/
REG(PWM0_MCR)=0x0002; /*Reset timer counter register
on match0*/
REG(PWM0_PCR)=0x7400; /*enable PWM2,4,6, single edge*/
REG(PWM0_TCR)=0x000A; //Reset TC counter

REG(PWM0_MR0)=0x0400; //set up the PWM period
REG(PWM0_LER)|=0x1;//BIT0 Latch the value

REG(PWM0_MR1)=0x0050; //set up initial PWM duty cycle
REG(PWM0_LER)|=0x2;//BIT1 latch the value

REG(PWM0_MR2)=0x0100; //set up initial PWM duty cycle
REG(PWM0_LER)|=0x4;//BIT2 latch the value

REG(PWM0_MR3)=0x150; //set up initial PWM duty cycle
REG(PWM0_LER)|=0x8;//latch the value

REG(PWM0_TCR)=0x0009; //set the TC

p0.7 (PWM2) stays high all time. What I miss here.


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

Attachments

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.