2 Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.Various I/O techniques exist.Direct TransferTest and TransferInterrupt TransferDirect Memory AccessFacilities provided by typical microprocessor chips.How to design interfaces for computers and microprocessor systems.The Intel family of microprocessors are no different from
3 Characteristics of I/O Devices INPUTOUTPUTComplexitySwitches Transducer Counters/ KeyboardsLamps Servos Alphanumeric display VDU Terminals Disk Drives MultimediaSimplestMost ComplexThe more complex devices may well require much more complex interfaces than simple devices such as switches and lamps.Microprocessors are generally connected to a much wider range of devices than larger computers because their range of application is much wider.
4 ISOLATED INPUT AND OUTPUT In Isolated input & output, the data transfer between microprocessor and the I/O device takes places using special I/O instructions IN and OUT.In memory-mapped I/O, and instruction that references to memory can accomplish the I/O transfer.The Isolated I/O (I/O via separate address space) is the most common I/O transfer technique used in Intel Microprocessor Based System.The term ISOLATED describes how the I/O locations are isolated from the memory system in a separate I/O address space.
6 ISOLATED INPUT AND OUTPUT (Contt..) The address for Isolated I/O devices are called PORTS. It is separate from the memory.The user can expand the memory to its full size without using any of this space for I/O devices.DISADVANTAGE or ISOLATED I/O: The data transfer between I/O & microprocessor must be accessed by INS, OUT, OUTS instructions.Separate Control Signals for I/O space are used (using M/IO & W/R) that indicate an I/O read (IORC) or an I/O write (IOWC) operation.
7 ISOLATED INPUT AND OUTPUT (Contt..) In PC, Isolated I/O ports are used for controlling peripheral devices.8-bits port address is used to access devices located on the system board, such as: Timer, Keyboard Interface.16-bits port address is used to access serial & parallel port. Video (CGA/VGA) & Disk Drive System.DISADVANTAGE of MEMORY-MAPPED I/O: The portion of the memory system is used to as the I/O map. This reduces the amount of memory available to applications.
8 Input & Output MAP of PCThe PC used part of I/O map for DEDICATED APPLICATIONS.The I/O space between ports 0000H and 03FF is normally reserved for Computer System.The I/O ports located at 0400H-FFFFH are generally available for user applications.
10 I/O INSTRUCTIONSBoth IN & OUT instructions transfer data between I/O device & microprocessor’s accumulator (AL, AX or EAX).Instructions INS and OUTS, which are available on all versions, except 8086/8088 are used to transfers STRINGS of data between the memory & I/O Device.All data transfer takes pace between I/O devices & AL or AX register. For this reason, this method of performing I/O is know as ACCUMULATOR I/O.
11 MnemonicMeaningFormatOperationINOUTInput directInput Indirect (Variable)Output DirectOutput Indirect (Variable)IN Acc, PortIN Acc, DXOUT Port, AccOUT DX, Acc(Acc) (Port) Acc = AL or DX(Acc) (DX)(Port) (Acc)(DX) (Acc)Byte transfers involve the AL register and word transfers involve AX register.Since 16 address line (A0-A15) are used to address I/O ports, the I/O address space consists of 64K word-wide I/O ports.In Direct I/O instruction, the address of the I/O port is specified at port of the instruction. 8-bits are provided for Direct address. For this reason its value is limited to 0000H to 00FFH.
12 Example-1IN AL, FEExecution of this instruction causes the contents of the byte-wide I/O port (at address FEH) to be input to the AL register.Example-2Write a sequence of instructions that will output FFH to a byte-wide output port at address ABH of the I/O address space.
13 Solution:First the AL register is loaded with FFH as an immediate operand using instruction:MOV AL. FFNow the data in AL can be output to the byte-wide output port with the instruction:OUT AB, AL
14 The difference between the direct and variable I/O instruction lies in the way in which the address of the I/O port is specified.For direct I/O Instruction an 8-bit address is specified as port of the instruction.The variable I/O uses a 16-bit address the resides in DX register.The value in DX is the actual address that is to be output.Since this address is al full 16-bits in length, variable I/O instructions can access ports located anywhere in the 64K byte I/O address space.
15 Example-3Write a series of instructions that will output FFH to an output port located at address B000H of the I/O address space (Turn all LED’s ON).Solution:MOV DX, B000 : DX register must be loaded with address of the output port.MOV AL, FF : Data to be output must be loaded into ALOUT DX, AL : Data is sent at output address B000H
16 Example-4 Solution: MOV AL, FF : and move it to AH Suppose Data are to be read in from two byte-wide input ports at address AAH and A9H, respectively, and then output as word to a word-wide output port at address FAFDH. Write a sequence of instructions to perform this input/output operation.Solution:IN AL , AA : First read byte from the port address AAH into ALMOV AL, FF : and move it to AHOUT DX, AL : other byte can be read into ALMOV DX, FAFD : load DX with variable addressOUT DX, AX : send contents of AX at output FAFDH