This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using timer as PWM in LPC1768!

Dear all,
The number of PWM signals I want to use in my project is more than what LPC1768 generally has (6PWM + 3MCPWM). This is where I think I should use timers to generate PWM pulses. Since the frequency is so high, I cannot use timer interrupts to do my job.
I tried to use external match registers, but it gives me a square signal (duty cycle cannot be changed.) the problem is that on each MATn.m, only one bit of EMR works.
Is there any way I can generate PWM signals whith variable duty cycle (frequency is constant)using timer unit?

thanks in advance for helping

  • you need to use two match registers for example MR0 and MR1. MR0 determines the period of the PWM signal and MR0 determines the duty cycle. set match control register for reset on MR0 and none for MR1. configure external match register for MATn.1 to clear on match. I guess that it will work.

  • Thanks dear Mohammad
    I have already tried that, the problem is that MR0 match register (used for the period) does not clear the output in reset, which in this case leads to a very nice square signal whose output toggles only on MR1 match. and its duty cycle is always 50%.
    Actually I have kind of solved it. there is no way not to use interrupt, but I have used only one interrupt in each cycle. (the minimum possible)

    Best regards
    Reza