need time calculation from rising edge to falling edge?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attachment(s): 

Last Edited: Mon. Sep 29, 2014 - 02:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Easiest way might be to start a timer running and use a pin change interrupt.

 

On the interrupt, read the time from the timer.

 

If the pin is high, it's a rising edge, save the time in a volatile variable.

 

If the pin is low, it's a falling edge, subtract the time you saved from the current time and there you have it.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut.