Академический Документы
Профессиональный Документы
Культура Документы
(Fall 2011)
Lecture 15
Osman Hasan
LCD Controller
Very commonly used in embedded systems (watches, fax and copy machines, calculators etc.)
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
LCD Principle
Reflective LCD
Incoming light passes through a polarizing plate The polarized light encounters liquid crystal material If a region is excited, it allows the light to pass Light that has passed through hits a mirror and reflects back
The excited region appears to light up
Absorption LCD
Uses a black surface instead of a mirror The surface below the excited region appears darker than others
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
LCD Types
7-Segment LCD
Each one of the seven segments can be activated
7 inputs Or 4 inputs to represent numbers 0 through 9
The LCD driver converts these inputs to the electrical signals necessary to excite the appropriate LCD segments
Dot-matrix LCD
Matrix of dots that can display alphanumeric characters as well as other symbols 5 columns and 8 rows for one character Again LCD driver is used to excite the appropriate LCD dots
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
LCD controller
Provides interface from the Micrcontroller to the LCD
Control Words
Initialize the LCD Clear the Display Select the position of the cursor Brighten the Display
Data Words
ASCII character to be displayed at the current location
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
LCD Controller
E R/W RS DB7 DB0 LCD controller communications bus
microcontroller
RS: low for control words, high for data words E bit is toggled whenever data or control words are sent
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
Clears all display, return cursor home Returns cursor home Sets cursor move direction and/or specifies not to shift display ON/OFF of all display(D), cursor ON/OFF (C), and blink position (B) Move cursor and shifts display Sets interface data length, number of display lines, and character font Writes Data
7
S/C
R/L
DL
WRITE DATA
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
LCD Controller
CODES I/D = 1 cursor moves left I/D = 0 cursor moves right S = 1 with display shift S/C =1 display shift S/C = 0 cursor movement R/L = 1 shift to right R/L = 0 shift to left DL = 1 8-bit DL = 0 4-bit N = 1 2 rows N = 0 1 row F = 1 5x10 dots F = 0 5x7 dots
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
Keypad
Set of buttons that may be pressed to provide input to an embedded system Very commonly used
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
Keypad controller
N1 N2 N3 N4 M1 M2 M3 M4 key_code
k_pressed
4 key_code
keypad controller
N=4, M=4
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
10
Keypad controller
Software that scans the column and row outputs When a button is pressed the controller stores its code into a register key_code It sets an output k_pressed high indicating that a button has been pressed The software polls this output every 100 ms or so and reads the register when it is high
Other option instead of polling?
Using an interrupt
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
11
12
Usage
Blink a light at a specific rate Control Average current/voltage to a device
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
13
Using a PWM
DC motor does not come to an immediate stop when its input voltage is lowered to 0, but rather coasts Thus we set the average voltage to obtain the desired speed using the duty cycle of a PWM The period is set small enough for smooth operation of the motor
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
14
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
15
pwm_o clk
75% duty cycle average pwm_o is 3.75V.
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
16
17
Assignment
Chapter 1: Transaction Level Modeling And Brief Overview: pages 1-22 Book: Transaction-level modeling with SystemC: TLM concepts and applications for Embedded Systems, By Frank Ghenassia Available at Google Books Summarize the chapter in your 10-15 minute presentation.
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
18
clk
counter ( 0 254) 8-bit comparator cycle_high pwm_o counter < cycle_high, pwm_o = 1 counter >= cycle_high, pwm_o = 0
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
19
Comparator compares the values of the counter and the cycle_high register
cycle_high Determines the duty cycle of the PWM
If cycle_high = FF H then duty_cycle = 100% If cycle_high = 00 H then the output is always low duty_cycle = 0%
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
20
clk
Activity: Find the values of cycle high for the above 4 values
pwm_o counter < cycle_high, pwm_o = 1 counter >= cycle_high, pwm_o = 0
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
21
22
5V
From processor
DC MOTOR
A B
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
23
24
25
26
27
Even Parity
Exactly opposite
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
28
Sampling on the rx pin starts at predetermined intervals shifting each sampled bit into the receive shift register
If configured to do so, the receiver also samples the parity bit Once data is received the UART signals its host processor to read the byte
0 1
1 0 1
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
29
Transmission Protocol
Two serially connected UARTs must agree on a Transmission start bit end bit protocol data
The number of bits of data Parity Minimum number of bits used to separate two consecutive data transmissions
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.
Baud Rate
Determines the speed at which data is exchanged between two UARTs Common baud rates
2400, 4800, 9600 and 19.2K
Original source: Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis Modified by: Osman Hasan, Assist. Prof., SEECS, NUST, Islamabad, Pakistan.