MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to...

16
MICROPROCESSOR BASED MICROPROCESSOR BASED SYSTEM DESIGN SYSTEM DESIGN

Transcript of MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to...

Page 1: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

MICROPROCESSOR BASED MICROPROCESSOR BASED SYSTEM DESIGNSYSTEM DESIGN

Page 2: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Input and output interfaces Input and output interfaces Hardware Interfaces are required to enable Hardware Interfaces are required to enable

input and output of data to and from a input and output of data to and from a computer. computer.

Various I/O techniques exist.Various I/O techniques exist. Direct TransferDirect Transfer Test and TransferTest and Transfer Interrupt TransferInterrupt Transfer Direct Memory AccessDirect Memory Access

Facilities provided by typical Facilities provided by typical microprocessor chips.microprocessor chips.

How to design interfaces for computers and How to design interfaces for computers and microprocessor systems.microprocessor systems.

The Intel family of microprocessors are no The Intel family of microprocessors are no different fromdifferent from

Page 3: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Characteristics of I/O DevicesCharacteristics of I/O Devices

The more complex devices may well require much The more complex devices may well require much more complex interfaces than simple devices such as more complex interfaces than simple devices such as switches and lamps.switches and lamps.

Microprocessors are generally connected to a much Microprocessors are generally connected to a much wider range of devices than larger computers because wider range of devices than larger computers because their range of application is much wider.their range of application is much wider.

INPUTINPUT OUTPUTOUTPUT ComplexityComplexity

Switches Switches Transducer Transducer Counters/ Counters/ KeyboardsKeyboards

Lamps Lamps Servos Servos

AlphanumeriAlphanumeric display c display

VDU VDU Terminals Terminals

Disk Drives Disk Drives MultimediaMultimedia

SimplestSimplest

Most Most ComplexComplex

Page 4: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

ISOLATED INPUT AND ISOLATED INPUT AND OUTPUTOUTPUT

In Isolated input & output, the data transfer In Isolated input & output, the data transfer between microprocessor and the I/O device between microprocessor and the I/O device takes places using special I/O instructions IN takes places using special I/O instructions IN and OUT.and OUT.

In memory-mapped I/O, and instruction that In memory-mapped I/O, and instruction that references to memory can accomplish the I/O references to memory can accomplish the I/O transfertransfer..

The Isolated I/O (I/O via separate address The Isolated I/O (I/O via separate address space) is the most common I/O transfer space) is the most common I/O transfer technique used in Intel Microprocessor Based technique used in Intel Microprocessor Based System.System.

The term ISOLATED describes how the I/O The term ISOLATED describes how the I/O locations are isolated from the memory locations are isolated from the memory system in a separate I/O address space.system in a separate I/O address space.

Page 5: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.
Page 6: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

ISOLATED INPUT AND OUTPUT ISOLATED INPUT AND OUTPUT (Contt..)(Contt..)

The address for Isolated I/O devices are called The address for Isolated I/O devices are called PORTS. It is separate from the memory.PORTS. It is separate from the memory.

The user can expand the memory to its full size The user can expand the memory to its full size without using any of this space for I/O devices.without using any of this space for I/O devices.

DISADVANTAGE or ISOLATED I/O: The data DISADVANTAGE or ISOLATED I/O: The data transfer between I/O & microprocessor must be transfer between I/O & microprocessor must be accessed by INS, OUT, OUTS instructions.accessed by INS, OUT, OUTS instructions.

Separate Control Signals for I/O space are used Separate Control Signals for I/O space are used (using M/IO & W/R) that indicate an I/O read (using M/IO & W/R) that indicate an I/O read (IORC) or an I/O write (IOWC) operation.(IORC) or an I/O write (IOWC) operation.

Page 7: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

ISOLATED INPUT AND OUTPUT ISOLATED INPUT AND OUTPUT (Contt..)(Contt..)

In PC, Isolated I/O ports are used for In PC, Isolated I/O ports are used for controlling peripheral devices.controlling peripheral devices.

8-bits port address is used to access 8-bits port address is used to access devices located on the system board, such devices located on the system board, such as: Timer, Keyboard Interface.as: Timer, Keyboard Interface.

16-bits port address is used to access 16-bits port address is used to access serial & parallel port. Video (CGA/VGA) & serial & parallel port. Video (CGA/VGA) & Disk Drive System.Disk Drive System.

DISADVANTAGE of MEMORY-MAPPED I/O: DISADVANTAGE of MEMORY-MAPPED I/O: The portion of the memory system is used The portion of the memory system is used to as the I/O map. to as the I/O map. This reduces the This reduces the amount of memory available to amount of memory available to applications.applications.

Page 8: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Input & Output MAP of PCInput & Output MAP of PC

The PC used part of I/O map for The PC used part of I/O map for DEDICATED APPLICATIONS.DEDICATED APPLICATIONS.

The I/O space between ports 0000H The I/O space between ports 0000H and 03FF is normally reserved for and 03FF is normally reserved for Computer System.Computer System.

The I/O ports located at 0400H-FFFFH The I/O ports located at 0400H-FFFFH are generally available for user are generally available for user applications.applications.

Page 9: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.
Page 10: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

I/O INSTRUCTIONSI/O INSTRUCTIONS

Both IN & OUT instructions transfer data Both IN & OUT instructions transfer data between I/O device & microprocessor’s between I/O device & microprocessor’s accumulator (AL, AX or EAX).accumulator (AL, AX or EAX).

