You are on page 1of 9

MICROPROCESSORS

EXPERIMENT NO. 5

DATA TRANSMISSION THROUGH


KEYPAD

Name: Roseus, Aldous Vernon D.

Course/Section: ECEA105L_E01

Group No.:

Date of Performance: 23/06/21


Date of Submission: 30/06/21

Engr. Isagani Villamor


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 0x10

11 0x11

PART TWO: DATA TRANSMISSION THROUGH KEYPAD

Q1. Run the program to complete the table below.


Pressed Key LED output display (in Binary)
0 11111111
1 11111110
2 11111101

3 11111100

4
11111011

5 11111010

6 11111001

7 11111000

8
11110111

9 11110110

10 11110101

11 11110100

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


the correct output in the LED? Explain why.
A CPL command is required to display the right output in
the LED. If this isn't present, the LED's display will be
inverted, meaning that if the output was supposed to be
00000001, the display will be 11111110. Between the MOV
A, R0, and MOV P1 in the function gotKey, the command
CPL A will be appended. The output is inverted into its
bitwise complement form, resulting in the actual LED.
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 00000000
1 00000001
2 00000010
3 00000011
4 00000100
5 00000101
6 00000110
7 00000111
8 00001000
9 00001001
10 00001010
11 00001011

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


and illustrate using a picture or a drawing with an
explanation.
Figure 1: Pressed key 1 Output 00001010
Figure 2: Pressed key 5 Output 00001001

Figure 3: Pressed key 8 Output 00001000

Figure 4: Pressed key 7 Output 00000111


Q5.
Why
do we need to clear the general-purpose flag F0? What will
be the effect of not clearing the F0?

Because this allows the value of the new output to be


displayed in the LEDs whenever another key is hit, the
general-purpose flag F0 should be cleared. The purpose of the
general-purpose flag F0 is to indicate which key has been
pushed. The cached value will be displayed instead of the new
input data if the F0 is not cleared.
DISCUSSION
The data transmission using keypad experiment, the fifth,
tries to put the concepts outlined in experiments 3 and 4 into
practice. Demonstrate how the instruction set can be used to
control the keypad. Finally, the keypad was demonstrated in
action and how it may be interfaced with different
peripherals. In light of the fact that a 4x3 keypad connects in a
standard format. The students were given two exercises:
keypad scanning and data transmission through the keypad
itself. Because it was simply scanning the data contained in
R0, the initial step was straightforward and quick. Each key is
scanned, and R0 is incremented if no key is pressed. When a
key is pressed, the R0 stores a value that can be seen. The
contents of R0 were inspected after pressing each key. This
appears to be increasing from 1 to 11 for each pushed key.
The data transmission through the keypad is the subject of the
next section. The key pressed in the keypad was displayed on
the LED display. The commands were similar to those used in
part 1, although there were a few differences. JMP $ was
replaced with JMP start.
In the subroutine gotKey, further commands were introduced.
Between the SET B F0 and the RET, these were placed. The
LED displayed values once the software was assembled and
run. This is the key that was pressed in the program. As a
result, the command CPL A was added to show the correct
binary equivalent of the pressed key.
CONCLUSION
Following the analysis of the data, the following findings
were reached:

 Each key corresponds to a unique value in the R0


register.
 Each key is associated with a binary value that can be
displayed on the LED display.
 Adding the command CPL A to the command line will
display the right binary values.
 •The general-purpose flag F0 causes the display to output
the LED's new value.

You might also like