bogus919 2014. 5. 7. 11:05

Prescaler

From Wikipedia, the free encyclopedia

prescaler is an electronic counting circuit used to reduce a high frequency electrical signal to a lower frequency by integer division. The prescaler takes the basic timer clock frequency (which may be the CPU clock frequency or may be some higher or lower frequency) and divides it by some value before feeding it to the timer, according to how the prescaler register(s) are configured. The prescaler values that may be configured might be limited to a few fixed values (powers of 2), or they may be any integer value from 1 to 2^P, where P is the number of prescaler bits.

The purpose of the prescaler is to allow the timer to be clocked at the rate you desire. For shorter (8 and 16-bit) timers, there will often be a tradeoff between resolution (high resolution requires a high clock rate) and range (high clock rates cause the timer to overflow more quickly). For example, you cannot (without some tricks) get 1 µs resolution and a 1 sec maximum period using a 16-bit timer. If you want 1 µs resolution you are limited to about 65 ms maximum period. If you want 1 sec maximum period, you are limited to about 16 µs resolution. The prescaler allows you to juggle resolution and maximum period to fit your needs.