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
Содержание HT-IDE
Страница 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Страница 12: ...HT IDE User s Guide 2 ...
Страница 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Страница 24: ...HT IDE User s Guide 14 ...
Страница 70: ...HT IDE User s Guide 60 ...
Страница 76: ...HT IDE User s Guide 66 ...
Страница 92: ...HT IDE User s Guide 82 ...
Страница 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Страница 94: ...HT IDE User s Guide 84 ...
Страница 148: ...HT IDE User s Guide 138 ...
Страница 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Страница 154: ...HT IDE User s Guide 144 ...
Страница 192: ...HT IDE User s Guide 182 ...
Страница 194: ...HT IDE User s Guide 184 ...
Страница 218: ...HT IDE User s Guide 208 ...
Страница 235: ...P a r t V Appendix Part V Appendix 225 ...
Страница 236: ...HT IDE User s Guide 226 ...
Страница 250: ...HT IDE User s Guide 240 ...