Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

How to measure a pulse width

2006-03-07 by wbounce

I need to measure how long a pulse is. I have a m128. The pulse goes +5V for 1ms to 36.9ms and then goes 0v for a fixed 65ms. I need to time how long the +5V part is in 10us increments. How would I do that? I will wire the sensor generating the pulse to a pin. I seem to remember something about a capture ability but I do not understand how it works or how to set it up. The fact that the pulse is assymetrical probably does not help.
I am already using timer0 fir a ms timer and timer3 (a and b) for pwm output. so I guess I would have to use timer1 or 2.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.