--- Jack Xu <xyxznp@...> wrote: > Hi all, Hi Jack, > REG(PWM0_PCR)=0x7400; /*enable PWM2,4,6, single > edge*/ 0x5400 would be right here (you don't use PWM5) > REG(PWM0_TCR)=0x000A; //Reset TC counter > > REG(PWM0_MR0)=0x0400; //set up the PWM period Please set the value in MR0 *BEFORE* you enable the PWM (which you did in the previous access to PWMTCR). Your PWMMRx values will otherwise never be used! See the description of PWMTCR in der User Manual. PWMMR0 = 0x0400 PWMTCR = 0x000A > 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 > Here you probably want to set the duty cycles of PWM2, PWM4 and PWM6. But in single edge mode, it's MR2 that controls PWM2! MR4 controls PWM4, and MR6 controls PWM6. So set: PWMMR2 = 0x0050, PWMLER |= 0x04; PWMMR4 = 0x0100, PWMLER |= 0x10; PWMMR6 = 0x0150, PWMLER |= 0x40; Cheers, Rolf __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Message
Re: [lpc2000] PWM
2005-02-17 by lpc_bavaria
Attachments
- No local attachments were found for this message.