Chapter 7: Programmable Parallel Interface 8255
Tutorial exercises No 7
Exercise 01:
Course Questions
1. Determine the command words (in mode 0) to write into the command register of the 8255A PPI for the
following configurations:
a) PORTA as input, PORTB as input, and PORTC as output.
b) PORTA as output, PORTB as input, and PORTC as input.
c) PORTA as input, PORTB as output, PORTC (lower) as output, and PORTC (upper) as input.
2. Determine the states of signals A1, A0, RD, WR, and CS for:
a) Reading from PORTA.
b) Writing to the command register (Reg_Com).
3. If the command register contains the value 99H:
Determine the configuration of the ports (input or output) of the 8255A and the mode being used.
Exercise 02:
Create the flowchart and write an assembly program to display numbers from 0 to 15 on a 7-segment display.
Each number is displayed for 1 second (using a 1-second delay). The address of PORTA is 200H. Mode 0 is used
to program the PPI. PORTB and the upper part of PORTC are not connected and must be configured as outputs.
The display used is a common anode 7-segment display with 2 digits, multiplexed. The units digit is selected via
transistor Q1, and the tens digit is selected via transistor Q2. A 7447 BCD-to-7-segment decoder is used to drive
the display. See the circuit diagram below.
Figure 7.1. Interface Diagram for a 7-Segment Display
Prepared by: Pr. M.C. Amara Korba Academic Year 2023/2024 1
Chapter 7: Programmable Parallel Interface 8255
Exercise 03:
Figure 7.2. Interface Diagram for the Digital-to-Analog Converter DAC800
Create the flowchart and write a program to generate a triangular signal with a period of 60 ms. The main
program uses a 0.5 ms delay subroutine (tempo). The ports (PORTA and PORTB) are not connected and must
be configured as outputs. The 8255A is configured in mode 0.
Exercise 04:
In the diagram below, a 16-key keypad is used, organized in a 4x4 matrix of push buttons. A 8255A PPI is used
to interface it with the 8086. The lines of PORTC are connected to the columns, and the lines of PORTA are
connected to the rows.
• PORTC is configured as output, and PORTA as input.
• The 8255 sequentially sets each line of its output to logic "1". If a key is pressed, the corresponding column
will then go to logic "1". Knowing which row is at logic "1", the pressed key in the matrix can be identified.
Write a program to identify the pressed key.
Figure 7.3. Interface Diagram of a 4x4 16-Key Keypad
Prepared by: Pr. M.C. Amara Korba Academic Year 2023/2024 2
Chapter 7: Programmable Parallel Interface 8255
Exercise 05:
Create the flowchart and write a program to control a two-phase unipolar stepper motor. The motor should
rotate in the clockwise direction (operating in full-step mode with maximum torque). (See the figure below.)
Figure 7.4. Two-Phase Unipolar Stepper Motor
Figure 7.5. Interface Diagram of the Stepper Motor
Prepared by: Pr. M.C. Amara Korba Academic Year 2023/2024 3