ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 12.06.2025
Просмотров: 8205
Скачиваний: 1
© MCS Electronics, 1995-2007
Partial Example
Dim P as Word
P = GetdstPORT(i)' store current port number of socket i
GETKBD
Action
Scans a 4x4 matrix keyboard and return the value of the key pressed.
Syntax
var = GETKBD()
Remarks
Var |
The numeric variable that is assigned with the value read |
from the keyboard |
|
The GETKBD() function can be attached to a port of the uP.
You can define the port with the CONFIG KBD statement.
A schematic for PORTB is shown below
Note that the port pins can be used for other tasks as well. But you might need to set the port direction of those pins after you have used getkbd(). For example the LCD pins are set to output at the start of your program. A call to getkbd() would set the pins to input.
By setting DDR.x register you can set the pins to the proper state again. As an alternative you can use CONFIG PIN or CONFIG PORT.
When no key is pressed 16 will be returned.
When using the 2 additional rows, 24 will be returned when no key is pressed.
On the STK200 this might not work since other hardware is connected too that nterferesi.
You can use the Lookup() function to convert the byte into another value. This because the GetKBD() function does not return the same value as the key pressed. It willdepend on which keyboard you use.
page -508-