background image

Programming Manual                                                      Keyboard

 

SATO Europe 

46

 

 

WHILE…WEND 

Description 

To execute a series of statements in a loop until the given condition is 

false

 

Syntax 

WHILE expression 

statements 

WEND 

 

Remarks 

If the expression is true the program will be executed until the WEND statement is 

encountered, then return to the WHILE statement to check again. After encountering a 

false condition, the program will branch to the statement following the WEND. 

 

The total numbers of WHILE…WEND statement in one program can not exceed 40. 

The maximum numbers of IF…THEN…ELSE, FOR…NEXT, WHILE…WEND, and 

DO…LOOP available in one program is up to 40.  

 

Example 

A=10 

WHILE A 

A=A-1 

PRINT “12345678” 

WEND 

Summary of Contents for Smart Keyboard

Page 1: ...SATO Smart Keyboard Programming manual...

Page 2: ...om Email info sato europe com SATO AMERICA INC 10350 Nations Ford Road Suite A Charlotte NC 28273 Tel 1 704 644 1650 Fax 1 704 644 1662 Website www satoamerica com Email satosales satoamerica com SATO...

Page 3: ...information contained herein is subject to change without notice Reproduction of this manual either in part or its entirety is forbidden Note that the manufacturer assumes no responsibility for any in...

Page 4: ...E 12 ON LINE EDITING UTILITY 12 EXTENDED FILE MANAGER 13 EXECUTE DOWNLOADED BASIC PROGRAM 14 USING K012 15 EDIT A PROGRAM 15 DOWNLOAD A PROGRAM 15 EXECUTE A PROGRAM 16 VARIABLES CONSTANTS FUNCTIONS OP...

Page 5: ...22 ESC W 23 SOUND 24 CLS 25 CLEAR 26 CURSOR 27 LOCATE 28 PRINT USING 29 INPUT 30 OUT 31 FOUT 32 OUT USING 33 DOWNLOAD 34 EOP 35 OPEN 36 CLOSE 37 KILL 38 SEEK 39 READ 40 WRITE 41 GOSUB RETURN 42 LOOP S...

Page 6: ...60 LEN 61 FRE 62 INT 63 VAL 64 RND 65 CHR 66 FREAD 67 LEFT 68 RIGHT 69 MID 70 STR 71 SPC 72 SYSTEM VARIABLES 73 YEAR 73 MONTH 74 DATE 75 HOUR 76 MINUTE 77 IDNUMBER 79 APPENDIX A LIMITATIONS OF TSKL 8...

Page 7: ...emonic representations of ASCII control characters Square brackets the data within square brackets is optional Ctrl Bold letters represent a key on the keyboard Ctrl C Two keys with a dash means to pr...

Page 8: ...Real Time Clock Y2K compatible Built in Euro logo ASCII 176 177 Floating point calculation Password security locking Auto execution function Specifications Keyboard Unit Size 261mm L 142 2mm W 31mm H...

Page 9: ...interface COM1 is a 9 pin male D style subminiature connector with cable The pin assignments are shown below Pin Configuration 1 Power input 5 volts 250mA 2 RxD 3 TxD 4 DTR 5 Ground 6 DSR 7 RTS 8 CTS...

Page 10: ...he container according to the list below if any parts are missing please contact your local representative K012 keyboard unit K012 User s Manual 25 pin to 9 pin RS 232 converter 2 screws for SI thread...

Page 11: ...n function This should be done prior to keyboard configuration setup on line editing initialization and extended file manager utilities if an auto execution file is downloaded in the keyboard Keyboard...

Page 12: ...r as well as handshaking to download or upload data DATE TIME SETUP The built in Real Time Clock is compatible with year 2000 The leap year timing is automatic The available setting of year is from 19...

Page 13: ...033 French France 034 Spanish Spain 036 Hungarian 038 Yugoslavian 039 Italian 041 Switzerland 042 Slovak 044 United Kingdom 045 Danish 046 Swedish 047 Norwegian 048 Polish 049 Germany 055 Brazil 061 E...

Page 14: ...being upgraded UPDATE FAIL will show on the LCD screen Turn off the power and enter Upgrade mode again If the upgrade process is successful K012 will boot automatically On Line Editing Utility The On...

Page 15: ...BASIC files stored in Flash memory will also be listed in the BASIC program file list by pressing FORM ERASE FILES This utility delete all the files stored in Flash memory The KILL command can t delet...

Page 16: ...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 a...

Page 17: ...ame 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 sof...

