42
If the value of <expression> is zero or greater than the number of items in the
list, execution continues with the next executable statement. If the value of
<expression> is negative or greater than 255, an error message will be dis-
played.
ON KEY GOSUB Statement
Purpose:
Defines an interrupt service subroutine to handle specific key-
board input
Format:
ON KEY(<n>) GOSUB <line>
<n> is a numeric expression from one to eight indicating a spe-
cific key.
Example:
ON KEY 1 GOSUB 1000
Remarks:
An interrupt service routine cannot be interrupted by another interrupt. If a
new interrupt occurs during processing of a previous interrupt, branching to
handle the new interrupt will not take place until after the RETURN statement
of the first interrupt service routine is executed.
If a statement specified by the branch line number is non-executable, execu-
tion will begin with the first executable statement following the branch line
number.
If zero is specified as the branch line number, it is assumed that the KEY
OFF statement has been executed.
If the port number is omitted, port 1 is selected.
There should be only one ON KEY GOTO statement for each key number.
Key input will not be processed during execution of an assembly language
program.
The ON KEY GOSUB statement is enabled with the KEY ON statement and
disabled with the KEY OFF statement.
Program Example:
10
OPEN #1,“TERM:(42)”
20
ON KEY 1 GOSUB 100
30
ON KEY 2 GOSUB 200
40
ON KEY 3 GOSUB 300
50
KEY ON
100
PRINT A
110
RETURN
200
PRINT B
210
RETURN
300
PRINT C
310
RETURN
Program Remarks:
“A”, “B”, and “C” are displayed by pressing keys 1, 2, and 3, respectively. To
cancel the specification, write 0 as the branch destination.
ON KEY GOTO Statement
Purpose:
To branch program execution to a specified line number in re-
sponse to a specific key input
Format:
ON KEY<n> GOTO <line>
<n> is an integer in the range of 1 to 8.
BASIC Language
Section 4-2
Summary of Contents for SYSMAC C200H-ASC02
Page 1: ...Cat No W165 E1 04 ASCII Unit SYSMAC C200H ASC02 ...
Page 2: ...C200H ASC02 ASCII Unit Operation Manual Revised September 2002 ...
Page 3: ...iv ...
Page 5: ...vi ...
Page 7: ...TABLE OF CONTENTS viii Glossary 159 Index 163 Revision History 165 ...
Page 122: ...Appendix B Specifications 115 130 35 100 5 ...
Page 168: ...Cat No W165 E1 04 C200H ASC02 ASCII Unit OPERATION MANUAL ...