0% found this document useful (0 votes)
31 views

Digital I/O Programming Using PPI

This document describes a lab experiment on digital I/O programming using the 8255 Programmable Peripheral Interface (PPI) device. The objectives are to program the PPI device for different configurations, perform bitwise testing of ports, exchange data between ports, and write and use delay subroutines. The background provided explains the functionality of the 8255 PPI chip, its ports and control word programming. The procedures section lists 5 experiments involving reading/writing ports on one or both PPIs, with or without delays and data manipulation.

Uploaded by

عسم ساما
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Digital I/O Programming Using PPI

This document describes a lab experiment on digital I/O programming using the 8255 Programmable Peripheral Interface (PPI) device. The objectives are to program the PPI device for different configurations, perform bitwise testing of ports, exchange data between ports, and write and use delay subroutines. The background provided explains the functionality of the 8255 PPI chip, its ports and control word programming. The procedures section lists 5 experiments involving reading/writing ports on one or both PPIs, with or without delays and data manipulation.

Uploaded by

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

LAB #2

Digital I/O Programming


Using PPI

1
Electrical Engineering Department, College of Engineering, Qassim University, Buraidah,
Saudi Arabia, Microprocessor Laboratory (EE354)

LAB #2
Digital I/O Programming using PPI
2.0 Objective
The objective of this lab is to work with PPI (Programmable Peripheral Interface) devices which
are used in microprocessor based systems to create programmable I/O Ports.
In this lab, you will do the following:
• Program the PPI devices for different configurations.
• Software based bitwise testing of ports and PPIs.
• Data exchange between the ports
• Write and use delay subroutines.

2.1 Equipment List


PC (with assembler and downloading program), Flight-8086 microprocessor training system,
RS-232 cable, Led/Switch units.

2.2 Background
8255 is a 40 pin programmable dual in line package. It is a general purpose I/O device. It has
three accessible 8 bit ports named as A, B and C. The 8255 is used in the circuit of Flight-8086
training kit because it is compatible to interface with microprocessor based systems and it
provides the digital I/O ports which can be programmed through software. 8255 is used with a
microprocessor or microcontroller based system with interface like as shown in Figure 2.1. In
addition to these three ports, a third port (Control) is used to program the chip. It has three I/O
ports named as A, B and C. Each of the ports, A or B, can be programmed as an 8-bit input or
output port. Port C can be divided in half, with the top most or bottom most four bits
programmed as inputs or outputs. Individual bits of a particular port cannot be programmed. In
the FLIGTH-86 training system, the 8255 PPI chips are interfaced to two parallel port sockets P1
and P2. In each socket, each one the four ports (A, B, C, and Control) has an individual address
as shown in Table 2.1.The 8255 PPI chip can be programmed to operate in three modes:
• Mode 0: Basic Input/Output.
• Mode 1: Strobed Input/Output.
• Mode 2: Bi-directional bus (not available on FLIGHT-86)
There is also a bit set/reset mode that allows individual bits of port C to be set or reset for control
purposes. Mode 0 gives the simplest form of I/O possible, where no ‘handshaking’ is required.
Data is simply read from or written to the specified port.

2
Electrical Engineering Department, College of Engineering, Qassim University, Buraidah,
Saudi Arabia, Microprocessor Laboratory (EE354)

Figure 2.1: 8255 PPI I/O Interface.

Table 2.1: 8255 Port Addresses


PORT ACTIVITY ACTUAL PORT ADDRESS
P1 P2
A Read/Write 00h 01h
B Read/Write 02h 03h
C Read/Write 04h 05h
CONTROL Write only 06h 07h

Table 2.2: Control words for Mode 0


PORTS CONTROL WORD
A C(higher) B C(lower) D7 D6 D5 D4 D3 D2 D1 D0
OUT OUT OUT OUT 1 0 0 0 0 0 0 0
OUT OUT OUT IN 1 0 0 0 0 0 0 1
OUT OUT IN OUT 1 0 0 0 0 0 1 0
OUT OUT IN IN 1 0 0 0 0 0 1 1
OUT IN OUT OUT 1 0 0 0 1 0 0 0
OUT IN OUT IN 1 0 0 0 1 0 0 1
OUT IN IN OUT 1 0 0 0 1 0 1 0
OUT IN IN IN 1 0 0 0 1 0 1 1
IN OUT OUT OUT 1 0 0 1 0 0 0 0
IN OUT OUT IN 1 0 0 1 0 0 0 1
IN OUT IN OUT 1 0 0 1 0 0 1 0
IN OUT IN IN 1 0 0 1 0 0 1 1
IN IN OUT OUT 1 0 0 1 1 0 0 0
IN IN OUT IN 1 0 0 1 1 0 0 1
IN IN IN OUT 1 0 0 1 1 0 1 0
IN IN IN IN 1 0 0 1 1 0 1 1

3
Electrical Engineering Department, College of Engineering, Qassim University, Buraidah,
Saudi Arabia, Microprocessor Laboratory (EE354)

Any one of the ports A, B, C (upper half), and C (lower half) can be set individually as input or
output ports. This is done by sending a control byte to the Control Port. The 16 possible control
words are shown in Table 2.2. Notice that D7, D6, D5, and D2 are fixed for this mode. For
example, to set the three ports as output ports, you need to send the control word 80h to the
control port using the following set of instructions:

MOV AL, 80H; load AL with the control word 80H


OUT 06H, AL; send this control word to port 06H (i.e. to control port)

2.3 Procedure

Experiment #1: Software Bit-wise Testing of Port


1) Connect the Switch/LED unit to P1. Create a new project and enter the following program:
; Initial assembler source file for FLT-8086
PORTA EQU 00H
PORTB EQU 02H
CONTROL EQU 06H

assume cs:CODE, ds:CODE, es:CODE

org 0050h:0000h

; add your source code here

MOV AL,90H
OUT CONTROL,AL
MOV AL,01H

AGAIN: OUT PORTB,AL


CALL DELAY
ROL AL,1
JMP AGAIN

DELAY: MOV DL,30


AGAIN2 MOV CX,2000
AGAIN1: DEC CX
JNZ AGAIN1
DEC DL
JNZ AGAIN2
RET
INT 5
END
Execute the program and observe the status of LEDs on Port B for P1.

4
Electrical Engineering Department, College of Engineering, Qassim University, Buraidah,
Saudi Arabia, Microprocessor Laboratory (EE354)

2) Modify the above program to test Port B for P2.


3) Modify the program obtained in 2) to produce double time delay between two consecutive
outputs.
4) Modify the program obtained in 3) to produce reverse order sequence and half time delay
between two consecutive outputs.

Experiment #2: Digital I/O Programming


1) Connect Switch/LED unit to PPI-P1. Write the assembly Language program which
continuously take input from Port A and send it to Port B.
2) Connect Switch/LED units to both PPIs. Write the assembly Language program which
continuously take input from Port a of PPI-II and send it to Port B of PPI-1.
3) Write a delay routine roughly equal to 1-second, using loops.
4) Write the assembly Language program which continuously take input from Port A of PPI-1,
increment it and after a delay of 2-seconds send it to Port B of PPI-II.
5) Write the assembly language program which continuously take the inputs from Port As of
PPI-I and PPI-II, and send their inverted data to Port Bs of PPI-II and PPI-I respectively.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy