KeypadRaw

Syntax:

    largevar = KeypadRaw

Command Availability:

Available on all microcontrollers.

Explanation:

This function will return a 16 bit value, in which each bit corresponds to a key on the keypad. If the key is pressed its bit will hold 1, and if it is released its bit will contain a 0.

This table shows the key that each bit corresponds to:

Bit Key Position (row, col) Common Key Symbol

15

1,1

1

14

1,2

2

13

1,3

3

12

1,4

A

11

2,1

4

10

2,2

5

9

2,3

6

8

2,4

B

7

3,1

7

6

3,2

8

5

3,3

9

4

3,4

C

3

4,1

*

2

4,2

0

1

4,3

#

0

4,4

D

Example:

    'Program to show the keypad status using LEDs
    #chip 16F877A, 20

    'Keypad connection settings
    #define KeypadPort PORTB

    'LEDs
    #define LED1 PORTC
    #define LED2 PORTD
    Dir LED1 Out
    Dir LED2 Out

    'Declare a 16 bit variable for the key value
    Dim KeyStatus As Word

    'Main loop
    Do
        'Get key
        KeyStatus = KeypadRaw

        'Display
        LED1 = KeyStatus_H 'High Byte
        LED2 = KeyStatus 'Low Byte
    Loop

For more help, see Keypad Overview