Page 18: ...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 m...

Page 19: ...t 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 lette...

Page 20: ...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 float...

Page 21: ...to TSKL Functions Numeric Functions Numeric functions include integral functions and floating point functions For example INT ASC String Functions String functions include string conversion and strin...

Page 22: ...ns can be integral expressions or floating point expressions depending on the calculation value In integral expressions floating point operands will be converted to integer and vice versa String Expre...

Page 23: ...tatements Commands instruct K012 to work accordingly Sometimes commands followed by one or several parameters For example INPUT A For more information refer to TSKL Commands A statement is composed of...

Page 24: ...ope 22 TSKL Commands ESC R Description This command is used to reset the keyboard The keyboard will search for an AUTO BAS auto execution program as the first after reset Syntax ESC R Remarks ESC is A...

Page 25: ...ATO Europe ESC W Description This command is used to upgrade the firmware The keyboard will enter BIOS upgrade mode after receiving this command and disable the execution of any AUTO BAS program Synta...

Page 26: ...ND Description Turn the speaker on at the specified frequency and interval Syntax SOUND frequency interval Where Frequency 0 15 Interval 0 65535 msec Remarks N A Example FOR F 0 TO 15 FOR I 0 TO 65535...

Page 27: ...Keyboard Programming Manual 25 SATO Europe CLS Description Clears the LCD display Syntax CLS Remarks CLS clears the LCD and places the cursor in the upper left corner At position 0 0 Example CLS...

Page 28: ...Programming Manual Keyboard SATO Europe 26 CLEAR Description Remove all the declared variables arrays and opened files in the program from memory Syntax CLEAR Remarks N A Example CLEAR...

Page 29: ...ription Selects cursor appearance Syntax CURSOR mode Remarks The available modes for the cursor are listed below 0 Hides the cursor 1 Block with blinking cursor 2 Fixed Underline cursor 3 Block blinki...

Page 30: ...E moves the cursor to the given position in LCD display If the coordinates are invalid the command will be ignored The permissible value of the x parameter is from 0 to 79 The permissible values of th...

Page 31: ...e is no expression after the PRINT command The PRINT USING command sends hex 0D 0A carriage return and line feed at the end of the expression if no semicolon is at the end of the expression The comma...

Page 32: ...ariables Remarks Prompt must be a string constant The variable list contains the variable names to be assigned The input value will pass to the variable if ENTER is pressed Other input devices such as...

Page 33: ...s the serial port to send data It can be 0 K012 COM1 or 1 K012 COM2 The List of Expressions consists of string or numeric expressions separated by semicolons The OUT command sends 0D0A carriage return...

Page 34: ...file from the K012 serial port Syntax FOUT Port FileHandle FileSize Remarks Port specifies the serial port to send data It can be 0 K012 COM1 or 1 K012 COM2 The number of FileHandle is between 0 and14...

Page 35: ...pecifies the K012 serial port to send data It can be 0 K012 COM1 or K012 COM2 port List of expressions consists of string or numeric expressions separated by semicolons The OUT USING command sends 0D0...

Page 36: ...OWNLOAD FILENAME BAS File contents EOP Data file DOWNLOAD FILENAME FILESIZE DATA FILE Remarks Filename may be up to 8 characters with a 3 character extension The extension for program files must be BA...

Page 37: ...O Europe EOP Description End of program This keyword must be placed at the end of a program file if the DOWNLOAD keyword is used in the program Syntax EOP Remarks N A Example Program file DOWNLOAD DEM...

Page 38: ...o the beginning of the file and this file is read only If the file does not exist the File not found error is displayed on LCD display OUTPUT Position to the beginning of the file and this file is wri...

Page 39: ...Keyboard Programming Manual 37 SATO Europe CLOSE Description To clear file handles Syntax CLOSE FileHandle Remarks FileHandle must be a constant number with which the file is opened Example CLOSE 1...

Page 40: ...Syntax KILL filename KILL KILL Remarks Filename can be any file in the memory Wild card supports all files The file must be closed before deleting Example KILL DEMO BAS Note KILL cannot be used to de...

Page 41: ...SATO Europe SEEK Description Reposition a file pointer in a specified file buffer Syntax SEEK FileHandle offset Remarks Offset is the number from the beginning of file to the new position Example OPEN...

Page 42: ...tion Read data from a data file and assign them to variables Syntax READ FileHandle list of variables Remarks FileHandle specifies the file to read data from The variables store the data read from the...

