1

I want to accurately time multiple digital input channels (readings from sensors) for the rising and falling edges. I need the precision of the Timer1 Input Capture. As far as I know the input capture only listens to pin D8 (for ATmega8). So, is there anyway to capture the inputs of multiple sensors?


Update:

I would like the reading to be as accurate as possible since I'm using the values to calculate motion tracking information. Concretely, I'm trying to build my own tracker for StreamVR's light house.

  • How accurately? (in microseconds) – Nick Gammon Mar 13 '17 at 7:09
  • As accurate as possible... see my edited question. BTW, I've read your note on Arduino's interrupt... That is very valuable! Thanks! :D – Andy Li Mar 13 '17 at 7:24
  • "As accurately as possible" is too vague. You may as well say you want to have "as much money as possible" in a job interview. Do you want accuracy down to 1 ns? 1 µs? 1 ms? 10 ms? Let's say your answer is "1 ns". Then the ATmega8 isn't the chip for you. – Nick Gammon Mar 13 '17 at 7:27
  • If you use pin-change interrupts, then you will get "as much accuracy as possible" that pin-change interrupts will give you. – Nick Gammon Mar 13 '17 at 7:28
  • Then you better use the ATmega328P, because the ATmega8 doesn't have "PCINT" (Pin Change Interrupt). Some older sensors use frequency output, because a microcontroller could read that. However, today there is I2C and SPI interface. If you can't get another interface than a frequency output and you want the best accuracy, then you have to add extra hardware to read those signals. – Jot Mar 13 '17 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.