Académique Documents
Professionnel Documents
Culture Documents
Lab - week 6
Intel PPI 8255 has three ports A, B, C, and a control register for initialisation. Ports A
and B can be programmed as either input or output and ports A and C can be used as
bidirectional. Port C can be programmed as a pair of 4-bit bidirectional control ports or
individual lines can be set or reset.
These ports operate in three modes mode 0, mode 1, and mode 2. The ports and control
register are mapped to addresses as follows:
Control word can be found by setting or resetting individual bits of the control register
according to the requirement.
7 6 5 4 3 2 1 0
D7 D6 D5 D4 D3 D2 D1 D0
Group B
Port C(L) – 1 Input
0 output
Port B – 1 Input 0 output
Mode select: 0 mode 0; 1 mode 1
7 6 5 4 3 2 1 0
1 0 0 1 x 0 0 x
Port C(L) – x
Port B – 0 output
Mode select: 0 mode 0
1 – mode select
.area text
_main::
LDAA #$90 ;A ← control word $90
STAA $106F ;put control word into control register -$106F
;always use a time delay
BSR Delay40
Ports A, B, and C are memory mapped whose addresses are given as $106C, $106D, and
$106E. Reading a port is done by simply reading the memory addresses of the ports.
Suppose you are designing a microprocessor-based door lock. It will compare a code
value and will open the door for few seconds if it matches the code. The code is read
from 8-pins of port A. Write an HC11 assembly language program for the digital lock.
Open door is indicated by the switching the 1st LED on and closed door is indicated by
switching all the LEDs (1st through 8th ) on.
.area text
_main::
;Initialisation
LDAA #$90 ;A ← control word $90
STAA $106F ;put control word into control register -$106F
BSR Delay40
Writing to ports is done by simply storing values to the memory addresses of the ports.
Modify the program in exercise 2 by lighting red LED to indicate closed door and green
LED to indicate open door.
.area text
_main::
;Initialisation
LDAA #$90 ;A ← control word $90
STAA $106F ;put control word into control register -$106F
BSR Delay40
0 5v signal
1
Port A 2
3
4
5
8255- 6
7
MC68HC11- 0 +
1
based µP 2
-
3
4
Port B
5
6 +
7
-
Figure 1
Exercise 4: Consider the application shown in Figure 2. Three traffic signal lights, green,
amber and red are to be controlled by the microprocessor over the 8255 PPI. The green
light is connected to pins (0,1) denoted by G, amber light is connected to pins (3,4)
denoted by A and the red light is connected to pins (6,7) denoted by R. For experiment
we used 3 LEDs. The green light will go on and stay on for some time. When green light
will go off, the amber will go on and stay on for some time. When the amber will go off,
the red will go on and stay for some time. The sequence will be repeated continuously.
Address of control register and port B are $106F and $106D respectively. Develop the
systems using 3 LEDs connected to ports of PPI 8255. Write an assembly language
program for the control problem.
Port B 0 -
8255- 1 G
MC68HC11-
2
3 - +
A
4
based µP 5
6 - +
7 R
+
Figure 2
0
1
Port A 2 switch
3
4
5
8255- 6
7
MC68HC11- 0
1
based µP 2
3
4
Port B
5
6
+
7
-
Figure 3
You need to submit exercises 4 and 5 with proper lab cover sheet. Demonstrate the
functioning system to demonstrator/module coordinator.