Standard Single Purpose Processors: Peripherals Flashcards
What can a Timer on a Microprocessor be used for?
Mesure time intervals, to generate timed output or to mesure input events.
Hoe do you calculate the CLK resolution?
Clk resolution = 1/Clk freq
What is the Clk range?
Clk range = time until overflow
What is TOP?
-indicates top count reached, wrap-around
- is connect to pin of processor or directly mapped to
interrupt flag
Draw a Basic timer!
See Chapter 5 Slide 4
Draw a basic Timer/Counter, or explain the difference to a basic timer
See Chapter 5 Slide 5
Counter: like a timer, but counts
pulses on a general input signal
rather than clock
Clk/Cnt Mode, TCNT, Reset, Top
What is a Timer with Terminal Count
▪ Timer indicates when desired time interval has passed (up- or down-counter) ▪ Up-counter: Set terminal count to desired interval but setting the value to which to count to
Explain a Cascaded counter
Multiple counters connected in a row
2x 16 bit Can be configured for 32 bits
Frist counter reaches top, 2. counter is incremented by 1
What is a Prescaler, what is the purpose?
• Divides clock • Prescaler output signal has reduced frequency (1/2, 1/4, …, determined by mode) • Increases range, decreases resolution
What is a Real-Time Clock (RTC)? What is the purpose?
▪ RTC: Clock keeping track of current time in human units
RTCs often
• have an alternate source of power (lithium battery, supercapacitor)
• use crystal oscillator with frequency 32768 Hz, i.e. resolution 30.52 µs
(overflow of 15 Bit counter after 1 second)
Purpose:
• Low power consumption (important when running from batteries)
• Frees main system for time-critical tasks
Explain Conventional Counters!
Count number of input cycle trigger events per second (called gate time)
Gate time not synchronized with input signal
• uncertainty of measurement is ±1 input
• cycle count, i.e. resolution is 1 Hz with
a 1 s gate time for all input signal frequencies
–> Counts for a fixed time persiode the numbers of signals
How do you Increase resolution for a Conventional Counters!?
Increase resolution with longer gate-times
• Gate time of 10 s increases resolution tenfold, adds one digit to read-out
• Resolution increases with frequency
–>Conventional counters
are bad for low-medium
frequencies and adequate
for high frequencies only
Explain Reciprocal Counting!
Input signal trigger controls start of gate-time
▪ Two counting registers: one counts number of input cycles and other counts the clock pulses
–> counts X numbers of signals and mesures time with clock
What is the advantage of Reciprocal Counting?
Resolution is independent of frequency
The ±1 input cycle error is avoided. Truncation errors are now in the time count; i.e. ±1 clock pulse
What is a Watchdog Timer (WDT)
Computer hard- or software timer that
triggers a system reset or other corrective action
if main program hangs (due to fault condition)
▪ WDTs are last line of defense against product failure
• If all else fails then let watchdog reset system