Skip to main content
Visitor II
March 14, 2010
Question

PWM capture with TIM1?

  • March 14, 2010
  • 12 replies
  • 3033 views
Posted on March 14, 2010 at 23:01

PWM capture with TIM1?

    This topic has been closed for replies.

    12 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:07

    Hi georg,

    Try adding this line after while (!TIM1_SR1_CC1IF);

    while (!TIM1_SR1_CC2IF);  // wait until capture event

    I think that you should wait for two events: first the CC2 event to read the duty cycle and the second one is to read the period.

    I hope this helps you otherwise I should run your code to find out the issue.

    Kep me informed.

    Mit besten grüssen,

    MCU Lüfter

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:07

    Hi georg,

    Add TIM1_SR2 = 0x00; after TIM1_SR1 = 0x00; that could help !

    Lüfter