A timer prescaler is a hardware feature that divides the input clock frequency by a set value to slow down the timer counting speed. It helps to measure longer time intervals without changing the main clock.
Click to reveal answer
beginner
How does clock division affect timer operation?
Clock division reduces the frequency of the clock signal fed to the timer by dividing it by a fixed number. This makes the timer count slower, allowing it to measure longer durations or lower frequencies.
Click to reveal answer
intermediate
Why do we use prescalers instead of changing the main clock frequency?
Changing the main clock frequency affects the whole system and can cause instability. Using a prescaler only slows down the timer clock, keeping the rest of the system stable and running at the desired speed.
Click to reveal answer
intermediate
In embedded C, how do you typically set a timer prescaler?
You set a timer prescaler by writing a value to a specific register of the timer peripheral. For example, setting bits in a TIMx_PSC register to divide the clock by a chosen factor.
Click to reveal answer
beginner
If a timer input clock is 16 MHz and the prescaler is set to 7999, what is the timer counting frequency?
The timer frequency = 16 MHz / (7999 + 1) = 16 MHz / 8000 = 2000 Hz. The timer counts 2000 times per second.
Click to reveal answer
What does a timer prescaler do?
ADivides the input clock frequency to slow down the timer
BIncreases the timer counting speed
CChanges the main system clock frequency
DResets the timer counter
✗ Incorrect
A prescaler divides the input clock frequency, slowing down the timer counting speed.
Why is using a prescaler better than changing the main clock frequency?
AChanging main clock is easier
BPrescaler increases system speed
CPrescaler resets the timer
DPrescaler only affects the timer, keeping system stable
✗ Incorrect
Using a prescaler affects only the timer clock, so the rest of the system remains stable.
If the main clock is 8 MHz and prescaler is 7999, what is the timer frequency?
Hint: Check datasheet bits for prescaler values [OK]
Common Mistakes:
Setting multiple bits for prescaler 8
Confusing bit positions for prescaler values
Using wrong register for timer control
3. Given a microcontroller clock of 16 MHz and a timer prescaler set to 64, what is the timer tick frequency?
medium
A. 1,000,000 Hz
B. 250,000 Hz
C. 16,000,000 Hz
D. 64 Hz
Solution
Step 1: Calculate timer tick frequency
Timer tick frequency = CPU clock / prescaler = 16,000,000 / 64 = 250,000 Hz.
Step 2: Compare with options
250,000 Hz matches the calculated frequency exactly.
Final Answer:
250,000 Hz -> Option B
Quick Check:
16MHz/64 = 250kHz [OK]
Hint: Divide clock by prescaler for tick frequency [OK]
Common Mistakes:
Multiplying instead of dividing clock by prescaler
Using wrong prescaler value
Confusing frequency units
4. Identify the error in this code snippet setting a prescaler of 256 for Timer1:
TCCR1B = (1 << CS12) | (1 << CS10);
medium
A. CS12 bit is missing
B. No error, code is correct
C. TCCR1B register is incorrect for prescaler
D. CS10 should not be set for prescaler 256
Solution
Step 1: Check prescaler bits for 256 on Timer1
Prescaler 256 requires only CS12 bit set; CS10 must be cleared.
Step 2: Analyze given code
Code sets both CS12 and CS10 bits, which corresponds to prescaler 1024, not 256.
Final Answer:
CS10 should not be set for prescaler 256 -> Option D
Quick Check:
Prescaler 256 = only CS12 set [OK]
Hint: Only set bits matching prescaler exactly [OK]
Common Mistakes:
Setting extra bits causing wrong prescaler
Confusing prescaler bit combinations
Assuming code is correct without checking datasheet
5. You want to measure a 1-second delay using a 16-bit timer with a 16 MHz clock. Which prescaler value should you choose to make the timer count up to 1 second without overflow? (Timer max count = 65535)
hard
A. Prescaler 1024
B. Prescaler 64
C. Prescaler 128
D. Prescaler 8
Solution
Step 1: Calculate timer tick frequency for each prescaler
Tick frequency = 16,000,000 / prescaler. For 1024: 16,000,000 / 1024 ≈ 15,625 Hz.
Step 2: Calculate max timer duration
Max duration = max count / tick frequency = 65535 / 15,625 ≈ 4.19 seconds, which covers 1 second.
Step 3: Check smaller prescalers
Prescaler 128 gives 125,000 ticks per second, 64 gives 250,000, and 8 gives 2,000,000--all exceeding 65,535, causing overflow before 1 second.
Final Answer:
Prescaler 1024 -> Option A
Quick Check:
Prescaler 1024 allows 1s count without overflow [OK]
Hint: Choose prescaler so max count ≥ ticks in 1 second [OK]
Common Mistakes:
Ignoring timer max count limit
Choosing prescaler too small causing overflow
Not calculating ticks per second correctly
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.