LPC1768 MCPWM as a normal PWM output

Guest #3354940
I would like to use the MCPWM as a normal PWM output, because the mbed 
pwm is already in use. Can somebody help me what I should configure to 
control p1.19?

I tried already this, but on the scope I get a DC value 0f 2.36V: Power 
up MCPWM LPC_SC->PCONP |= 1<<17;

PCLK = CCLK (100MHz in our case) LPC_SC->PCLKSEL0 |= 1<<30;

Configuring P1.19 = 33 as MC0A LPC_PINCON->PINSEL3 |= (1<<6);

Set the Limit register (MCLIM0-2 is named as MCPER0-2 in CMSIS source 
file) LPC_MCPWM->MCPER0 = 5555;

Start MCPWM channels 0 LPC_MCPWM->MCCON_CLR = 0xffffffff; 
LPC_MCPWM->MCCON_SET = (1<<0);

LPC_MCPWM->MCPW0 = 2777;

My idea is to get a frequency of 180 Hz and a duty cycle of 50%.

Thanks in advance.

Reply

A question of your own? This thread is over 13 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.