Do you have a question? Post it now! No Registration Necessary
- Posted on
- Purpose for ...capture/compare
- John Tan
December 26, 2003, 2:20 am
rate this thread
Re: Purpose for ...capture/compare
them on PICs and 8052 derivatives.
The idea is that a 16bit register value is compared to a free-running timer.
Several actions can be set up to occur when the timer matches the register,
automatically set, clear or toggle a pin with an accuracy of one timer
trigger an adc conversion (the adc interrupt can then be used to process
clear the timer
generate an interrupt
The interrupt is typically used to
add a delay value to the comparator register for the next match - you can
change the delay each time.
set up external hardware for the next match
change the operating mode of the comparator
Here are some applications I have used them for:
precise frequency generation
multi-rate adc sampling
generating quadrature step signals for a stepper motor, with ramp
calculation in the ISR.
In capture mode, you grab the timer value when an input changes state.
Useful for motor apps.
In PWM mode, the timer generates the period, and the comparator sets the
One use for a pwm output as a cheap DAC.
The output voltage after low-pass filtering is proportional to the duty
For more info download a microcontroller datasheet eg PIC16F876 from the
Dave Austin. .
- » Ping Jim Thompson Sine Shaper question ????
- — The site's Newest Thread. Posted in » Electronics Design