Title: Done by:
1Standard single-purpose processors
- Done by
- Muna Rasha
-
- Supervised by
- Dr. Loai tawalbeh
2Outline
3Introduction
Processors
General- purpose
Single-purpose
Custom
Standard
4Cont
General- purpose
Many computational tasks , large variety of
applications
Single-purpose
Specific computational task
Standard
Specific computational task ,wide variety of
applications
Custom
Specific computational task , particular
application
5Standard single-purpose processors
- Known as Peripherals . (exist on the periphery of
the CPU) - Off-the shelf ? pre-designed for a common
task. - Embedded system designers use standard
single-processor rather than general-purpose
processor to achieve the following benefits - Fast performance
- Fewer clock cycles .
- Shorter cycles .
- Small size
- No program memory .
- Small instruction set
- Simple datapath and controller .
- Low unit cost
6Tradeoffs !!!!
- If we are already using a general-purpose
processor, then implementing a task on an
additional single-purpose processor rather than
in software may add to the system size and power
consumption.
7Timer
- A device that generates a signal pulse at
specified time intervals . - Mainly consist of a register, counter, and an
extremely simple controller. - Example how many clock cycles needed to obtain a
duration of 3 µs from a clock cycle of 100 MHz ? - (3x10-6 / 10x10-9 ) 300 cycles
Number of clock cycles Desired real-time value
/ Clock cycle
8How timer works?
- The register holds a count value (number of clock
cycles). - The counter is initially loaded with the count
value. - It counts down on every clock cycle .
- When zero is reached an output signal is
generated . - The count value is reloaded, and the process
repeats itself. - Note When timer is used in conjunction with a
general-purpose processor, it is assigned it to
an interrupt.
9Cont
- It is better to assign timer functionality to a
special-purpose processor rather than software
implementation, Why?!!
Because the timer functionality occupies much of
the programs run time, leaving little time for
other computations.
10Counter
- Works like timer .
- Count pulses rather clock cycles .
- Example count cars passing over a sensor
11Applications
- Reaction timer
- Time between turning light on and user pushing
button ?! - 16-bit timer, clk period 83.33 ns, counter
increments every 6 cycles. - Resolution 683.330.5 microsec.
- Range 655350.5 microseconds 32.77
milliseconds - Want program to count millisec., so counter will
be 65535 1000/0.5 63535
- Cascaded counters are used to implement real-time
clocks.
Top2
12Watchdog timer
- Inverse functionality of a regular timer.
Regular Timer
Generate a signal for us every X time units
Watchdog Timer
Generate a signal for the timer every X time units
13Cont
- Often connect this signal to the reset or
interrupt . - a mechanism of ensuring that our software is
working properly . - Failure indicating signal can be used to restart
or test parts of the system. - Example ATM machines .
Watchdog Timer
Failure
14UART
- Universal Asynchronous Receiver/Transmitter
- Send and receive serially but store in parallel.
- Used through long distances, or when have few
available I/O pins. - To reduce the expense of long communication links
carrying several bits in parallel, data bits are
sent sequentially. - Start-bit, stop-bit, parity-bit.
- baud rate indicates how fast data is moving (max
no. of symbols transferred per second). So what
is Bit-rate ?! - Common rates include 2400, 4800, 9600, and 19.2k.
Transmitter
Receiver
101101
101101
1 0 0 1 0 1 0 0 0 0 1 1 0 1 1
Baudrate (2s mod / 32) oscfreq / (12 (256 -
TH1)))
15Cont
- Communication may be full duplex or half
duplex . - UARTs are commonly used with RS-232 for embedded
systems communications. It is useful to
communicate between microcontrollers and also
with PCs. - The stop bit(1-2 bit) is the data-line's idle
state, and provides a delay before the next
character can start. (asynchronous start-stop
transmission). - Parity (odd or even)
- Odd parity is more reliable because it assures
that there will always be at least one data
transition .
16UART Components
- A UART mainly contains the following components
- Clock generator.
- Input and output shift registers
- Transmit/receive control
- Read/write control logic
17Special Receiver Conditions
- Overrun Error
- Occurs when the UART cannot process the byte that
just came in before the next one arrives. - Various UART devices have differing amounts of
buffer space to hold received characters. The CPU
must service the UART in order to remove
characters from the buffer. If the CPU does not
service the UART and the buffer becomes full,
Overrun Error will occur. - Framing Error
- Occurs when the designated "start" and "stop"
bits are not valid. - As the "start" bit is used to identify the
beginning of an incoming character, it acts as a
reference for the remaining bits. If the data
line is not in the expected idle state when the
"stop" bit is expected, a Framing Error will
occur.
18Cont
- Parity Error
- Occurs when the number of "active" bits does not
agree with the specified parity configuration of
the UART - Break Condition
- Occurs when the receiver input is in at the
"break" level for longer than some duration of
time. This is not necessarily an error, but
appears to the receiver as a zero byte with a
framing error. - long "break" signal can be a useful way to get
the attention of a mismatched receiver to do
something (such as resetting itself to some
predefined Baud).
19USART, DUART
- USART Universal Synchronous Asynchronous
Receiver Transmitter - Uses a clock and data line .
- No separate clock signal as in Asynchronous
transmission . - No start/stop bits .
- An asynchronous transmission sends nothing over
the interconnection when the transmitting device
has nothing to send but a synchronous interface
must send "pad" characters to maintain
synchronism between the receiver and transmitter
. - DUART Dual UART
- combines two UARTs into a single chip .
- Ex UART USART .
20Pulse Width Modulator
- PWM generates an output signal that repeatedly
switches between high and low.
- Duty cycle the percentage of time the signal
is high compared to the signals period .
- PWM resolution the maximum number of pulses
that you can pack into a PWM period .
- PWM period an arbitrarily time period in which
PWM takes place. It is chosen to give best
results for your particular use .
21Cont
22PWM applications
- Control the average current or voltage input to a
device . - Ex when you have a system powered by a 5 Volt
power supply, so if you filter a signal that has
a 50 duty cycle you get an average voltage of
2.5 Volts. - LPF charges while the PWM signal is ON and
discharges while the PWM signal is OFF
generating an analog output. - PWM works as DAC in cases there in no high
resolution, speed, and cost (simple and
cost-effective approach) .
23Cont
- Dimmer lights
- To control the brightness of the LED you have to
control the amount of current going through the
device. - Quickly turn the LED on and off cause Blinking,
that is undesired . - Rather than changing the number of times the
output goes on and off, we change how long the
output stays on and off. - The total current that flows through the LED is
low.
- Assume active low then,
- Output is 0 most of the time and the LED will
be ON most of the time. - Output is Vcc most of the time which turns off
the LED.
24Cont
- DC motor controlling
- DC motor can be controlled by a variable
resistor, this generate heat and hence waste
power . - This problem is eliminated by PWM .
- Speed Is controlled by changing the pulses width
. - The longer the pulses, the faster the motor turns
. - Cost effective
- Encoding control commands in a single signal for
use by another device - Controlling RF car .
- For example a (1 ms) width corresponds to a turn
left command, a (4 ms) width to turn right, and
(8 ms) to forward .
25LCD controller
- LCD (Liquid Crystal Display)
- low-cost .
- low-power device .
- capable of displaying text and images .
- LCD types
- 7-segment LCD.
- dot-matrix LCD.
- LCDs are extremely common in embedded systems.
- LCD Controller is a simple interface between a
processor and LCD. - This interface is parallel bus, allowing simple
and fast read/write.
E (Enable) clock is used to initiate the data
transfer within LCD. R/S (Set/Reset) to select
whether the data is being transferred between
the processor and the LCD.
26LCD controller instructions
- The different instructions available for use LCD
controller are shown in the table below.
27(No Transcript)
28Keypad controller
- A Keypad consist of a set of buttons that may be
pressed to provide input to an embedded system. - A simple keypad has buttons arranged in an
N-column by M-row. - When we press a button, one column output and one
row output go high. - To read such a keypad from software, we must scan
the column and row outputs.
29Cont
- The scanning may instead be performed by a Keypad
controller. - When the controller detects a button press, it
stores a code corresponding to that button into a
register and sets an output high, indicating that
button has been pressed. - Software may poll the output every 100 ms read
the register when the output is high . - Instead of using polling the output can generate
an interrupt to the general-purpose processor.
30Stepper motor controller
- A stepper motor is an electric motor rotates a
fixed number of degrees whenever we apply a
step signal. - In contrast, a regular electric motor rotates
continuously whenever power is applied, coasting
to a stop when power is removed. - Stepper motors obviously abound in embedded
systems with moving parts, such as disk drivers,
printers, photocopy and fax machines. - A stepper motor has four coils. To rotate the
motor one step, we pass current through one or
two of the coils. - Stepper motor comes with four inputs
corresponding to the four coils. - Rotation achieved by applying specific voltage
sequence to coils - Controller greatly simplifies this.
31Cont
- Number of steps ? 140 move .
32Stepper motor controller
-
- stepper motor
stepper motor controller
33Cont
-
- stepper motor with controller
without controller - The output pins on the stepper motor controller
dont provide enough current to drive the stepper
motor. To amplify the current a buffer is needed.
34Analog-Digital converters
- An analog-to-digital converter converts an analog
signal to a digital signal, and a
digital-to-analog converter does the opposite. - Such conversion are necessary because, while
embedded systems deal with digital values, an
embedded systems surroundings typically involve
many analog signals. - We can compute the digital values from the
analog, and vice-versa, using the following
ratio -
-
-
e/Vmax d/(2n-1)
35Cont
36DAC using successive approximation
- Given an analog input signal whose voltage should
range from 0 to 15 volts, and an 8-bit digital
encoding, calculate the correct encoding for 5
volts. Then trace the successive-approximation
approach to find the correct encoding. - 5/15 d/(256-1) gt d85.
-
-
½(5.63 4.69) 5.16 volts Vmax 5.16 volts.
½(Vmax Vmin) 7.5 volts Vmax 7.5 volts.
½(7.5 0) 3.75 volts Vmin 3.75 volts.
½(5.16 4.69) 4.93 volts Vmin 4.93 volts.
½(7.5 3.75) 5.63 volts Vmax 5.63 volts
½(5.16 4.93) 5.05 volts Vmax 5.05 volts.
½(5.63 3.75) 4.69 volts Vmin 4.69 volts.
½(5.05 4.93) 4.99 volts
Successive-approximation method
37Real-time clocks
- A real time clock (RTC) keeps the time and date
in an embedded system. - Real-time clocks are typically composed of
- Crystal-controlled oscillator .
- Numerous cascaded counters .
- Battery backup.
- RTCs are present in almost any electronic device
needs to keep accurate time. - The crystal-controlled oscillator generates a
very consistent high-frequency digital pulses
that feed the cascaded counters. - - the first counter counts these pulses up
to the oscillator freq., which corresponds to
exactly one second. - - at this point, it generate a pulse that
feeds the next counter. - The rechargeable back-up battery is used to keep
the RTC running while system is powered off. - Communication between the microcontroller and a
RTC is accomplished through a serial bus .
38References