Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 33 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
33
Dung lượng
301,41 KB
Nội dung
Bài giảngKỹ 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ậtvixử lý, Văn Thế Minh, NXB Giáo dục, 1997
[2] Kỹ thuậtvixử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 5
Thiết kế các cổng I/O
5.1 I/O được phân vùng nhớ và I/O tách biệt
- I/O được phân vùng nhớ (Memory Mapped I/O)
- I/O tách biệt (Isolated I/O)
5.2 Các chip MSI dùng làm cổng I/O
-Cổng ra
-Cổng vào
5.3 Chip 8255
- Sơ đồ chân, Sơ đồ khối chức năng
- Các mode hoạt động
-Giải mã địa chỉ
-Lập trình cho 8255
5.1 Cần phân biệt2kiểu thiết kế
•I/O được phân vùng nhớ (Memory mapped I/O):
-1cổng được xem như mộtônhớ
-1cổng có địa chỉ 20-bit
- được truy cập khi IO/M = 0
- không cần mạch giải mã địa chỉ riêng
• I/O tách biệt (isolated I/O)
-1cổng được xem đúng là 1 cổng
- 1cổng có địa chỉ 16-bit, 12-bit, 8-bit
- được truy cập khi IO/M = 1
-cần mạch giải mã địa chỉ I/O riêng
5.2 Các chip MSI thường dùng làm cổng I/O
• 74LS373
• 74LS374
• 74LS244
• 74LS245
• Khi số lượng cổng ít và cố định
• Cách mắc mạch sẽ quyết định cho chip là
cổng ra hay cổng vào và địa chỉ của nó
Sử dụng 74LS245 làm cổng ra
:
mov al, 55
mov dx, F000
out dx, al
:
8088
Minimum
Mode
A18
A0
:
D7
D6
IOR
IOW
A19
D5
D4
D3
D2
D1
D0
74LS245
B0
B1
B2
B3
B4
B5
B6
B7
A0
A1
A2
A3
A4
A5
A6
A7
EDIR5V
A
1
5
A
1
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
A
0
IOW
Sử dụng 74LS373 làm cổng ra
:
mov al, 55
mov dx, F000
out dx, al
:
A
1
5
8088
Minimum
Mode
A18
A0
:
D7
D6
IOR
IOW
A19
D5
D4
D3
D2
D1
D0
A
1
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
A
0
IOW
74LS373
Q0
Q1
Q2
Q3
Q4
Q5
Q6
Q7
D0
D1
D2
D3
D4
D5
D6
D7
OELE
Sử dụng 74LS245 làm cổng vào
:
mov dx, F000
in al, dx
:
A
1
5
8088
Minimum
Mode
A18
A0
:
D7
D6
IOR
IOW
A19
D5
D4
D3
D2
D1
D0
A
1
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
A
0
IOR
5V
74LS245
B0
B1
B2
B3
B4
B5
B6
B7
A0
A1
A2
A3
A4
A5
A6
A7
EDIR
Cổng ra
Cổng vào
5.3 Chip LSI thường dùng làm cổng I/O
• PPI 8255
• Khi số lượng cổng I/O nhiều và không cố
định
• Cách mắc mạch sẽ quyết định địa chỉ cho
các cổng còn vai trò của cổng sẽ được
quyết định bởi phần mềm
[...]...8 255 PPI Sơ đồ khối chức năng của 8 255 Các mode làm vi c • Mode 0 - PA, PB, PCH (CU) và PCL (CL) - Có thể là Input hoặc Output - Vi c Nhập hoặc Xuất dữ liệu là độc lập • Mode 1 - PA, PB - Có thể là Input hoặc Output - Vi c Nhập hoặc Xuất dữ liệu là phụ thuộc vào một số bít của PC (các tín hiệu handshaking) • Mode 2 - PA - PA vừa là Input vừa là Output - Vi c Nhập/Xuất dữ liệu với PA là... handshaking) Nhóm làm vi c • Nhóm A: PA và PCH • Nhóm B: PB và PCL • Định cấu hình làm vi c cho 1 chip 8 255 : Gửi 1 Từ điều khiển định cấu hình đến thanh ghi điều khiển của chip đó • Lập/xoá một bit của PC: Gửi 1 Từ điều khiển Lập/Xoá bit đến thanh ghi điều khiển của chip đó Từ điều khiển định cấu hình làm vi c cho một chip 8 255 Từ điều khiển lập/xoá bit cho một chip 8 255 The 8 255 Programmable Peripheral... printer • 8 255 in mode 1 is equipped with resources to handle handshaking signals Mode 1 Strobed Output Signals • OBFa (output buffer full for port A) – indicates that the CPU has written a byte of data into port A – must be connected to the STROBE of the receiving equipment • ACKa (acknowledge for port A) – through ACK, 8 255 knows that data at port A has been picked up by the receiving device – 8 255 then... makes INTR low – The RD signal from the CPU is of limited duration and when it goes high the 8 255 in turn makes IBF inactive by setting it low – IBF in this way lets the peripheral know that the byte of data was latched by the 8 255 and read into the CPU as well Lập trình cho 8 255 Lời giải Lập trình cho 8 255 B A Lời giải Tạo chuỗi xung bằng phần mềm ... Control Register Giải mã địa chỉ cho 8 255 Mode 0 - Simple input/output • Simple I/O mode: any of the ports A, B, CL, and CU can be programmed as input or output • Example: Configure port A as input, B as output, and all the bits of port C as output assuming a base address of 50 h • Control word should be 1001 0000b = 90h MOV AL, 90h OUT 53 h,AL IN AL, 50 h OUT 51 h, AL OUT 52 h, AL Mode 1: I/O with Handshaking... when the CPU writes a byte to port A Mode 1 Input Ports with Handshaking Signals • STB – When an external peripheral device provides a byte of data to an input port, it informs the 8 255 through the STB pin STB is of limited duration • IBF (Input Buffer Full) – In response to STB, the 8 255 latches into its internal register the data present at PA0-PA7 or PB0-PB7 – Through IBF it indicates that it has latched... 8 255 The 8 255 Programmable Peripheral Interface • Intel has developed several peripheral controller chips designed to support the 80x86 processor family The intent is to provide a complete I/O interface in one chip • 8 255 PPI provides three 8 bit input ports in one 40 pin package making it more economical than 74LS373 and 74LS244 • The chip interfaces directly to the data bus of the processor, allowing... intelligent devices • Example Process of communicating with a printer – a byte of data is presented to the data bus of the printer – the printer is informed of the presence of a byte of data to be printed by activating its strobe signal – whenever the printer receives the data it informs the sender by activating an output signal called ACK – the ACK signal initiates the process of providing another... programmed; that is in one application a port may appear as an output, but in another, by reprogramming it as an input This is in contrast with the 74LS373 and 74LS244 which are hard wired and fixed 8 255 Pins • PA0 - PA7: input, output, or bidirectional port • PB0 - PB7: input or output • PC0 - PC7: This 8 bit port can be all input or output It can also be split into two parts, CU (PC4 - PC7) and CL . 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ý, . 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 5
Thiết kế các cổng I/O
5. 1 I/O