You are on page 1of 6

EKT 222

MICROPRESSOR SYSTEM

LAB 4 Extra : INTERFACING


WITH OTHER I/O DEVICES
EKT222 Miroprocessor Systems Lab 4 Extra

LAB 4 Extra: Interfacing with


Other IO devices
Objectives:
1) Ability to create advance program instructions
2) Ability to use branching instructions
3) Ability to execute and demonstrate the program instructions
4) Ability to analyze the 8085 register and memory map conditions

Equipments :
1. Computer station with Windows OS and MY1 8085 simulation program
2. 8085 Instruction Sets (Assembly Code)
3. 8085 Instruction Sets (Machine Code)

Introduction
The 8085 simulator program MY1 Sim85, has several built-in input output
graphical user interfaces (GUIs) developed for the users practice. Although not
exactly accurate as in the actual hardware input and output devices, but these
graphical interfaces do offer the user some added value demonstration materials in
understanding their program further. One can especially observe their simulation
program and analyze on any assembly code improvements.

Table 1 below lists out the available IO GUIs and its operating procedures:

No GUI Device Panel Description

1 8 LEDs (output) & 8 LEDs aligned in one row in one panel. There are two
panels available. The horizontal panel and the vertical
panel. Each LED requires logic HIGH to illuminate.
Direct usage bit to LED representation.

2 8 switches (input) 8 push-pull type switches aligned in one row. When in


pushed-up condition (red color), it gives logic LOW and
when pulled-down (blue color), it gives logic HIGH.
Direct bit to switch representation.

3 8 pushbuttons (input) 8 pushbuttons in one panel. When depressed (red


color) gives logic LOW and when pressed (blue color)
gives logic HIGH. Direct bit to button representation.

1
UniMAP
EKT222 Miroprocessor Systems Lab 4 Extra

4 7-segment LED 7-segment LED active high panel. Requires 8-bit data to
(output) send and operate the desired segment. Direct pin to
LED representation.

5 4x4 Keypad (input) 16 button panel using the 4x4 matrix. Using 5-bit
signals, 2 bit column, 2 bit row and one bit
acknowledge sent into the processor. The
acknowledge signal, DA will assert (logic HIGH) upon
valid keypress together with the 4x4 bit matrix data.
The data will stay present after the key is released until
another key is pressed.

DA - Data Acknowledge
D3 & D2 - 2-bit ROW data (00 ~ 11)
D1 & D0 - 2-bit COLUMN data (00 ~ 11)

Table 1 : My1 Sim85 IO Panels

In this extra lab activity, students will be demonstrated on


1. How to display data onto the 7-segment LED
2. How to use the 4x4 keypad

2
UniMAP
EKT222 Miroprocessor Systems Lab 4 Extra

LABORATORY TASK

Part A : INTERFACING THE 7-SEGMENT LED

Given below is a sample program on how to display a BCD counter on a 7-segment


LED. Take note of the string of data sent to PORT A.

ORG 0000H
LXI SP,3FF0H ; stack memory setting
PORTA: EQU 80H ; set 80H with a name
PORTB: EQU 81H ;
PORTC: EQU 82H ;
CTRL: EQU 83H ;

MVI A,80H ; set the port directions


OUT CTRL ; send to control register
AGAIN: MVI B,10 ; create an internal counter at B
LXI H,TABLE ; set HL with memory pointer
COUNT: MOV A,M ; get data from memory pointer
OUT PORTA ; send out to 7-segment
MVI C,20 ; create a delay value at C
DELAY: DCR C ; decrease C
JNZ DELAY ; jump to delay if C 0
INX H ; if C = 0 then increase HL
DCR B ; decrease B counter
JNZ COUNT ; if B 0, continue count up
JMP AGAIN ; if B = 0 reset B counter
HLT

TABLE: DFB 00111111B, 00000110B, 01011011B, 01001111B, 01100110B


DFB 01101101B, 01111101B, 00000111B, 01111111B, 01101111B

As you can see, the Tables 8-bit values were prepared to illuminate the necessary
LED segments.

3
UniMAP
EKT222 Miroprocessor Systems Lab 4 Extra

Part B : INTERFACING THE KEYPAD

Given below is a sample program to display the BCD value of a keypad on the 7-
segment LED. Values above 9 will cause the 7-segment LED to display Error. Take
note of the string of data sent to PORT A.

ORG 0000H
LXI SP,4000H
PORTA: EQU 80H
PORTB: EQU 81H
PORTC: EQU 82H
CTRL: EQU 83H

MVI A,10000010B ; Port A (output), Port B (input)


OUT CTRL
MVI A,00H ; clear 7-segment
OUT PORTA
CHECK1: IN PORTB ; check for valid key press
ANI 10H
JZ CHECK1
CHECK2: IN PORTB ; check for valid key release
ANI 10H
JNZ CHECK2

LXI H,DATA ; set HL with memory pointer


MVI B,0 ; set B register with 00H
IN PORTB ; get keypad data
MOV C,A ; copy to C register
DAD B ; add HL with BC contents & store in HL
MOV A,M ; get data from new HL memory pointer
OUT PORTA ; display to 7-segment
JMP CHECK1 ; jump to check1
HLT

DATA: DFB 00000110B, 01011011B, 01001111B, 01111001B


DFB 01100110B, 01101101B, 01111101B, 01111001B
DFB 00000111B, 01111111B, 01101111B, 01111001B
DFB 01111001B, 00111111B, 01111001B, 01111001B

As you can see, the program will check if a key is pressed (DA=1) before that key is
released (DA=0). This process will justify a valid keystroke.

4
UniMAP
EKT222 Miroprocessor Systems Lab 4 Extra

EXERCISE

1. Create a program that will display the BCD value of a 4-bit switch on a 7-
segment LED. Use the BCD data string table from the Laboratory Task as
reference.

2. The BCD counter in Laboratory Task Part A counts on every clock pulse
supplied by the simulator software. Recreate the program so that the counter
will count on every clock pulse pressed by a PUSH BUTTON.

3. Create a program that will blink an LED according to the count of the keypad
value. For example if the key 5 is pressed, then the LED will blink 5 times
AFTER a PUSH BUTTON is pressed.

4. Create an up-down BCD counter with the following sequence :


0 -> 1 -> 2 -> -> 8 -> 9 -> 8 -> 7 -> -> 2 -> 1 -> 0

5. Create a program that will store 4 digits and then display the digits in
sequence on a 7-segment LED.

6. Using 2 push-pull switches, create a program that will fulfill the following
operation :
a. 00 the 7-segment displays 0 only
b. 01 the 7-segment will do a BCD continuous up count
c. 10 the 7-segment will do a BCD continuous down count
d. 11 the 7-segment will pause counting

5
UniMAP