Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Rabie A. Ramadan Al-Azhar University Lecture 6

Similar presentations


Presentation on theme: "Dr. Rabie A. Ramadan Al-Azhar University Lecture 6"— Presentation transcript:

1 Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 6

2 Interfacing I/O Devices

3 I/O modes Serial Mode Parallel Mode Data entered or exited in parallel
Data entered or exited in serial Parallel Mode Data entered or exited in parallel Interfaced through: Peripheral mapped I/O Each device has a 8-bit address and enabled by I/O related control signals Memory mapped I/O Each device has a 16-bit address and enabled by memory related control signals

4 Interfacing I/O Devices
The Z80 uses the instructions: IN to read (input) data from an input device and OUT to write (send) data to an output device.

5 OUT Instruction It can send data from the accumulator, internal-purpose registers, or memory registers to an output device. The OUT instructions include: 8 bit address of a device as an operand. The address range from 00H to FFH is called the I/O or peripheral map, An address can be referred to as a device address, port address, or port number.

6 Example When the microprocessor reads and executes the machine codes written at memory register 2050H and 2051H, it will transfer (copy) the byte from the accumulator to the LED port with address 07H and display the byte.

7 Execution of OUT Instruction and Timing
The OUT has three machine cycles; Opcode Fetch, Memory Read and I/O Write. The Z80 reads the opcode and the port address from memory in the first two machine cycles and writes into the port in the third cycle.

8 Execution of OUT Instruction and Timing

9 Execution of OUT Instruction and Timing

10 Basic Concepts in Interfacing Output Devices

11 Basic Concepts in Interfacing Output Devices

12 Illustrative Example 1: Interfacing LEDs
Hardware 7475 Latch 4 D-Latches 2 enable lines 47LS373 Octal Latch Latch followed by tri- state buffer Reduces using the data bus 8 latches instead of 4

13 Interface Circuit

14 Interface Circuit

15 Using a Seven-Segment LED as a Display Device

16 Using a Seven-Segment LED as a Display Device

17 Interfacing INPUT Devices
IN instruction Read (copy) data from such input devices as switches, keyboard, and A/D data converters. Can read an input device and place the data into the accumulator, Z80 registers, or memory registers.

18 Example First read the machine codes stored at locations 2065H and 2066H, Read the switch positions at port 84H by enabling the interfacing device of the port. The data byte indicating switch positions from the input port will be placed in the accumulator.

19 Execution of IN Instruction and Its Timing
The IN instruction has three machine cycles: Opcode Fetch, Memory Read  port address I/O Read.

20 Execution of IN Instruction and Its Timing

21 Illustrative Example : Interfacing Input Switches

22 Multiple Port Addresses
the address lines A4 and A3 are not used by the decoding circuit; the logic levels on these lines can be either 0 or 1.

23 Some other examples from the book


Download ppt "Dr. Rabie A. Ramadan Al-Azhar University Lecture 6"

Similar presentations


Ads by Google