The text of a manual · part 20 of 47
PDT 1100 Terminal Programmer's Guide: Chapter 10 Statement Reference, pages 171 to 180
Pages 171 to 180 of 413, from PDT 1100 Terminal Programmer's Guide
The original document is the PDF (3.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Symbol PDT-1100
Page 171
Statement Reference
KEY Statement Name: Key
Type: I/O Statement
Description Assigns a string or a control code to a function key; also defines a function key as the LCD backlight function on/off key. This statement also defines an M key as the trigger switch, shift key, or battery voltage display key.
Syntax Syntax 1 (Assigning a string or a control code to a function key) KEY keynumber, stringdata
Syntax 2 (Defining a function key as the backlight function on/off key) KEY backlightkeynumber, onduration
Syntax 3 (Defining an M key as the trigger switch, shift key, or battery voltage display key) KEY M keynumber,“TRG” (Trigger switch) KEY M keynumber,“SFT” (Shift key) KEY M keynumber,“BAT” (Battery voltage display key)
where: keynumber = A numeric expression which returns a value from
1 to 31, 33, and 38. stringdata = A string expression which returns up to two characters or a control code. backlightkeynumber = A numeric expression which returns a value from
1 to 31, 33, and 38. onduration = Keyword BL and a string expression which returns a value from 0 to 255. (BL0 to BL255) M Keynumber = 30, 31, 35
10-61
Page 172
PDT 1100 Terminal Programmer’s Guide
Notes Assigning a string or a control code to a function key KEY in Syntax 1 assigns a string or a control code specified by stringdata to a function key specified by keynumber. Pressing the specified function key generates the assigned string data or control code and then passes it to the user program as if each character is keyed in directly from the keyboard. !
! !
!
!
keynumber is a key number assigned to a particular function key. (Refer to Appendix E, Key Number Assignment on the Keyboard) Specifying 32 to keynumber is ignored. stringdata is a character code ranging from 0 (00h) to 255 (FFh). (For the character codes, refer to Appendix C, Character Sets) If you specify more than two characters to stringdata, only the first two characters are valid. String data inputted by pressing the specified function key may be read to the user program by INPUT or LINE INPUT statement or INKEY$ or INPUT$ function.
Note: INKEY$ or INPUT$ (1) function can read only the first one character of the assigned two. The second character remains in the keyboard buffer and can be read by the INPUT or LINE INPUT statement or INKEY$ or INPUT$ function. !
!
!
If pressed together with the Shift key, any numerical key can operate as a function key. If you issue more than one KEY statement specifying a same function key, the last statement takes effect. If a null string is assigned to a function key, pressing the function key produces no key entry. To make a particular function key invalid, specify a null string to stringdata as shown below. KEY 1,“” KEY 2,CHR$(0) KEY 3,CHR$(&h0)
Defining a function key as the LCD backlight function on/off key: KEY in Syntax 2 defines a function key specified by backlightkeynumber as the backlight function on/off key and sets the length of backlight ON-time specified by onduration. (Refer to Appendix I, Backlight Function)
10-62
Page 173
Statement Reference
!
backlightkeynumber is a key number assigned to a particular function key. (Refer to Appendix E, Key Number Assignment on the Keyboard) Pressing the specified backlight function on/off key activates or deactivates the backlight function.
!
Specifying zero (0) or 32 to backlightkeynumber is ignored.
!
Pressing the M1 key (key number 33) while holding down the shift key functions as the backlight on/off control key by default. If pressed together with the Shift key, any numerical key can operate as a function key. onduration is the length of time in seconds from when the backlight is turned on until it turns off. Pressing the trigger switch or any key (except for the backlight function on/off key) while the backlight is on resets the counter of onduration to the specified time length and restarts counting down. Specifying of BL0 disables the backlight function. Specifying of BL255 keeps the backlight on. A function key defined as the LCD backlight function on/off key cannot be used to enter string data. If you issue more than one KEY statement, the last statement takes effect. That is, if you define more than one key as the backlight function on/off key as shown below, only the function key numbered 8 operates as the backlight function on/off key and the length of backlight ON-time is 15 seconds.
!
!
!
!
KEY 5,“BL40” KEY 8,“BL15”
Defining an M key as the trigger switch, shift key, or battery voltage display key: !
KEY in syntax 3 defines an M key (M1/M2/M3/M4) as the trigger switch, shift key, or battery voltage display key as well as assigning string data. KEY 30,“TRG” (M1 key as the trigger switch) KEY 31,“SFT” (M2 key as the shift key) KEY 30,“BAT” (M1 key as the voltage display key)
Note: If you issue KEY instructions specifying a same function key, only the last KEY instruction takes effect. The description below, for example, makes the function key numbered 3 operate as the backlight function on/off key and the length of backlight ON-time is 100 seconds.
10-63
Page 174
PDT 1100 Terminal Programmer’s Guide
KEY 3,“a” KEY 3,“BL100”
The description below assigns string data “a” to the function key numbered 3. The default backlight function on/off key (the combination of M1 key and shift key) is restored. KEY 3,“BL100” KEY 3,“a”
The description below defines the M1 key as the trigger switch. The default battery voltage display key (combination of the ENT key and shift key) is restored. KEY 30,“BAT” KEY 30,“TRG”
Syntax Error Error Code and Message Meaning error 71: Syntax error keynumber is missing. stringdata is missing. backlightkeynumber is missing. stringdata is a numeric expression.
Execution Error Error Code
Meaning
05h
Parameter out of range (keynumber, backlightkeynumber, or M keynumber is out of range.)
Examples Syntax 1 KEY 1,“a” KEY 2,“F”+CHR$(13) KEY 3,“”
10-64
Page 175
Statement Reference
Syntax 2 KEY 1,“BL60”
Reference Statements
ON KEY...GOSUB, KEY ON and KEY OFF
10-65
Page 176
PDT 1100 Terminal Programmer’s Guide
KEY ON and KEY OFF Statement Name: Key On and Key Off
Type: I/O Statement
Description Enables or disables keystroke trapping for a specified function key.
Syntax KEY (keynumber){ON|OFF where: keynumber = A numeric expression which returns a value from 1 to 31,
33, and 38.
Notes KEY ON enables keystroke trapping for a function key specified by keynumber. (Refer to Appendix E, Key Number Assignment on the Keyboard) !
!
!
! !
!
10-66
Between execution of statements, the Interpreter checks whether a function key specified by the KEY ON statement is pressed or not. If the key is pressed, the Interpreter transfers control to the event-handling routine defined by an ON KEY...GOSUB statement before the KEY ON instruction. If a function key assigned a null string by the KEY statement is specified by the KEY ON statement, the keystroke trap takes place. If you specify a function key which has been defined as the LCD backlight function on/off key, trigger switch, shift key, or battery voltage display key by using the KEY ON statement, then no keystroke trap takes place. Keystroke trapping has priority over the INKEY$ function. When a program waits for the keyboard entry by the INPUT, LINE INPUT statement or INPUT$ function, pressing a function key specified by the KEY ON statement neither reads the pressed key data nor causes keystroke trapping. Specifying 32 to keynumber is ignored.
Page 177
Statement Reference
KEY OFF disables keystroke trapping for a function key specified by keynumber. !
Specifying 32 to keynumber is ignored.
Syntax Error Error Code and Message Meaning error 71: Syntax error keynumber is not enclosed in parentheses ( ).
Neither ON or OFF follows (keynumber).
Execution Error Error Code
Meaning
05h
Parameter out of range (keynumber is out of range.)
Reference Statements
KEY and ON KEY...GOSUB
10-67
Page 178
PDT 1100 Terminal Programmer’s Guide
KILL Statement Name: Kill
Type: File I/O Statement
Description Deletes a specified file from the memory.
Syntax Syntax 1 KILL “filename”
Syntax 2 KILL “drivename:filename” where: “filename” and “drivename:filename” = A string expression.
Notes KILL deletes a data file or a user program file specified by “filename” or “drivename:filename”.
The filename should be preceded by the drivename. The drivename is A: for RAM or B: for flash ROM. If the drivename is omitted, the default A: (RAM) applies. ! !
10-68
The specified file is deleted from both the data and the directory in the memory. A file to be deleted should be closed beforehand.
Page 179
Statement Reference
Syntax Error Error Code and Message Meaning error 3: “” missing
No double quote precedes or follows filename or drivename:filename.
error 71: Syntax error filename or drivename:filename is not enclosed in double quotes.
Execution Error Error Code
Meaning
02h
Syntax error (the format of “filename” or “drivename:filename” is not correct.)
35h
File not found.
37h
File already open.
Example CLOSE IF kyIn$=“Y” THEN KILL “Master.Dat” END IF
Reference Statements
CLFILE
10-69
Page 180
PDT 1100 Terminal Programmer’s Guide
LET Statement Name: Let
Type: Assignment Statement
Description Assigns a value to a given variable.
Syntax Syntax 1 [LET] stringvariable = stringexpression
Syntax 2 [LET] numericvariable = numericexpression
Description LET assigns a value of expression on the right-hand side to a variable on the left-hand side. !
!
!
10-70
In a numeric data assignment, the assignment instruction converts an integer value to a real value. In the type conversion from a real value to an integer value, it rounds off the fractional part. Keyword LET can be omitted since the equal sign is all that is required to assign a value. The data type of a variable and an expression must correspond.