Bài giảng Kỹ thuậtVi xử lý
Ngành Điện tử-Viễn thông
Đại học Bách khoa ĐàNẵng
của Hồ Viết Việt, Khoa ĐTVT
Tài liệu tham khảo
[1] Kỹ thuật vi xử lý, Văn Thế Minh, NXB Giáo dục, 1997
[2] Kỹ thuật vi xử lý và Lập trình Assembly cho hệ vi xử
lý, Đỗ Xuân Tiến, NXB Khoa học & kỹ thuật, 2001
Chương 6
Các kiểuI/O
6.1 Thăm dò (Polling)
6.2 I/O điều khiển bằng ngắt (Interrupt)
-
6.3 DMA (Direct Memory Access)
Thăm dò
mov dx, F000
L1: in al, dx
cmp al, FF
je L1
:
:
A
1
5
8088
Minimum
Mode
A18
A0
:
D7
4
A
1
3
A
1
2
A
1
1
A
1
0
A
9
A
8
A
7
A
6
A
5
A
4
A
3
A
2
A
1
3
A
1
2
A
1
1
A
1
0
A
9
A
8
A
7
A
6
A
5
A
4
A
3
A
2
A
1
A
A
1
2
A
1
1
A
1
0
A
9
A
8
A
7
A
6
A
5
A
4
A
3
A
2
A
1
A
0
IOW
mov cx, FFFF
L2: dec cx
jnz L2
cmp ah, 00
jne L3
rol al, 1
cmp al, 01
jne L1
jmp L4
L3: ror al, 1
cmp al, 80
jne L1
L4: mov bl, al
in al, dx
cmp al, FF
je L6
test al, 01
jnz L5
xor ah, FF
jmp L6
L5: test al, 80
jz L7
L6: mov al, bl
jmp L1
L7:
What’s the problem with polling
in the sample program?
• Running LED takes time
• User might remove his/her finger from the
switch
jz L7
L6: mov al, bl
jmp L1
L7:
Interrupt
• The microprocessor does not check if data
is available.
• The peripheral will interrupt the processor
when data is available
Polling vs. Interrupt
While studying, I’ll
check the bucket every 5
minutes to see if it is
already full so that I can
transfer the content of
the bucket to the drum.
Input
Device
Memory
μP
instruction
POLLING
Polling vs. Interrupt
I’ll just study. When the
speaker starts playing
music it means that the
bucket is full. I can then
transfer the content of
the bucket to the drum.
Input