Keypad – Remote Processing CAMBASIC User Manual

Page 100

Advertising
background image

Comm ands - 67

KEYPAD$

Process Function

SYNTAX:

a$= KEYPA D$(0)
a= KEYPA D$(1)

PURPOSE:

To return a one– character string in response to a keypad input or return the position of the key.

REMARK S:

KEYPA D$(0) returns a single– character string that has been assigned to a key. It is most useful on
16– key devices . If no key was pr essed , or if you r ead the keyp ad again bef ore ano ther key is
pressed, a null string is returned.

KEYP AD$(1) r eturns the key position. Keypads often have legends that ar e not single letters. T hus,
the first syntax may not make sense. If no key was pressed, or if you read the keypad again before
another key is pressed, a zer o is returned.

A table in RAM can be progr amme d to return any A SCII value. The table is set up so that the first
character is in the upper– left– hand corner and the last character is in the lower– right– hand
corner. See SYS(8).

You can assign a single– character string to the keys in the following manner.

10 FOR X=0 TO 15
20 READ A$
30 POKE SYS(8)+X,ASC(A$)
40 NEXT
50 DATA 1,2,3,A,4,5,6,B,7,8,9,C,*,0,#,D

This examp le matches ma ny 16 position keypads.

RELATED:

O N K E Y P AD $ , I N P U T KE Y P A D $

EXAMPLES:

40 ON KEYPAD$ GOSUB..Key_interrupt
50 GOTO 50
60 ..Key_interrupt
70 PRINT KEYPAD$(0)
80 RETURN

The RPC-2350 requres an extra parameter (16 or 24) after KEYPA D$ to designate keypad size.

ERROR:

none

Advertising