Programming Manual
Keyboard
SATO Europe
50
END
Description
Terminates the program execution.
Syntax
END
Remarks
END statement may be placed anywhere in a program to terminate the execution.
With the END statement, all variables will be released from memory and file handles
closed.
Example
END
Keyboard
Programming Manual
51
SATO Europe
DIM
Description
An array is a collection of variables of the same type, referenced by a common name.
The DIM statement is used to declare the array variables of integer, float and double
float data types. The lowest address corresponds to the first element, and the highest
address to the last element. A specific element in an array is accessed by an index.
Syntax
DIM variable (subscripts)[, variable (subscripts), …]
Remarks
The base of an array index always begins from 0. For example, DIM A(10) there are,
in total, 11 elements of variable A (0 to 10).
Do not declare a duplicate array in the program without executing the FREE
statement.
The DIM statement sets all the elements of specified arrays to the following initial
values: numbers to zero and strings to null string.
The total number of array elements (no matter what kind of data type) cannot exceed
than 200 elements.
The maximum array variable name is 10 characters.
The maximum dimensions of an array variable is 3.
Example
DIM A(20)
Programming Manual Keyboard
SATO Europe
52
FREE
Description
Eliminates array variables from memory.
Syntax
FREE
dimension variable
Remarks
Arrays can be re-dimensioned after they are freed, or the memory space previously
allocated to the array may be used for other purposes. If an attempt is made to
re-dimension an array without first freeing it, an error occurs.
Example
FREE A
Keyboard
Programming Manual
53
SATO Europe
REM
Description
Inserts explanatory remarks in a program.
Syntax
REM comments
Remarks
REM statements are not executed.
Example
REM *** this is an example ***
Programming Manual Keyboard
SATO Europe
54
TSKL Functions
POS()
Description
Gets the current position of the cursor in the LCD display.
Syntax
POS()
Remarks
This function returns the value between 0~79.
Example
Cur_pos = POS()
Keyboard
Programming Manual
55
SATO Europe
INKEY()
Description
To return the ASCII code of the character read from keyboard. The returned ASCII
code will not show on LCD display.
Syntax
INKEY( )
Remarks
All tasks are pending until a key is pressed.
Example
A=INKEY( )
Programming Manual Keyboard
SATO Europe
56
INP$()
Description
To return one byte received from a serial port.
Syntax
INP$(expression)
Remarks
The result of the expression must be numeric. (0 or 1)
0: COM1 (Serial port with cable on K012)
1: COM2 (Serial port mount on K012)
The returned value is a string
Example
A$=A$ + INP$(0)
Keyboard
Programming Manual
57
SATO Europe
EOF()
Description
To return nonzero when the end of a file has been reached, or to return 0 if the end of
file (EOF) has not been found.
Syntax
EOF(file number)
Remarks
If file pointer
points to the end of the file, EOF returns non-zero.
Example
OPEN “DATA” FOR INPUT AS #1
C=0
Repeat:
IF EOF(1)>0 THEN GOTO end_of_file
READ #1;A
C=C+1
GOTO Repeat
End_of_file:
END
Programming Manual Keyboard
SATO Europe
58
LOF()
Description
To return the size of a file.
Syntax
LOF(FileHandle)
Remarks
An integer is returned
to indicate the size of file
Example
File_length = LOF(1)