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
What is “feed the dog”?
Must reset timer every x time units (feed the dog), else WDT generates interrupt which resets program or jumps to save part
Code to feed the dog must be
• small and amount of system resources used, especially CP U cycles, must
be reasonable
• carefully integrated into software
Most common usage of WDT?
Common usage is to detect:
• infinite loops
• deadlocks (if some lower priority tasks are not getting to run because higher priority tasks are hogging the CPU)
• general failures (e.g. in firmware) and timeouts
Difference between the terms UART and RS -232
UART is peripheral on microcontroller which can send and receive serial
data asynchronously
• RS-232 is a signaling standard which mandates the logic levels and
control signals
• While AVR’s normal logic levels are about 3-5V, RS-232 communication
uses a low of +3V to +25V for a digital ’0’, and -3V to -25V for a digital ’1
What are Standards for voltage signaling?
RS-232, RS-422 and RS-485
Name the three minmal required wires for RS - 232.
when are only these used?
- transmit data (TX)
- receive data (RX)
- ground (GND)
Used when full facilities of RS-232 are not required
When can a 2-wire connection be used? What are the wires?
2-wire connection (data and ground) can be used if data flow is one way (half duplex)
What is a Asynchronous interface?
Transmitter and receiver clocks are independent, and a resynchronization is performed for each byte at the start bit
Typical usage:
Connect a PC for debugging
What is a Synchronous interface?
Include separate clock signal line
• Simplifies transmitter & receiver, but is more susceptible to noise when used over long distances
• Examples:
Serial peripheral interface (SP I) and I²C
• Typical usage:
connect external EEPROM
Explain UART and name one advantage?
UART: Universal Asynchronous Receiver
Transmitter
• Takes parallel data and transmits serially
• Receives serial data and converts to parallel
Adv:
• More cost effective than parallel transmission