19-03-2011, 09:26 AM
[attachment=10533]
Standard Single Purpose Processors: Peripherals
Introduction
• Single-purpose processors
– Performs specific computation task
– Custom single-purpose processors
• Designed by us for a unique task
– Standard single-purpose processors
• “Off-the-shelf” -- pre-designed for a common task
• a.k.a., peripherals
• serial transmission
• analog/digital conversions
Timers, counters, watchdog timers
• Timer: measures time intervals
– To generate timed output events
• e.g., hold traffic light green for 10 s
– To measure input events
• e.g., measure a car’s speed
• Based on counting clock pulses
• E.g., let Clk period be 10 ns
• And we count 20,000 Clk pulses
• Then 200 microseconds have passed
• 16-bit counter would count up to 65,535*10 ns = 655.35 microsec., resolution = 10 ns
• Top: indicates top count reached, wrap-around
Counters
• Counter: like a timer, but counts pulses on a general input signal rather than clock
– e.g., count cars passing over a sensor
– Can often configure device as either a timer or counter
Other timer structures
• Interval timer
– Indicates when desired time interval has passed
– We set terminal count to desired interval
• Number of clock cycles = Desired time interval / Clock period
• Cascaded counters
• Prescaler
– Divides clock
– Increases range, decreases resolution
Example: Reaction Timer
• Measure time between turning light on and user pushing button
– 16-bit timer, clk period is 83.33 ns, counter increments every 6 cycles
– Resolution = 6*83.33=0.5 microsec.
– Range = 65535*0.5 microseconds = 32.77 milliseconds
– Want program to count millisec., so initialize counter to 65535 – 1000/0.5 = 63535
Watchdog timer
• Must reset timer every X time unit, else timer generates a signal
• Common use: detect failure, self-reset
• Another use: timeouts
– e.g., ATM machine
– 16-bit timer, 2 microsec. resolution
– timereg value = 2*(216-1)–X = 131070–X
For 2 min., X = 120,000 microsec
Serial Transmission Using UARTs
• UART: Universal Asynchronous Receiver Transmitter
– Takes parallel data and transmits serially
– Receives serial data and converts to parallel
• Parity: extra bit for simple error checking
• Start bit, stop bit
• Baud rate
– signal changes per second
– bit rate usually higher
Pulse width modulator
• Generates pulses with specific high/low times
• Duty cycle: % time high
– Square wave: 50% duty cycle
• Common use: control average voltage to electric device
– Simpler than DC-DC converter or digital-analog converter
– DC motor speed, dimmer lights
• Another use: encode commands, receiver uses timer to decode