xinqi wang

Questions of using capture timer for pulse width measure?

Discussion created by xinqi wang on Jul 7, 2009
Latest reply on Jul 15, 2009 by Processor Expert

My MPU: HCS12. Task: Measure RF controller PWM signal duty cycle. PWM frequency= 44.5Hz i.e. period= 22.5ms. PWM maxmum duty cycle 1.9ms. I tried one PWM signal takes two timers. say, RF AILERON PMW connects to PT0 &PT4. PT0 rising edge capture, PT4 falling edge capture. It works fine. The period is the interval of two rising edges and duty is the interval of one rising and one falling edge.

But I am tight on timer ports, I have 5 such PWMs would need 10 timers ports this way. So I tried in codewarrior "capture bean property" to setup "capture ' rising or falling edge' ".  through comparing the capture intervals with 1.9ms to determine whether it is duty or not. But the data I got is only the PWM period, no duty at all in this way. The possibility should be capture only happen at one kind of edge, say only capture at rising edge.

Is there anything wrong with the setup? I don't think that I should setup capture with both edges, that way two captures(one rising ,one falling)cause one interrupt, my understanding.

 Any comments would be really appreciated! 

Outcomes