Bài giảng Vi xử lý - Chương 5: Thiết kế hệ vi xử lý (Phần 2)

LCD is gaining popular and replacing LEDs

(7-segment ), due to

1. declining price

2. the ability to display numbers, characters,

and graphics

3. relieving the CPU task by incorporating a

refreshing controller

4. ease of programming for characters and

graphics (OLED is the coming display)

pdf42 trang | Chuyên mục: Vi Xử Lý – Vi Điều Khiển | Chia sẻ: tuando | Lượt xem: 474 | Lượt tải: 0download
Tóm tắt nội dung Bài giảng Vi xử lý - Chương 5: Thiết kế hệ vi xử lý (Phần 2), để xem tài liệu hoàn chỉnh bạn click vào nút "TẢI VỀ" ở trên
4/4/2011
1
1
Chương 5
Thiết kế hệ vi xử lý
2
5.6 Giao tiếp bộ hiển thị (Display)
5.6.2 Giao tiếp với LCD
4/4/2011
2
3
LCD controller
4
LCD Operation
LCD is gaining popular and replacing LEDs 
(7-segment ), due to
1. declining price
2. the ability to display numbers, characters, 
and graphics
3. relieving the CPU task by incorporating a 
refreshing controller
4. ease of programming for characters and 
graphics (OLED is the coming display)
4/4/2011
3
5
LCD Pin Descriptions
14-pin LCD module is discussed here, table 12-1 lists pin’s function, 
Fig 12-1 shows the pin positions for various LCDs
– Vcc, Vss provide +5V and ground
– Vee is used for contrast controlling
– RS (register select) is used to select the instruction command code 
register (RS = 0) or data register (RS = 1)
– LCD command codes is listed at table 12-2
– R/W (read/write) allows user to write to (R/W = 0) or read from 
(R/W = 1) information
– E (enable) latch information at data pins; when data is supplied to 
data pins, a high-to-low pulse must be applied to this pin
– D0-D7 are the 8-bit data pins; send information to LCD (R/W = 0) 
and read contents of LCD internal registers (R/W = 1)
– to display letters and numbers, ASCII codes are sent while RS = 1
6
4/4/2011
4
7
8
Pin diagrams
– RS = 0, the command code register is selected, we can send instruction
to LCD to perform clear, shift, blink 
– when RS = 0, and R/W = 1, D7 is busy flag, when D7 = 0, LCD is ready
to receive new information; it is recommended to check the busy flag
before writing any data to the LCD
4/4/2011
5
9
LCD Interfacing
• Liquid Crystal Displays (LCDs) have become a cheap and 
easy way to display text for an embedded system 
– Various configurations (1 line by 20 characters upto 8 
lines by 80 characters).
• LCD needs a driving circuit to work.
• Driving circuit and LCD are often integrated into a single 
chip Hitachi LM015 can display one line of 16 characters
• The display has one register into which commands are sent 
and one register into which data to be displayed are sent
• Two registers are differentiated by the RS input
• Data lines (DB7-DB0) are used to transfer both commands 
(clearing, cursor positioning, etc) and data (character to be 
displayed)
10
Alphanumeric LCD Interfacing
• Pinout
– 8 data pins D7:D0
– RS: Data or Command 
Register Select
– R/W: Read or Write
– E: Enable (Latch data)
• RS – Register Select
– RS = 0  Command Register
– RS = 1  Data Register
• R/W = 0  Write, R/W = 1  Read
• E – Enable
– Used to latch the data present on the data pins.
• D0 – D7
– Bi-directional data/command pins. 
– Alphanumeric characters are sent in ASCII format.
E
R/W
RS
DB7–DB0
LCD 
controller
communications 
bus
Microcontroller
8
LCD Module
4/4/2011
6
11
LCD Commands
• The LCD’s internal controller can accept several 
commands and modify the display accordingly. 
These commands would be things like:
– Clear screen
– Return home
– Decrement/Increment cursor
• After writing to the LCD, it takes some time for it 
to complete its internal operations. During this 
time, it will not accept any new commands or 
data.
– We need to insert time delay between any two 
commands or data sent to LCD
12
Interfacing LCD with 8051
LM015
8051
P1.7-P1.0 D7-D0
RW
RS
E
P3.4
P3.5
P3.3
4/4/2011
7
13
Interfacing LCD with 8051
In main program:
. . .
MOV A, COMMAND
CALL CMD
CALL DELAY
MOV A, ANOTHER_CMD
CALL CMD
CALL DELAY
MOV A, #’A’
CALL DATA
CALL DELAY
MOV A, #’B’
CALL DATA
CALL DELAY .
Command and Data Write Routines
DATA: MOV P1, A ; A is ascii data
SETB P3.3 ; RS=1 data
CLR P3.4 ; RW=0 for write
SETB P3.5 ; H->L pulse on E
CLR P3.5
RET
CMD: MOV P1, A ; A has the cmd word
CLR P3.3 ; RS=0 for cmd
CLR P3.4 ; RW=0 for write
SETB P3.5 ; H->L pulse on E
CLR P3.5
RET
14
4/4/2011
8
15
16
4/4/2011
9
17
18
LCD
4/4/2011
10
19
LCD Timing
20
4/4/2011
11
21
22
Stepper Motors
• more accurately controlled than a normal motor 
allowing fractional turns or n revolutions to be 
easily done
• low speed, and lower torque than a comparable 
D.C. motor
• useful for precise positioning for robotics
• Servomotors require a position feedback signal 
for control
4/4/2011
12
23
Stepper Motor Diagram
24
Stepper Motor Step Angles
4/4/2011
13
25
Terminology
• Steps per second, RPM
– SPS = (RPM * SPR) /60
• Number of teeth
• 4-step, wave drive 4-step, 8-step
• Motor speed (SPS)
• Holding torque
26
Stepper Motor Types
– Variable Reluctance
– Permanent Magnet
4/4/2011
14
27
Variable Reluctance Motors
28
Variable Reluctance Motors
• This is usually a four wire motor – the 
common wire goes to the +ve supply and 
the windings are stepped through
• Our example is a 30o motor
• The rotor has 4 poles and the stator has 6 
poles
• Example
4/4/2011
15
29
Variable Reluctance Motors
• To rotate we excite the 3 windings in 
sequence
– W1 - 1001001001001001001001001 
– W2 - 0100100100100100100100100 
– W3 - 0010010010010010010010010
• This gives two full revolutions
30
Unipolar Motors
4/4/2011
16
31
Unipolar Motors
• To rotate we excite the 2 windings in 
sequence
– W1a - 1000100010001000100010001 
– W1b - 0010001000100010001000100 
– W2a - 0100010001000100010001000
– W2b - 0001000100010001000100010 
• This gives two full revolutions
32
Basic Actuation Wave Forms
4/4/2011
17
33
Unipolar Motors
• To rotate we excite the 2 windings in 
sequence
– W1a - 1100110011001100110011001 
– W1b - 0011001100110011001100110 
– W2a - 0110011001100110011001100 
– W2b - 1001100110011001100110011 
• This gives two full revolutions at 1.4 times 
greater torque but twice the power
34
Enhanced Waveforms
• better torque
• more precise control
4/4/2011
18
35
Unipolar Motors
• The two sequences are not the same, so 
by combining the two you can produce half 
stepping
– W1a - 11000001110000011100000111 
– W1b - 00011100000111000001110000 
– W2a - 01110000011100000111000001 
– W2b - 00000111000001110000011100 
36
Motor Control Circuits
• For low current options the ULN200x 
family of Darlington Arrays will drive the 
windings direct.
4/4/2011
19
37
Interfacing to Stepper Motors
38
Example (với 80x86)
4/4/2011
20
39
Giao tiếp với DAC
40
4/4/2011
21
41
42
4/4/2011
22
43
44
4/4/2011
23
45
46
4/4/2011
24
47
48
Digital to Analog Converter
4/4/2011
25
49
Example – Step Ramp
50
Giao tiếp với ADC
4/4/2011
26
51
52
4/4/2011
27
53
54
4/4/2011
28
55
56
4/4/2011
29
57
58
4/4/2011
30
59
60
4/4/2011
31
61
62
Analog to Digital
4/4/2011
32
63
Vin Range
64
Timing Diagram for ADC transaction
4/4/2011
33
65
CLK IN and CLK R
66
External clocking scheme for ADC0804
4/4/2011
34
67
Assembly for ADC0804
68
Interfacing ADC
4/4/2011
35
69
Example (với 80x86)
70
8051 giao tiếp với ADC
4/4/2011
36
71
Temperature Sensor
72
ADC0808/0809: multi-(analog)-channel
4/4/2011
37
73
Pin interface on ADC0808/0809
74
Timing Diagram for the ADC0809
4/4/2011
38
75
Schematic for 8051 connected to ADC0809
up to 8 inputs selects input
76
Reference voltages
4/4/2011
39
77
Single-ended vs
Differential Pair input
78
Digital vs Analog Ground
4/4/2011
40
79
Assembly for ADC0809
80
Assembly for ADC0809 (2/2)
4/4/2011
41
81
Printer Connection
82
IO Base Address for LPT
4/4/2011
42
83
Printer’s Ports
84
Useful Links
• 
• 
• 
• 
rs.php

File đính kèm:

  • pdfbai_giang_vi_xu_ly_chuong_5_thiet_ke_he_vi_xu_ly_phan_2.pdf
Tài liệu liên quan