Instructions INS and OUTS, which are Instructions INS and OUTS, which are available on all versions, except available on all versions, except 8086/8088 are used to transfers STRINGS 8086/8088 are used to transfers STRINGS of data between the memory & I/O Device.of data between the memory & I/O Device.

All data transfer takes pace between I/O All data transfer takes pace between I/O devices & AL or AX register. For this devices & AL or AX register. For this reason, this method of performing I/O is reason, this method of performing I/O is know as ACCUMULATOR I/O.know as ACCUMULATOR I/O.

Page 11: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Byte transfers involve the AL register and word Byte transfers involve the AL register and word transfers involve AX register.transfers involve AX register.

Since 16 address line (A0-A15) are used to address Since 16 address line (A0-A15) are used to address I/O ports, the I/O address space consists of 64K I/O ports, the I/O address space consists of 64K word-wide I/O ports.word-wide I/O ports.

In In Direct I/O Direct I/O instruction, the address of the I/O port is instruction, the address of the I/O port is specified at port of the instruction. 8-bits are specified at port of the instruction. 8-bits are provided for provided for Direct addressDirect address. For this reason its value . For this reason its value is limited to 0000H to 00FFH.is limited to 0000H to 00FFH.

MnemoniMnemonicc

MeaningMeaning FormatFormat OperationOperation

ININ

OUTOUT

Input directInput direct

Input Indirect (Variable)Input Indirect (Variable)

Output DirectOutput Direct

Output Indirect Output Indirect (Variable)(Variable)

IN Acc, PortIN Acc, Port

IN Acc, DXIN Acc, DX

OUT Port, OUT Port, AccAcc

OUT DX, AccOUT DX, Acc

(Acc) (Port) Acc = AL or (Acc) (Port) Acc = AL or DXDX

(Acc) (DX)(Acc) (DX)

(Port) (Acc)(Port) (Acc)

(DX) (Acc)(DX) (Acc)

Page 12: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Example-1Example-1

IN AL, FEIN AL, FE

Execution of this instruction causes the Execution of this instruction causes the contents of the byte-wide I/O port (at contents of the byte-wide I/O port (at address FEH) to be input to the AL address FEH) to be input to the AL register.register.

Example-2Example-2

Write a sequence of instructions that will Write a sequence of instructions that will output FFH to a byte-wide output port at output FFH to a byte-wide output port at address ABH of the I/O address space.address ABH of the I/O address space.

Page 13: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Solution:Solution:

First the AL register is loaded with FFH First the AL register is loaded with FFH as an immediate operand using as an immediate operand using instruction:instruction:

MOV AL. FFMOV AL. FF

Now the data in AL can be output to the Now the data in AL can be output to the byte-wide output port with the byte-wide output port with the instruction:instruction:

OUT AB, ALOUT AB, AL

Page 14: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

The difference between the direct and The difference between the direct and variable I/O instruction lies in the way in variable I/O instruction lies in the way in which the address of the I/O port is which the address of the I/O port is specified.specified.

For For direct I/Odirect I/O Instruction an 8-bit address is Instruction an 8-bit address is specified as port of the instruction.specified as port of the instruction.

The The variable I/Ovariable I/O uses a 16-bit address the uses a 16-bit address the resides in DX register.resides in DX register.

The value in DX is the The value in DX is the actual addressactual address that that is to be output.is to be output.

Since this address is al full 16-bits in Since this address is al full 16-bits in length, variable I/O instructions can access length, variable I/O instructions can access ports located anywhere in the 64K byte I/O ports located anywhere in the 64K byte I/O address space. address space.

Page 15: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Example-3Example-3

Write a series of instructions that will output Write a series of instructions that will output FFH to an output port located at address FFH to an output port located at address B000H of the I/O address space (Turn all LED’s B000H of the I/O address space (Turn all LED’s ON).ON).

Solution:Solution:

MOV DX, B000MOV DX, B000 :: DX register must be DX register must be loaded loaded with address with address of the output of the output port.port.

MOV AL, FFMOV AL, FF :: Data to be output must Data to be output must be be loaded into ALloaded into AL

OUT DX, ALOUT DX, AL :: Data is sent at output Data is sent at output address address B000HB000H

Page 16: MICROPROCESSOR BASED SYSTEM DESIGN. Input and output interfaces Hardware Interfaces are required to enable input and output of data to and from a computer.

Example-4Example-4

Suppose Data are to be read in from two byte-Suppose Data are to be read in from two byte-wide input ports at address AAH and A9H, wide input ports at address AAH and A9H, respectively, and then output as word to a respectively, and then output as word to a word-wide output port at address FAFDH. Write word-wide output port at address FAFDH. Write a sequence of instructions to perform this a sequence of instructions to perform this input/output operation.input/output operation.

Solution:Solution:

IN AL , AAIN AL , AA : : First read byte from the port address AAH First read byte from the port address AAH into AL into AL

MOV AL, FFMOV AL, FF : : and move it to AHand move it to AH

OUT DX, ALOUT DX, AL : : other byte can be read into ALother byte can be read into AL

MOV DX, FAFD :MOV DX, FAFD : load DX with variable addressload DX with variable address

OUT DX, AXOUT DX, AX : : send contents of AX at output FAFDHsend contents of AX at output FAFDH