Programming Manual Keyboard
SATO Europe
14
Execute downloaded BASIC program
Press FORM to list all the BASIC files stored in the K012 smart keyboard. The UP and
Down arrow keys are used to scroll files displayed in LCD screen. K012 also supports a
hot key feature to find the program. For example: If the program is named DEMO.BAS,
press FORM and then press D. The K012 scrolls the files to the first one that begins
with D automatically. Execute the selected program by pressing ENTER.
Keyboard
Programming Manual
15
SATO Europe
Using K012
By the end of this section, you will be able to
1. Edit a TSKL program file on a PC.
2. Download the program file to the K012.
3. Execute the program.
Edit A Program
To edit a program file, you need a plain text editor, for example: DOS Editor, Windows
Notepad or the enclosed K012 Windows software.
The following is an example of editing with a general text editor.
1. Open a new text file.
2. Add the header at the first line of the file as listed below:
DOWNLOAD “MYPROG.BAS”
Where “MYPROG.BAS” is the file name to be stored in keyboard memory.
3. Edit the program contents.
4. Insert a line of command at the end of program as below:
EOP
5. Save this file.
The advantages of using enclosed K012 Windows utility software is that users don’t have to
add header and end of program commands to the program file.
Download A Program
Users can download the program either by DOS commands or via the enclosed K012
Windows software.
Connect the PC and K012 together with the keyboard COM2 port.
Connect the K012 COM1 cable to the printer.
Download the program with DOS commands:
Enter the commands as below:
C:\> MODE COM2 96,N,8,1 (sets communications for COM2 of your PC )
C:\> COPY MYPROG.BAS /B COM2
Where MYPROG.BAS is the name of program file, COM2 is the serial port of
your PC.
Programming Manual Keyboard
SATO Europe
16
Download the program by K012 Windows software
Save the program file.
Select Utilities | Download File to download the program to the keyboard.
Note: 1. When downloading programs (*.BAS), please select BAS file extension in
the Download file dialog box.
2. The file name of downloaded file
A sharp short beep means the file has been downloaded to keyboard memory.
Execute A Program
Reset the K012 by pressing ALT-EXIT.
Press FORM to list program files.
Press
↑↑↑↑ and ↓↓↓↓ to select a program to execute.
If you want to interrupt the program, press ALT-EXIT.
Keyboard
Programming Manual
17
SATO Europe
Variables, Constants, Functions, Operators, and
Expressions
The information in this chapter will help you to learn about variables, constants, functions,
operators, and expressions in TSKL (Taiwan Semiconductor keyboard Language).
Variables and constants are manipulated by operators to form expressions.
Variables
Variables are placeholders used to store values. They have names and data types. The
data type of a variable determines how the bits representing those values are stored in
the computer's memory. When you declare a variable, you can also supply a data type for
it. All variables have a data type that determines what kind of data they can store.
The variable name in TSKL can vary from one to ten characters. The first character must be
a letter or an underscore with subsequent characters being letters, numbers, or underscore.
There are two categories of variables in TSKL: numeric data type and string data type.
TSKL supplies several numeric data types: long integer, float and double float.
The maximum numbers of variable available in one program are listed below:
200 long integer and float data type variables
100 double float data type variables
50 string data type variables
The range of data types in the system are listed below.
Data Type
Identifier
Byte
Range
Significant digits
Long integer
%
4
-2147483648 to 2147483647
10
Float
none
4
-9999999 to 9999999
7
Double float
#
8
-999999999999999 to
999999999999999
15
String
$
256
254 characters
N/A
Programming Manual Keyboard
SATO Europe
18
Long Integer Data Type Variables
The “%” identifier is used to declare a long integer variable by placing the “%” at the
end of variable name. For example, A% and SUM% are integer variables.
Float Data Type Variables
The default data type in TSKL is float data type. If no identifier is placed at the end of
variable name, the variable will be treated as float data type in the system. For
example, A and B are float variables. The precision of float data type is to 6 digits.
Double Float Data Type Variables
The “#” identifier is used to declare a double float variable by placing the “#” at the end
of variable name. For example, A# and SUM# are floating point variables. The
precision of double float data type is to 15 digits.
String Variables
The “$” identifier is used to declare a string variable by placing the “$” at the end of
variable name. For example, A$ and TITLE$ are string variables. Each string variable
can store 254 bytes of data.
System Variables
System variables are the data maintained by the K012. For example, Real Time Clock.
All the system variables are listed below:
YEAR
MONTH
DATE
HOUR
MINUTE
SECOND
IDNUMBER$
Dostları ilə paylaş: |