Page 43: ...E Description Write data to an opened file Syntax WRITE FileHandle list of expressions Remarks FileHandle specifies the file to write data to The variables are used to write data to opened data file E...

Page 44: ...position in the program The available maximum label name is 20 characters A return statement will cause the program return to the statement following the GOSUB statement The total number of GOSUB RET...

Page 45: ...e DO LOOP FOR NEXT WHILE WEND DO EXITDO LOOP Description Use a DO loop to execute a block of statements an indefinite number of times There are several variations of DO LOOP statement but each evaluat...

Page 46: ...pe 44 Remarks The total number of DO LOOP statement in one program cannot exceed 40 The maximum number of IF THEN ELSE FOR NEXT WHILE WEND and DO LOOP statements available in one program is 40 Example...

Page 47: ...ts NEXT variable Remarks I J K are numeric expressions I the initial value of the counter J the final value of the counter K The increment of the counter If the K parameter is ignored the default incr...

Page 48: ...will be executed until the WEND statement is encountered then return to the WHILE statement to check again After encountering a false condition the program will branch to the statement following the W...

Page 49: ...ied block of statements Syntax GOTO label Remarks Label is a tag to mark a specified position in the program The Label name is limited to a maximum of 20 characters The total number of GOTO statement...

Page 50: ...be separated into two categories IF THEN IF THEN ELSE IF THEN ELSE Description Use an IF THEN block to execute one or more statements conditionally You can use either a single line syntax or multiple...

Page 51: ...statement following the ELSE is present it will be executed Otherwise the next line of statement is executed If there are block of statements in IF THEN ELSE ENDIF must be used at the end of the IF T...

Page 52: ...D 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 fro...

Page 53: ...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 ar...

Page 54: ...rom 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 i...

Page 55: ...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...

Page 56: ...ing 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...

Page 57: ...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 ke...

Page 58: ...tion 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...

Page 59: ...ile 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 IN...

Page 60: ...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...

Page 61: ...Keyboard Programming Manual 59 SATO Europe ABS Description To return the absolute value of the expression Syntax ABS expression Remarks The result of the expression must be numeric Example X ABS 5 12...

Page 62: ...ual Keyboard SATO Europe 60 ASC Description To return the value of the ASCII code for the first character of the expression Syntax ASC expression Remarks The result of the expression must be a string...

Page 63: ...Keyboard Programming Manual 61 SATO Europe LEN Description To return the length of the string Syntax LEN string expression Remarks The maximum returned string length is 255 Example X LEN A...

Page 64: ...ing Manual Keyboard SATO Europe 62 FRE Description Return the size of free memory Syntax FRE Remarks Calculates and returns an integer to indicate free memory size of the K012 in K Bytes Example A FRE...

Page 65: ...Keyboard Programming Manual 63 SATO Europe INT Description To truncate an expression to an integral number Syntax INT expression Remarks The result of the expression must be numeric Example A INT 5 2...

Page 66: ...ramming Manual Keyboard SATO Europe 64 VAL Description To return the numerical value of the string expression Syntax VAL expression Remarks The result of the expression must be a string Example A VAL...

Page 67: ...Keyboard Programming Manual 65 SATO Europe RND Description RND returns a number between 0 and 1 Syntax A RND Remarks N A Example A RND...

Page 68: ...66 CHR Description To return the ASCII character of the numerical expression Syntax CHR expression Remarks The result of the expression must be numeric Example A CHR 27 Used for example to send and ES...

Page 69: ...SATO Europe FREAD Description To read a number of bytes from specified file Syntax FREAD FileHandle count Remarks Count is the number of data bytes Maximum count size is 255 Example OPEN DATA FOR INPU...

Page 70: ...EFT Description To return a number of the leftmost characters of the string expression Syntax LEFT expression count Remarks The result of the expression must be a string Count is the number of the lef...

Page 71: ...GHT Description To return a number of the rightmost characters of the string expression Syntax RIGHT expression count Remarks The result of the expression must be a string Count is the number of the r...

Page 72: ...e specified length Syntax MID String Starting Length Remarks String Can be a string or expression Start Character position in string at which the part to be taken begins If start is greater than the n...

Page 73: ...rope STR Description Returns a string representation of a number Syntax STR expression Remarks The result of the expression must be a numeric Note STR function cannot be included in other functions Ex...

Page 74: ...gramming Manual Keyboard SATO Europe 72 SPC Description To insert a number of spaces in a string Syntax SPC expression Remarks The result of the expression must be numeric Example PRINT PRICE SPC 5 12...

