Questions of using capture timer for pulse width measure?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Questions of using capture timer for pulse width measure?

1,630 Views
louiswang
Contributor I

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! 

Labels (1)
0 Kudos
1 Reply

302 Views
ProcessorExpert
Senior Contributor III
It seems to be misunderstanding.
 
rising or falling edge: means that the user doesn't care and PE uses rising or falling edge
both edges: capture appears at any edge - at rising edge and also on falling edge
 
Generally the information about property value which is really used by PE can be found in the 3rd column of bean inspector (for more info please see attachement).
 
In case if you need to measure the duty (time between rising and falling edge) you have to set the property "Edge" to "both edges" then the "OnCapture" event will occurs within rising and falling edges.
 
best regards
Vojtech Filip
Processor Expert Support Team
0 Kudos