Question

A 24-bit timer is being used in capture mode to measure the period of an input...

A 24-bit timer is being used in capture mode to measure the period of an input waveform. The following ISR places the measured period into a global variable. When the period of the input waveform decreases below 20 ?s, you notice occasional erroneous period measurements that are too large.

a) [15 pts] What is the most likely cause of these errors? How much do you expect an erroneous measurement to deviate from the actual period? Assume the ISR execution time is much less than 20 ?s.

b) [12 pts] How could the valid period measurement range be extended down to 10 ?s?Propose two approaches to try (not necessarily guaranteed to work). You may change the hardware settings, or even add (inexpensive) hardware.

uint32_t period; // measured period in clock cycles

void TimerCaptureISR1(void) { // ISR for capture interrupts
    static uint32_t last_count = 0;
    uint32_t count;
    <clear timer capture interrupt flag>;
    count = <read captured timer count>;
    period = (count - last_count) & 0xffffff;
    last_count = count;

}

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions