0% found this document useful (0 votes)
56 views17 pages

Mpi Tut-11: 8086 I/O Interfacing

This document contains questions and solutions regarding interfacing an 8086 microprocessor with an 8255 Programmable Peripheral Interface chip. The first question involves initializing the ports of the 8255 to sense the states of switches and display the pattern on LEDs. The second question involves writing a program to display a rolling pattern on a set of 8 LEDs. The third question involves reading data from an 8255 port and setting or resetting a pin based on the data value. The remaining questions involve finding addresses of control registers and timers, and generating a square wave using an 8255 timer.

Uploaded by

RAMYA SRIDHAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views17 pages

Mpi Tut-11: 8086 I/O Interfacing

This document contains questions and solutions regarding interfacing an 8086 microprocessor with an 8255 Programmable Peripheral Interface chip. The first question involves initializing the ports of the 8255 to sense the states of switches and display the pattern on LEDs. The second question involves writing a program to display a rolling pattern on a set of 8 LEDs. The third question involves reading data from an 8255 port and setting or resetting a pin based on the data value. The remaining questions involve finding addresses of control registers and timers, and generating a square wave using an 8255 timer.

Uploaded by

RAMYA SRIDHAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

MPI TUT-11

8086 I/O Interfacing


20/4/2023
25/4/2023
Question 1

Interface an 8255 with 8086 to work as an I/O port.


Initialize port A as output port, port B as input port and port C as
output port. Port A address should be 0740H.
Write a program to sense switch positions SW0-SW7 connected at port
B. The sensed pattern is to be displayed on port A, to which 8 LEDs
are connected, while the port C lower displays number of on switches
out of the total eight switches.

04/25/2023 2
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Interfacing with 8086

04/25/2023 3

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 1

8086 A2 A1 pin connected to A1 and A0 pin of 8255


As per the question Port A address should be 0740H
Thus
Port A Address = 0000 0111 0100 0 0 0 0 = 0740H

Port B Address = 0000 0111 0100 0 0 1 0 = 0742H

Port C Address = 0000 0111 0100 0 1 0 0 = 0744H

Control Register Address = 0000 0111 0100 0 1 1 0 = 0746H

04/25/2023 4
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Solution 1

The Control word = 1 0 0 0 0 0 1 0 = 82 H


04/25/2023 5
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Solution 1
MOV DX, 0746H
MOV AL, 82H
OUT DX, AL
SUB DX, 04H
IN AL, DX
SUB DX, 02H
OUT DX, AL
MOV BL, 00H
MOV CL, 08H
YY: ROL AL
JNC XX
INC BL
XX: DEC CL
JNZ YY
MOV AL, BL
ADD DX, 04H
OUT DX, AL
.EXIT
END
04/25/2023 6
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Question 2

• Write a program to display a rolling pattern of 8


LEDs.

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 2

• Assume the 8 LEDs are connected to CR – CONTROL REGISTER


Port A of 8255. PA – PORT A

• Hence, we need to declare Port A as an


MOV AL, 80H
output port. The other ports do not
matter. OUT CR, AL
MOV AL, 01H
• Since we need to display a rolling AGAIN: OUT PA, AL
pattern, we have to send a high signal ROR AL (or ROL AL)
to one LED at a time sequentially with CALL DELAY
some delay in-between. JMP AGAIN

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Question 3

• Write a program to do the following: Read data from Port A. If the data is
above 7FH, send a high value on PC7. Otherwise, make PC7 zero. Use the
Bit Set Reset (BSR) Mode of 8255.

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 3
• Write a program to do the following: Read data from Port A. If the data is
above 7FH, send a high value on PC7. Otherwise, make PC7 zero. Use the
Bit Set Reset (BSR) Mode of 8255.

Solution:
• The first step in solving this problem is to configure Port A to be an input
port and Port Cupper to be an output port (since a signal has to generated on
it), in mode 0.
• Even though we might be using a BSR mode, we must first ‘configure’ the
ports as input/output.
• The control word for this is 10010000 = 90H

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 3

For PC7 to be set, the Control Word is 00001111 = 0FH


For PC7 to be reset, the Control Word is 00001110 = 0EH

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 3

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Question 4

Find the addresses of the control registers and the three counters.

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 4

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Question 5

The input frequency to the timer chip is 1.5 MHz.


Generate a square wave of 1.5 KHz using Timer 0.

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 5

The input frequency to the timer chip is 1.5 MHz.


Generate a square wave of 1.5 KHz using Timer 0.

Therefore, the control word is 00110110 = 36H

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION


Solution 5

The input frequency to the timer chip is 1.5 MHz.


Generate a square wave of 1.5 KHz using Timer 0.

ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION

You might also like