
Keyboard Scanner
This unit uses a 4
×
4 keyboard matrix, giving a total of 16 keys with each
key representing a single hexadecimal value as shown in the diagram. The
microcontroller program scans the keyboard matrix to detect which key
was pressed and after detection displays on the LED display the corre-
sponding hex code. There are 4 LEDs, so a range of values from 0000 to 1111
can be displayed. During the scanning process, if two keys are pressed
simultaneously only the first key scanned will be detected and displayed.
By using this method 8 logic lines can control up to 16 switches with
required values assigned to each key.
Circuit design
PA0~PA3 are assigned as outputs and PA4~PA7 assigned as inputs, to-
gether forming a 4
×
4 matrix. Note that during creation of the project,
PA4~PA7 should have the pull-high option selected from the mask option.
The program detects which key was pressed while a look up table defines
the value of each key. PB0~PB3 are defined as outputs and represent a 4
bit hex code giving 16 different values with each value representing a single
key.
Program
#include ht48c10.inc
;------------------------------------------------------------
data .section ’data’
;== data section ==
temp
db ?
;temporary data register
disp
db ?
;key display register
HT-IDE User’s Guide
192
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...