Forums

Quad Timer question

Started by Chad Beauregard October 14, 2002
Here's an example of what I need to do:

Suppose there's a motor with a toothed wheel (so you can determine it's
exact position) and a user operated pushbutton. I need to determine
exactly at what motor position the operator pressed the button. I have
the pulse train from the toothed wheel coming in on Timer C0, and the
pushbutton coming in on Timer C1....I need to get the counter value of
TC0 when the TC1 event happens.

As I understand it now, each timer channel has its own counter, and the
only way I've found so far is to use "ioctl(TimerCaptureC0,
QT_READ_COUNTER_REG, NULL)". This obviously introduces some error,
since I'm reading a rolling counter value rather than a latched value.
Is there a way to make each channel read from the same counter? Is
there a better way to set up the timers to capture these events? This
is my first DSP project after migrating from the HC12 platform, and I'm
finding that I need to think about the timers in a completely different
way...