I found two issues. First is that I missed initializing the PWMCR_PWMENABLE bit. Second is that when I was changing the match register value, I was setting the latch bit. Matt --- In lpc2000@yahoogroups.com, "MattKav" <mkavalauskas@b...> wrote: > I am confused about setting up the PWM code. Below is my > initialization code. Here is my confustion... > When I set PWMMR4 to 0, I get a very short logic 1 output. I would > expect it to always be 0. > When I set PWMMR4 to 100, it is always logic 0 output. I would expect > it to always be 1. > When I set PWMMR4 to 101, it is always logic 1 output as expected. > > Am I doing something wrong, or do I have wrong expectations? > > Thanks, > Matt > > // PWM4 > PINSEL0 = (PINSEL0 & ~PWM4_PINMASK) | PWM4_PINSEL; > > //PWMTCR = 0x5; > PWMTCR = PWMCR_RESET; // reset & disable timer 1 > PWMPR = PWM_PCLK_DIV - 1; // set the prescale divider ( 3-1 = 2) > > PWMMCR = PWM_MR0_R; // reset PWM0 when a match occurs > PWMPCR = PWM_ENO4; // enable PWM4 output > > PWMMR0 = 100; // reset PWM0 every 100 ticks > PWMMR4 = 50; // 50% duty cycle on PWM4 > PWMLER = PWM_ENL4; // enable the pwm match register values > > PWMTCR = PWMCR_ENABLE; // enable pwm
Message
Re: PWM settings - SOLVED
2005-08-02 by MattKav
Attachments
- No local attachments were found for this message.