Вы находитесь на странице: 1из 17

http://tulisnota.blogspot.

com/

Interfacing Concepts, Data Transmission, I/O Instruction

MICROPROCESSOR INTERFACING
http://tulisnota.blogspot.com/
INTERFACING CONCEPT
Address bus (16 bits)
Peripheral

Peripheral
Input
device

device
Output
interface MPU ROM RAM interface
adapter adapter

Data bus (8 bits)

Control bus
http://tulisnota.blogspot.com/
INTERFACING CONCEPT
 Definition: the interconnection, or linkage, of
the parts within the microprocessor based
system.
 Activities over buses:
1. Memory read
2. Memory write
3. I/O read
4. I/O write
5. Interrupt or reset handling
http://tulisnota.blogspot.com/
INTERFACING CONCEPT

 DMA (Direct Memory Access):


 MPUs release control of the data busses for
peripheral device to access main system memory
directly without going through the MPU.
http://tulisnota.blogspot.com/
DATA TRANSMISSION

 Types of Input/Output
1. Isolated Input/Output
2. Memory-mapped Input/Output
http://tulisnota.blogspot.com/
ISOLATED I/O

 I/O address are separated from memory address


 Advantages:
1. Complete 1Mb memory address space is available for
use with memory
2. Special instruction have been provided to perform
isolated I/O operation
 Disadvantage:
1. All input and output data must take place between
the AL and AX register and the I/O port.
http://tulisnota.blogspot.com/
ISOLATED I/O
FFFFFH

Memory
address
space FFFFH

I/O address
space

00001H 0001H

00000H 0000H
http://tulisnota.blogspot.com/
MEMORY MAPPED I/O
 I/O address are inside memory address
 Advantages:
1. More instructions are available to perform I/O
operations
2. More addressing modes are available to perform
input/output operations
 Disadvantages:
1. Memory instructions to execute slower
2. Part of memory address space is lost
http://tulisnota.blogspot.com/
MEMORY MAPPED I/O
FFFFFH

EOFFFH
I/O address
space
Memory
E0000H
address
space

00001H

00000H
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION
Mnemonic Meaning Format Operation
Input direct IN Acc, Port (Acc)  (Port)
IN
Input indirect (variable) IN Acc, DX (Acc)  ((DX))
Output direct OUT Port, Acc (Port)  (Acc)
OUT
Output indirect (variable) OUT DX, Acc ((DX))  (Acc)

Note: Acc = accumulator = AL or AX


http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (CONT.)

 Example 1:
 Write a sequence of instruction that will output the
data FFH to a byte-wide output port at address ABH
of the I/O address space,
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (CONT.)

 Example 1 (answer):
 First,
the AL register is loaded with FFH as an
immediate operand in the instruction
MOV AL, FF

 Now the data in AL can be output to the byte-wide


output port with the instruction
OUT AB, AL
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (CONT.)

 Example 2:
 Writea series of instruction that will output FFH to
an output port located at address B000H of the I/O
address space.
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (C0NT.)

 Example 2 (answer):
 The DX register must first be loaded with the
address of the output. This is done with instruction
MOV DX, BOOO

 Next, the data that are to be output must be loaded


into AL with the instruction
MOV AL, 00FF

 Finally, the data are output with the instruction

OUT DX, AL
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (C0NT.)

 Example 3:
 Data are to be read in from two byte-wide input
ports at address AAH and A9H and then the output
as word to a word-wide output port at address
B000H. Write a sequence of instruction to perform
this input/output operation.
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (C0NT.)

 Example 3 (answer)
 We can first read in the byte from the port at
address AAH into AL and move it to AH. This is done
with instructions
IN AL, AA

MOV AH, AL

 Now the other byte, which is at port A9, can be read


into AL by instruction
IN AL, A9
http://tulisnota.blogspot.com/
INPUT/OUTPUT INSTRUCTION (C0NT.)

 Example 3 (answer) cont.


 The word is now held in AX. To write out the word of
data, we load DX with the address B000H and use
a variable output instruction. This leads to the
following
MOV DX, BOOO

OUT DX, AX

Вам также может понравиться