2005-10-13 07:44 AM
Duty cycle detection using single pin.
2005-10-12 08:14 PM
Hi, All.
Could anybody suggest me the way how to detect duty cycle or pulse width of external PWM using single pin of micro? I can do it using 16bit timer, input capture and having PWM on 2 pins: first pin is for rising edge and second one--for falling edge interrupt sensivity. But I would like to use only one pin. Tnx for all ideas.2005-10-12 09:55 PM
Luter,
I may have misunderstood what you need... My 1 eurocent idea is to use the input capture interrupt. In the handler code which is called for both the rising and falling edge, you can poll the input capture pin state. If it is high, compute the low signal duration and acquire the start of the high state. If it is low, compute the high signal duration and acquire the start og the low state. I hope this is what you need... EtaPhi2005-10-12 10:22 PM
Exactly, i m using input capture int. but it is possible to choose either falling or rising edge, but not both simultaneuosly. or possible? I am using st7mc2.
2005-10-12 11:22 PM
I see that ST7MC2 are different beasts from ST7FLITEs...
However, why do you not toggle the input sensibility inside the interrupt handling routine? Regards, EtaPhi2005-10-13 12:39 AM
I got this idea. but the problem is that i have 2 high-priority relatively long interrupts. It could bring problems if pulse width is relatilely short. I see some solutions, but still opened for another ideas.
Anyway, tnx for help.2005-10-13 07:44 AM
Hy,
I have used this method, detect the value pin to toggle the interrupt polarity This permit to measure duty cycle from minimun( != 0%) and maximum ( !=100%). These extreme cases are recognized from polling By