CEG 3136
Lab 2: Hardware Interfacing - Keypad
Fall 2019
Students:
Purpose | 3
Equipment | 3
Part One: | 3
Problem | 3
Input/Outputs of Problem | 3
Algorithm | 3
Implementation | 8
Testing | 8
Part two
...
CEG 3136
Lab 2: Hardware Interfacing - Keypad
Fall 2019
Students:
Purpose | 3
Equipment | 3
Part One: | 3
Problem | 3
Input/Outputs of Problem | 3
Algorithm | 3
Implementation | 8
Testing | 8
Part two: | 8
Problem | 8
Input/Outputs of Problem | 8
Algorithm | 9
Implementation | 9
Testing and Validation | 10
Conclusion: | 10
Purpose
The purpose of this lab was to introduce the interfacing of the Motorola 9S12DG256
through an implementation of a keypad unit.
Equipment
-Windows PC
-Dragon12 board
Part One:
Problem
The task was to implement KeyPad.asm which would be used to communicate with the
touchpad on the Dragon12 board. This code is used to take the inputs done on the touchpad by
the user and associate them with a numerical value in ASCII code corresponding to the
character pressed.
Input/Outputs of Problem
The input was the key pressed on the touchpad by the user while the outputs were the
corresponding ASCII of the key to be used by the program
Algorithm
The first function in the algorithm is pollReadKey which is used to check if a key has been
pressed or not, which allows the program to check if a key has been pressed without a key
necessarily being pressed. This is different from the readKey() function which waits for a key to
be pressed, instead this function checks if a key has been pressed, then if pressed it will return
the key character and if not it will return NOKEY which has value 0.
Part two:
Problem
We were tasked to create a subroutine, delayms which implements a delay based on the
number of milliseconds specified by the numerical value of the input given.
Input/Outputs of Problem
This delayms function was used for the debouncing problem for the keys. The input to the
function was the time in ms, which was used to associate the amount that was wished to be
delayed. This function did not have an actual output but the result of it causes a delay to be
used in different situations.
Conclusion:
From this lab we concluded that user input can be read from a touchpad by using modular code
along with subroutines and in order to overcome challenges such as key debouncing additional
software scanning techniques must be implemented. We also noticed that if a subroutine is
created for some purpose, new code can be implemented very easily by reusing your previous
code
[Show More]