Вы находитесь на странице: 1из 7

MICROPROCESSORS

EXPERIMENT NO. 5

DATA TRANSMISSION THROUGH


KEYPAD

Name: Daniel Louis M. Parulan (Leader)


John Jacobsen Perez

Course/Section: CPE108L/E02

Group No.: 10

Date of Performance: June 25, 2020


Date of Submission:

__Prof. Cyrel O. Manlises__


Professor
PART ONE: KEYPAD SCANNING
Q1. Run the program to complete the table below.

Pressed Key Content of R0


0 0x00
1 0x01
2 0x02
3 0x03
4 0x04
5 0x05
6 0x06
7 0x07
8 0x08
9 0x09
10 0x0A
11 0x0B
Screenshot by Jacob Perez

Screenshot: Daniel Parulan 1


PART TWO: DATA TRANSMISSION THROUGH KEYPAD

Q1. Run the program to complete the table below.

Pressed Key LED output display (in Binary)


0 1111 1111
1 1111 1110
2 1111 1101
3 1111 1100
4 1111 1011
5 1111 1010
6 1111 1001
7 1111 1000
8 1111 0111
9 1111 0110
10 1111 0101
11 1111 0100

Q2. What instruction and where should it be added to display


the correct output in the LED? Explain why.

In order to display the correct output, the command CPL A should

be added in the gotKey between MOV A, R0 and MOV P1, A.

The reason for this is because the opcode CPL means complement

and this instruction will complement the contents of register A

before it will be displayed into the

LEDs.___________________
Q3. After the changes made in Part II question Q2, run the
program and complete the table below.

Pressed Key LED output display (in Binary)


0 0000 0000
1 0000 0001
2 0000 0010
3 0000 0011
4 0000 0100
5 0000 0101
6 0000 0110
7 0000 0111
8 0000 1000
9 0000 1001
10 0000 1010
11 0000 1011

Q4. What is the output of the program? Give at least 4 samples


and illustrate using a picture or a drawing with an
explanation.
Input is number 6 and

the display shows


binary of 00000110.

Keypad 1 is input and

the output displays

00000001.
Input value is 8 and the

display shows

00001000.
The pressed key is 7

and the output binary

shows 00000111.

Q5. Why do we need to clear the general-purpose flag F0?


What will be the effect of not clearing the F0?

The general-purpose flag F0 serves as an indicator for

whenever a key is pressed. This means that whenever a key is

pressed, F0 will be set. Then if we clear F0, it will let the

program reset F0 to indicate another key press. If F0 is not


cleared, the program will not accept new key presses because

it cannot detect whenever a new key has been pressed.