Re: Question about the MAVRIC Controller

On Wed, 16 Jul 2003 22:33:11 -0400, Bennet Williams wrote:

Assuming a 16 MHz crystal frequency, the MAVRIC board can measure a pulse width with a resolution down to 1 / 16000000 of a second, or about .063 microseconds.
You do this by setting up one of the input lines to function as an input capture. What happens is, the MCU monitors the state of the line and when it changes, it captures the value of one of the free-running timers which can be clocked at up to the CPU frequency, which in this case is 16 MHz. Say that is the rising edge of the line. You store that value off somewhere, call it T1.
The MCU continues to monitor the state of the line, and when it changes again (the falling edge), the MCU again captures the value of the free running timer. Now store that off to T2.
Your pulse width is T2 - T1, in increments of 1 / crystal_freqency. Thus, if T1 happend to be 20, and T2 happened to be 27412, the pulse width would be 27412 - 20 = 27392 clock ticks, which at 16 MHz operation corresponds to 1.7120 milliseconds.

Not at all. This is a perfectly reasonable question.
Cheers, -Brian
Brian Dean,
BDMICRO - Maker of the MAVRIC ATmega128 Dev Board
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.