eee410_lecture16 - EEE 410 Microprocessors I Spring 04/05...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 EEE 410 – Microprocessors I Spring 04/05 – Lecture Notes # 16 Outline of the Lecture Input/Output (I/O) and Device Interfacing I NPUT /O UTPUT (I/O) AND D EVICE I NTERFACING In addition to memory, 80x86 microprocessors are able to access I/O ports. Ports are accessed either to bring data from the port into the CPU (inputting) or to send data from the CPU to the port (outputting). Input/Output Instructions in 8086 CPU The 8086 microprocessor can access information from ports as well as from the memory. There are two instructions for this purpose “IN” and “OUT”. These instructions can send data from the accumulator (AX, AL or AH) to ports or receive data from ports into the accumulator. Case 1: 8-bit data ports Inputting Data Outputting Data Format IN dest,source OUT dest,source (1) IN AL,port# OUT port#,AL (2) MOV DX,port# IN AL,DX MOV DX,port# OUT DX,AL In format (1) above, port# is the address of the port , and can be from 00 to FFH. This 8-bit address allows 256 input ports and 256 output ports. No segment register is involved in computing the address, in contrast to the data accessed from memory. In format (2) , port# is the address of the port, and can be from 0000 to FFFFH. This 16-bit address allows 65,536 input ports and 65,536 output ports. No segment register (DS) is involved. Ex: Write a sequence of instructions that will output FFH to a byte-wide output port at the address ABH of the I/O address space? MOV AL,FFH OUT ABH,AL Ex: Write a sequence of instructions that will output FFH to an output port at the address B000H of the I/O address space? MOV DX,B000H ;Note that 16-bit address must be in DX M O V A L , F F H OUT DX,AL Ex: Assume that the port address 22H is an input port for monitoring the temperature. Write Assembly language instructions to monitor the port continuously for the temperature of 100 degrees. If it reaches 100, then BH should contain ‘Y’. BACK:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/26/2011 for the course EEE 410 taught by Professor Hasandemirel during the Spring '10 term at Eastern Mediterranean University.

Page1 / 5

eee410_lecture16 - EEE 410 Microprocessors I Spring 04/05...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online