Bài giảng Kỹ thuật Vi xử lý - Chương 5: Thiết kế các cổng I/O - Hồ Viết Việt

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 825 
pdf 33 trang thamphan 27/12/2022 1420
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Kỹ thuật Vi xử lý - Chương 5: Thiết kế các cổng I/O - Hồ Viết Việt", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.

File đính kèm:

  • pdfbai_giang_ky_thuat_vi_xu_ly_chuong_5_thiet_ke_cac_cong_io_ho.pdf

Nội dung text: Bài giảng Kỹ thuật Vi xử lý - Chương 5: Thiết kế các cổng I/O - Hồ Viết Việt

  1. 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
  2. 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
  3. Sử dụng 74LS245 làm cổng ra A19 A18 : A0 D7 A0 B0 D6 A1 B1 D5 A2 B2 D4 A3 B3 A4 B4 D3 74LS245 D2 A5 B5 8088 D1 A6 B6 Minimum D0 A7 B7 Mode EDIR5V IOR IOW : mov al, 55 mov dx, F000 out dx, al A A A A A A A A A A A A A A A AIOW 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 : 5 4 3 2 1 0
  4. Sử dụng 74LS245 làm cổng vào A19 5V A18 : A0 D7 A0 B0 D6 A1 B1 D5 A2 B2 D4 A3 B3 A4 B4 D3 74LS245 D2 A5 B5 8088 D1 A6 B6 Minimum D0 A7 B7 Mode EDIR IOR IOW : mov dx, F000 in al, dx : A A A A A A A A A A A A A A A AIOR 1 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 5 4 3 2 1 0
  5. Cổng vào
  6. 8255 PPI
  7. Các mode làm việc • Mode 0 - PA, PB, PCH (CU) và PCL (CL) -Có thể là Input hoặcOutput -Việc Nhập hoặc Xuất dữ liệu là độc lập • Mode 1 - PA, PB -Có thể là Input hoặcOutput -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 -PAvừa là Input vừa là Output -Việc Nhập/Xuất dữ liệu vớiPAlà phụ thuộc vào một số bít của PC (các tín hiệu handshaking)
  8. Từ điều khiển định cấu hình làm việc cho một chip 8255
  9. The 8255 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. • 8255 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 its functions to be 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. 8255 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 (PC0 - PC3). Each can be used for input and output. • RD or WR – IOR and IOW of the system are connected to these two pins • RESET • A0, A1, and CS – CS selects the entire chip whereas A0 and A1 select the specific port (A, B, or C) or Control Register.
  10. 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 50h • Control word should be 1001 0000b = 90h MOV AL, 90h OUT 53h,AL IN AL, 50h OUT 51h, AL OUT 52h, AL Mode 1: I/O with Handshaking Capability • Handshaking refers to the process of communicating back and forth between two 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 byte of data to the printer • 8255 in mode 1 is equipped with resources to handle handshaking signals
  11. 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 8255 through the STB pin. STB is of limited duration. • IBF (Input Buffer Full) – In response to STB, the 8255 latches into its internal register the data present at PA0-PA7 or PB0-PB7. – Through IBF it indicates that it has latched the data but it has not been read by the CPU yet. – To get the attention of the CPU, it IBF activates INTR • INTR – Falling edge of RD makes INTR low – The RD signal from the CPU is of limited duration and when it goes high the 8255 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 8255 and read into the CPU as well.
  12. Lập trình cho 8255
  13. Lập trình cho 8255 BA
  14. Tạo chuỗi xung bằng phần mềm