Hi all,
I am having difficulties with initiating the PWM. Here's the code to
enable PWM4 single edge on LPC2104 at 11.0592 Mhz.
PINSEL0 = 0x00020000;
PWMPR = 0x7FF;
PWMPCR = 0x00001000;
PWMMCR = 0x00002000;
PWMMR0 = 0x00002000;
PWMMR4 = 0x00001000;
PWMLER = 0x00000010;
PWMTCR = 0x00000002;
PWMTCR = 0x00000009;
Anything I am missing.
Thanks in advance,
Vineet.
__________________________________________________
PWM Problem
Started by ●June 3, 2006
Reply by ●June 3, 20062006-06-03
I think the problem is that you're using MR4 to reset the counter,
when you should be using MR0 for that.
Try PWMMCR = 0x00000002;
Regards,
Danish
--- In l..., vineet jain wrote:
>
> Hi all,
> I am having difficulties with initiating the PWM. Here's the code to enable PWM4 single
edge on LPC2104 at 11.0592 Mhz.
>
> PINSEL0 = 0x00020000;
> PWMPR = 0x7FF;
> PWMPCR = 0x00001000;
> PWMMCR = 0x00002000;
> PWMMR0 = 0x00002000;
> PWMMR4 = 0x00001000;
> PWMLER = 0x00000010;
> PWMTCR = 0x00000002;
> PWMTCR = 0x00000009;
> Anything I am missing.
>
> Thanks in advance,
> Vineet.
> __________________________________________________
>
>
>
>
when you should be using MR0 for that.
Try PWMMCR = 0x00000002;
Regards,
Danish
--- In l..., vineet jain wrote:
>
> Hi all,
> I am having difficulties with initiating the PWM. Here's the code to enable PWM4 single
edge on LPC2104 at 11.0592 Mhz.
>
> PINSEL0 = 0x00020000;
> PWMPR = 0x7FF;
> PWMPCR = 0x00001000;
> PWMMCR = 0x00002000;
> PWMMR0 = 0x00002000;
> PWMMR4 = 0x00001000;
> PWMLER = 0x00000010;
> PWMTCR = 0x00000002;
> PWMTCR = 0x00000009;
> Anything I am missing.
>
> Thanks in advance,
> Vineet.
> __________________________________________________
>
>
>
>
Reply by ●June 3, 20062006-06-03
Oh and PWMLER probably wants to be 0x00000009 once you've set
PWMMR0 and PWMMR4
- Danish
--- In l..., "Danish Ali" wrote:
>
> I think the problem is that you're using MR4 to reset the counter,
> when you should be using MR0 for that.
>
> Try PWMMCR = 0x00000002;
>
> Regards,
> Danish
PWMMR0 and PWMMR4
- Danish
--- In l..., "Danish Ali" wrote:
>
> I think the problem is that you're using MR4 to reset the counter,
> when you should be using MR0 for that.
>
> Try PWMMCR = 0x00000002;
>
> Regards,
> Danish
Reply by ●June 4, 20062006-06-04
Yes, rightly stated, i realized it that time. Anyways thanks. But the PWMLER
value for PWMMR0 needn't be set since to change the PWM cycle I need to
update the PWMMR4 value.
Thanks,
Vineet.
Danish Ali wrote: Oh and PWMLER probably wants to be 0x00000009 once you've set
PWMMR0 and PWMMR4
- Danish
--- In l..., "Danish Ali" wrote:
>
> I think the problem is that you're using MR4 to reset the counter,
> when you should be using MR0 for that.
>
> Try PWMMCR = 0x00000002;
>
> Regards,
> Danish
SPONSORED LINKS
Microcontrollers Microprocessor Intel microprocessors
---------------------------------
Thanks,
Vineet.
Danish Ali wrote: Oh and PWMLER probably wants to be 0x00000009 once you've set
PWMMR0 and PWMMR4
- Danish
--- In l..., "Danish Ali" wrote:
>
> I think the problem is that you're using MR4 to reset the counter,
> when you should be using MR0 for that.
>
> Try PWMMCR = 0x00000002;
>
> Regards,
> Danish
SPONSORED LINKS
Microcontrollers Microprocessor Intel microprocessors
---------------------------------
Reply by ●June 10, 20062006-06-10
vineet jain wrote:
>Hi all,
> I am having difficulties with initiating the PWM. Here's the code to enable PWM4 single edge on LPC2104 at 11.0592 Mhz.
>
> PINSEL0 = 0x00020000;
> PWMPR = 0x7FF;
> PWMPCR = 0x00001000;
> PWMMCR = 0x00002000;
> PWMMR0 = 0x00002000;
> PWMMR4 = 0x00001000;
> PWMLER = 0x00000010;
> PWMTCR = 0x00000002;
> PWMTCR = 0x00000009;
>Anything I am missing.
>
>
>
Yes, you may have to enable the PWM0 in the PCON register. My code
started to work after I found it was turned off.
TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------
>Hi all,
> I am having difficulties with initiating the PWM. Here's the code to enable PWM4 single edge on LPC2104 at 11.0592 Mhz.
>
> PINSEL0 = 0x00020000;
> PWMPR = 0x7FF;
> PWMPCR = 0x00001000;
> PWMMCR = 0x00002000;
> PWMMR0 = 0x00002000;
> PWMMR4 = 0x00001000;
> PWMLER = 0x00000010;
> PWMTCR = 0x00000002;
> PWMTCR = 0x00000009;
>Anything I am missing.
>
>
>
Yes, you may have to enable the PWM0 in the PCON register. My code
started to work after I found it was turned off.
TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------