NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Multiple Event Timer

May 27, 2012
by unnamed0404
unnamed0404's Avatar

Hello,

In my project, I'm trying to identify/display the time differences between several events. There will be 2 or 3 analog inputs, and they will each reach a certain threshold voltage at slightly different times. I want to detect the timestamps when each input reaches that threshold. To do this, I'm thinking about using the analog comparator, with the positive input tied to the internal bandgap reference, and then the negative input tied to 3 multiplexed inputs (the A to D inputs, w/ a to d function turned off).

Is it possible to continuously cycle thru each of the inputs as the comparator input, w/o losing too much time? By losing too much time, I mean if it takes a long time for the comparator to switch that input to the other pin. The reason this matters is that my events will be quite time sensitive, so I don't want to miss the real time when a threshold was reached by too many microseconds. I was planning to keep track of time by using the real_time_clock example that was posted, just modified for higher resolution. Then I would use interrupts to log the times. Does that sound reasonable? Or is there an better way to do this?

Thanks, Chris

May 28, 2012
by pcbolt
pcbolt's Avatar

Hi Chris -

I would bet the method you described would work quite well. One way you might improve on it would be to have the Analog Comparator directly trigger the Input Capture function on Timer1. Also, since Timer1 is 16-bit, you could maximize your resolution.

Post a Reply

Please log in to post a reply.

Did you know that you can use a transistor to interface between different voltage levels of digital logic? Learn more...