Page 75: ...on Sets and returns the year of the Real Time Clock The YEAR variable may be set from 00 to 99 The returned data is a 4 digit number Ex 1998 2001 Syntax YEAR nn Where nn 00 99 A YEAR Remarks The Real...

Page 76: ...amming Manual Keyboard SATO Europe 74 MONTH Description Sets and returns the month of the Real Time Clock Allowable numbers are 01 to 12 Syntax MONTH nn Where nn 01 12 A MONTH Remarks N A Example MONT...

Page 77: ...anual 75 SATO Europe DATE day Description Sets and returns the date of the Real Time Clock Allowable numbers are from 00 to 99 Syntax DATE nn Where nn 01 31 A DATE Remarks The leap year timing is auto...

Page 78: ...amming Manual Keyboard SATO Europe 76 HOUR Description Sets and returns the hour of the Real Time Clock Allowable numbers are from 00 to 23 Syntax HOUR nn Where nn 00 23 A HOUR Remarks N A Example HOU...

Page 79: ...rogramming Manual 77 SATO Europe MINUTE Description Sets and returns the minute of the Real Time Clock Allowable numbers are from 00 to 59 Syntax MINUTE nn Where nn 00 59 A MINUTE Remarks N A Example...

Page 80: ...g Manual Keyboard SATO Europe 78 SECOND Description Sets and returns the second of the Real Time Clock Allowable numbers are from 00 to 59 Syntax SECOND nn Where nn 00 59 A SECOND Remarks N A Example...

Page 81: ...cription IDNUMBER is read only at run time The ID number can be set in the Setup Utility With password locked ON users cannot change the ID number The factory default is T S C Syntax A IDNUMBER Remark...

Page 82: ...riables 100 double float data type variables 50 string data type variables The maximum number of characters for a variable name is 10 The maximum number of characters for a label name is 20 The availa...

Page 83: ...thout IF IF THEN ELSE statement without IF keyword 07 FOR without NEXT FOR NEXT statement without NEXT keyword 08 NEXT without FOR FOR NEXT statement without FOR keyword 09 EXITFOR without FOR FOR NEX...

Page 84: ...e variable does not assigned value in the program 24 Array not defined The accessed array does not exit 25 Out of string space The string is longer than 254 bytes 26 Too many variables The number of v...

Page 85: ...sion too complex Arithmetic expression is too complex 35 Duplicate array Duplicate declare array variable 36 Out of memory There is no t enough memory for download program or data file 37 Too many fil...

Page 86: ...TSC CLEVER COM1 COM1 Note 1 COM1 Note 2 COM2 COM2 COM2 Pin 1 CD 5V 5V 5V 5V 5V Pin 2 RXD RXD TXD TXD RXD TXD Pin 3 TXD TXD RXD RXD TXD RXD Pin 4 DTR DTR DSR DSR NC DSR Pin 5 GND GND GND GND GND GND Pi...

Page 87: ...g NC NC 5V 0 25A 5V 1A 10 Reserved for Data Set Testing NC NC 5V 0 25A NC 11 Unassigned NC NC NC NC 12 Secondary Carrier Detect NC NC NC NC 13 Secondary Clear to Send NC NC NC NC 14 Secondary Transmit...

Page 88: ...ting NC 5V NC NC 11 Unassigned NC NC NC NC 12 Secondary Carrier Detect NC NC NC NC 13 Secondary Clear to Send NC To Be Left Unused NC NC 14 Secondary Transmitted Data 5V 0 1A To Be Left Unused NC NC 1...

Page 89: ...pgrade keyboard BIOS Power on with ALT CLEAR Keyboard initialization Power on with ALT D Extended file manager utility Keyboard Utilities FORM Select BASIC files to execute ENTER Execute the selected...

Page 90: ...Programming Manual Keyboard SATO Europe 88...

Page 91: ...ype Variables 19 DOWNLOAD 36 Download A Program 16 Edit A Program 16 END 52 EOF 59 EOP 37 Execute A Program 17 Execute downloaded BASIC program14 Expressions 21 Extended file manager 14 Features of K0...

Page 92: ...uick Start 6 READ 42 Relational Expressions 21 Relational Operators 20 REM 55 RIGHT 71 RND 67 Safety Regulation 9 SECOND 80 SEEK 41 SOUND 25 SPC 74 Specifications 7 STR 73 String Expressions 21 String...

Page 93: ......

Reviews: