Microprocessor Interfacing- Interfacing Concepts

17
MICROPROCESSOR INTERFACING Interfacing Concepts, Data Transmission, I/O Instruction http://tulisnota.blogspot.com/

Transcript of Microprocessor Interfacing- Interfacing Concepts

Page 1: Microprocessor Interfacing- Interfacing Concepts

MICROPROCESSOR INTERFACINGInterfacing Concepts, Data Transmission, I/O Instruction

http://tulisnota.blogspot.com/

Page 2: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

INTERFACING CONCEPT

Input interface adapter

MPU ROM RAMOutput

interface adapterPe

riphe

ral

devi

ce

Perip

hera

l de

vice

Address bus (16 bits)

Data bus (8 bits)

Control bus

http://tulisnota.blogspot.com/

Page 3: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

INTERFACING CONCEPT

Definition: the interconnection, or linkage, of the parts within the microprocessor based system.

Activities over buses:1. Memory read2. Memory write3. I/O read4. I/O write5. Interrupt or reset handling

http://tulisnota.blogspot.com/

Page 4: Microprocessor Interfacing- Interfacing Concepts

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/

Page 5: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

DATA TRANSMISSION

Types of Input/Output1. Isolated Input/Output2. Memory-mapped Input/Output

http://tulisnota.blogspot.com/

Page 6: Microprocessor Interfacing- Interfacing Concepts

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/

Page 7: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

ISOLATED I/O

FFFFFH

00001H

00000H

FFFFH

0001H

0000H

Memory address space

I/O address space

http://tulisnota.blogspot.com/

Page 8: Microprocessor Interfacing- Interfacing Concepts

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 slower2. Part of memory address space is lost

http://tulisnota.blogspot.com/

Page 9: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

MEMORY MAPPED I/O

00000H

00001H

FFFFFH

EOFFFH

E0000HMemory address space

I/O address space

http://tulisnota.blogspot.com/

Page 10: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

INPUT/OUTPUT INSTRUCTION

Mnemonic Meaning Format Operation

INInput direct IN Acc, Port (Acc) (Port)

Input indirect (variable) IN Acc, DX (Acc) ((DX))

OUTOutput direct OUT Port, Acc (Port) (Acc)

Output indirect (variable) OUT DX, Acc ((DX)) (Acc)

Note: Acc = accumulator = AL or AX

http://tulisnota.blogspot.com/

Page 11: Microprocessor Interfacing- Interfacing Concepts

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/

Page 12: Microprocessor Interfacing- Interfacing Concepts

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 instructionMOV AL, FF

Now the data in AL can be output to the byte-wide output port with the instructionOUT AB, AL

http://tulisnota.blogspot.com/

Page 13: Microprocessor Interfacing- Interfacing Concepts

http://tulisnota.blogspot.com/

INPUT/OUTPUT INSTRUCTION (CONT.)

Example 2:Write a 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/

Page 14: Microprocessor Interfacing- Interfacing Concepts

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 instructionMOV DX, BOOO

Next, the data that are to be output must be loaded into AL with the instructionMOV AL, 00FF

Finally, the data are output with the instructionOUT DX, AL

http://tulisnota.blogspot.com/

Page 15: Microprocessor Interfacing- Interfacing Concepts

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.

Page 16: Microprocessor Interfacing- Interfacing Concepts

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 instructionsIN AL, AAMOV AH, AL

Now the other byte, which is at port A9, can be read into AL by instructionIN AL, A9

Page 17: Microprocessor Interfacing- Interfacing Concepts

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 followingMOV DX, BOOOOUT DX, AX