Motion Coordinator Technical Reference Manual
Programming Examples 9-3
Example Programs
Example Programs
1 - Fetching an Integer Value from the Membrane Keypad
The subroutine “getnum” fetches an integer value from the membrane keypad in
variable “num”. The routine prints the number on the display bottom line at cur-
sor position 70, although this can be set to other values. Only the number keys,
the “CLR” key and the ENTER key are used. Other keys are ignored.
' Demonstrate integer number entry via Membrane Keypad:
getnum: pos=70
num=0
PRINT#4,CHR(20);
REPEAT
PRINT#4,CURSOR(pos);num[6,0];
GET#4,k
IF k=69 THEN GOTO getnum
IF k>=59 AND k<=61 THEN k=k-7
IF k>=66 AND k<=68 THEN k=k-17
IF k=71 THEN k=48
IF k>47 AND k<58 THEN
k=k-48
num=num*10+k
ENDIF
UNTIL k=73
RETURN
Example 2 - Fetching a Real Value from the Membrane Keypad
This similar routine also fetches a number from the membrane keypad, but this
number can have up to 2 decimal places. Note how this example uses the emu-
lated keypad from Motion Perfect.
getnum:
pos=40
dpoint=0
num=0
negative=1
PRINT#5,CHR(20);
REPEAT
PRINT#5,CURSOR(pos);num*negative[8,2];