Copyright © DENSO CORPORATION, 2000 All rights reserved. No part of this publication may be reproduced in any form or by any means without permission in writing from the publisher. Specifications are subject to change without prior notice. All products and company names mentioned in this manual are trademarks or registered trademarks of their respective holders. BHT, CU, BHT-protocol, BHT-Ir protocol, and BHT-BASIC are trademarks of DENSO CORPORATION.
Preface This manual describes the syntax and development procedure of BHT-BASIC 3.5 which is a programming language for developing application programs of the BHT-3000/BHT-4000/BHT5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500 Bar Code Handy Terminals. It is intended for programmers who already have some experience in BASIC programming. For the basic description about the BASIC language, refer to documentations concerning Microsoft BASIC® or QuickBASIC®.
How this book is organized This manual is made up of 18 chapters and appendices. Chapter 1. Software Overview for the BHT Surveys the software structure of the BHT and introduces the programs integrated in the ROM and the language features of BHT-BASIC. Chapter 2. Development Environment and Procedures Describes hardware and software required for developing application programs and the developing procedure. Chapter 3.
Chapter 13. LCD Backlight Function Describes the LCD backlight function Chapter 14. Statement Reference Describes the statements available in BHT-BASIC, including the error codes and messages. Chapter 15. Function Reference Describes the functions available in BHT-BASIC, including the error codes and messages. Chapter 16. Extended Functions Describes the extended functions newly added in the BHT-7000/BHT-7500. Chapter 17.
■ Notational Conventions Used in This Book Several notational conventions are used in this book for the sake of clarity. 1. Reserved words are printed in UPPERCASE. These are BHT-BASIC’s keywords. You should not use them as label names or variable names. Example: CHAIN, GOSUB, and ABS 2. Parameters or arguments which should be specified in the statements or functions are expressed in italics. Example: characode and onduration 3. Items enclosed in square brackets [ ] are optional, which can be omitted.
■ Icons Used in This Book Statements and functions unique to BHT-BASIC. ■ Syntax for the Statement Reference and Function Reference The syntax in programming is expressed as shown in the example below.
■ Technical Terms Used in This Manual Compiler and Interpreter The BHT-BASIC Compiler, which is a development tool, is expressed as Compiler. The BHT-BASIC Interpreter, which runs in the BHT, is expressed as Interpreter. Source Program and Object Program (User Program) Generally, a source program is translated into an object program by a compiler. This manual calls an object program a user program. Easy Pack Easy Pack is an application program suitable for data collection.
■ ■ Abbreviations ANK AlphaNumerics and Katakana BASIC Beginners All purpose Symbolic Instruction Code BCC Block Check Character BHT Bar code Handy Terminal CTS (CS) Clear To Send (RS-232C signal control line) CU Communications Unit I/F Interface I/O Input/Output LCD Liquid Crystal Display LED Light-Emitting Diode MOD Modulo MS-DOS Microsoft-Disk Operating System RAM Random Access Memory ROM Read Only Memory RTS (RS) Request To Send (RS-232C signal control line) VRAM Video R
Chapter 1 Software Overview for the BHT CONTENTS 1.1 Software Overview........................................................................................... 2 1.1.1 Software Structure of the BHT ............................................................. 2 1.1.2 Overview of BHT-BASIC ...................................................................... 7 1.2 BHT-BASIC...................................................................................................... 8 1.2.1 Features ...........
1.1 Software Overview 1.1.1 Software Structure of the BHT The structure of software for the BHT is shown below. ■ BHT-3000 User data User programs RAM ROM Easy Pack Application programs System Mode System programs BHT-BASIC Interpreter Drivers Hardware When downloaded, user programs will be stored in the RAM. Other programs reside in the ROM.
Chapter 1. Software Overview for the BHT ■ BHT-4000 User data User programs RAM (User area) Application programs RAM (System area) System Mode BHT-BASIC Interpreter System programs Drivers ROM ROM system Hardware Of all the system programs, the drivers, BHT-BASIC Interpreter, and System Mode will be stored in the system area of the RAM when downloaded. The ROM system resides in the ROM. User programs downloaded will be stored in the user area of the RAM.
■ BHT-5000/BHT-6000/BHT-6500 RAM or flash ROM Application programs User data User programs Extension libraries Flash ROM System Mode System programs BHT-BASIC Interpreter Font files Drivers Hardware The BHT-5000/BHT-6000/BHT-6500 has a flash ROM and RAM. In the flash ROM reside the drivers, BHT-BASIC Interpreter, System Mode, and font files. Extension libraries and user programs will be stored in the user area of the RAM (or in the flash ROM) when downloaded.
Chapter 1. Software Overview for the BHT ■ BHT-7000/BHT-7500 Flash ROM User data User programs Application programs Extension libraries and extended functions System Mode System programs BHT-BASIC Interpreter Font files Drivers Hardware The BHT-7000/BHT-7500 has a flash ROM and RAM. All of the system programs, user programs, extension libraries, and extended functions are stored in the flash ROM. The RAM is used to run those programs efficiently.
System Programs Drivers A set of programs which is called by the BHT-BASIC Interpreter or System Mode and directly controls the hardware. The drivers include the Decoder Software used for bar code reading. BHT-BASIC Interpreter Interprets and executes user programs and Easy Pack commands. System Mode Sets up the execution environment for user programs or Easy Pack. ROM System (BHT-4000) Required for downloading the system programs listed above to the BHT-4000.
Chapter 1. Software Overview for the BHT 1.1.2 Overview of BHT-BASIC With BHT-BASIC, you can customize application programs for meeting your specific needs as given below. • Retrieving products names, price information, etc. in a master file. • Making a checking procedure more reliable with check digits in bar code reading. • Improving the checking procedure by checking the number of digits entered from the keyboard. • Calculating (e.g., subtotals and totals).
1.2 BHT-BASIC 1.2.1 Features BHT-BASIC is designed as an optimal programming language in making application programs for the bar code handy terminal BHT, and to enable efficient program development, with the following features: ■ Syntax Similar to Microsoft™ BASIC BHT-BASIC uses the BASIC language which is the most widely used one among the high-level languages. The syntax of BHT-BASIC is as close as possible to that used in Microsoft BASIC (MS-BASIC).
Chapter 1. Software Overview for the BHT 1.2.2 What’s New in BHT-BASIC 3.5 Upgraded from BHT-BASIC 3.0? Based on BHT-BASIC 3.0, BHT-BASIC 3.5 newly supports the following functions: [ 1 ] Compiler ■ Object linkage editor, Linker While BHT-BASIC 3.0 Compiler compiles a single source program into a single user program, BHT-BASIC 3.
■ Defining and declaring user-defined functions more easily BHT-BASIC 3.5 has added FUNCTION…END FUNCTION, SUB...END SUB, and DECLARE statements. With the former two, you may easily define your own functions—FUNCTION and SUB. With the latter one, you may declare FUNCTION and SUB functions which are defined in any other source files. ■ Distinction between local variables and global variables (defined by PRIVATE and GLOBAL statements) BHT-BASIC 3.
Chapter 1. Software Overview for the BHT 1.3 Program Development and Execution BHT-BASIC consists of Compiler and Interpreter. 1.3.1 Compiler BHT-BASIC 3.5 Compiler consists of the following Compiler, Linker and Librarian: ■ Compiler Compiler, which is one of the development tools, compiles source programs written on a PC into the resulting "object files." It checks syntax of source programs during compilation and makes an error file if any syntax error is found.
Chapter 2 Development Environment and Procedures CONTENTS 2.1 Overview of Development Environment ........................................................ 14 2.1.1 Required Hardware ............................................................................ 14 2.1.2 Required Software.............................................................................. 15 2.2 Overview of Developing Procedures ............................................................. 16 2.2.1 Developing Procedures ...........
Chapter 2. Development Environment and Procedures [ 1 ] Compiling options...................................................................... 33 [ 2 ] Linking options .......................................................................... 34 [ 3 ] Outputting debug information files............................................. 34 [ 4 ] Outputting list files ..................................................................... 35 [ 5 ] Outputting a mapfile ...............................................
2.1 Overview of Development Environment The following hardware and software are required for developing user programs: 2.1.1 Required Hardware ■ Personal computer Use a computer operating with Windows95/98 or WindowsNT4.0/Windows2000. ■ BHT (Bar code handy terminal) Any of the following BHTs is required: • BHT-3000 • BHT-4000 • BHT-5000 • BHT-6000 • BHT-6500 • BHT-7000 • BHT-7500 ■ CU (Optical communications unit) For optical communications, any of the following CUs is required.
Chapter 2. Development Environment and Procedures 2.1.2 Required Software • OS Windows95/98 or WindowsNT4.0/Windows2000 • Editor • BHT-BASIC 3.5 Compiler BHTC35W.EXE (Integrated environment manager) BHT35CPL.DLL (Compiler) BHT35LNK.DLL (Linker) • Transfer Utility (option) BHT35LIB.DLL (Librarian) BHTC35W.MSG (Error message file) TU3.EXE (MS-DOS–based) TU3W.EXE (16-bit Windows-based) TU3W32.EXE (Windows-based) • Ir-Transfer Utility C (option) IT3C.EXE (MS-DOS–based) IT3CW32.
2.2 Overview of Developing Procedures 2.2.1 Developing Procedures The program developing procedures using BHT-BASIC 3.5 are outlined below. • Making source programs Make source programs with an editor according to the syntax of BHT-BASIC. • Producing a user program (compiling and linking) Compile the source programs into object programs by BHT-BASIC Compiler.
Chapter 2. Development Environment and Procedures 2.2.2 Functions of BHT-BASIC 3.5 BHT-BASIC 3.5 contains Compiler, Linker, and Librarian whose functions are listed below. Functions of Compiler Description Syntax check Detects syntax errors in source programs. Output of object files Translates source programs into object files and outputs them. Output of debug information Outputs list files and debug information files required for debugging.
2.3 Writing a Source Program 2.3.1 Writing a Source Program by an Editor To write a source program, use an editor designed for operating environments where the BHTBASIC 3.5 Compiler will execute. The default editor is Windows Notepad. TIP To write a source program efficiently, use of a commercially available editor is recommended. For the operation of such an editor, refer to the instruction manual for the editor. 2.3.
Chapter 2. Development Environment and Procedures • Comment lines starting with a single quotation mark (') and those with a REM should have the following description rules each. A single quotation mark (') can be put starting from the 1st or the following columns, or immediately following any other statement. A REM should be put starting from the 2nd column or the following columns. To put a REM following any other statement, a colon (:) should precede the REM.
2.4 Producing a User Program 2.4.1 Starting the BHT-BASIC 3.5 Compiler Start the Compiler, e.g., by choosing the "BHTC35W.EXE" from the Windows Explorer or the "BHT-BASIC 3.5" registered to the Start menu. Menu bar Tool bar Main window The BHT-BASIC 3.
Chapter 2. Development Environment and Procedures 2.4.2 Outline of User Program or Library Production Procedure Unlike the BHT-BASIC 3.0 Compiler that converts a single source program into a user program (file named XXX.PD3), the BHT-BASIC 3.5 Compiler converts source programs into object programs (files named XXX.OBJ) and then links those object programs to produce a user program (XXX.PD3). A sequence of the compiling and linking processes is called "Build." The BHT-BASIC 3.
2.4.3 Designating a Single Source File or a Project File 2.4.3.1 Designating a single source file Just as in the conventional BHT-BASIC 3.0 Compiler, you may designate a single source file to build a user program or library. [ 1 ] Select a source file (1) In any of the following methods, display the Open File dialog box shown below: ■ From the File menu, choose the Open command. ■ Click the open file button in the toolbar. ■ While holding down the Ctrl key, press the O key.
Chapter 2. Development Environment and Procedures 2.4.3.2 Designating a project file To build a library out of a single source file or to build a user program or library out of multiple source files, you need to create a project file (described in [ 1 ] later) or select an existing project file (in [ 2 ]). You may add files or delete existing files to/from the designated project file (described in [ 3 ] and [ 4 ], respectively).
[ 2 ] Select an existing project file You may select an existing project file in the Select Project File dialog box or in the Open File dialog box. Selecting in the Select Project File dialog box (1) In any of the following methods, display the Select Project File dialog box shown below: ■ From the File menu, choose the Open Project command. ■ Click the open project button (yellow) in the toolbar. ■ While holding down the Ctrl key, press the P key.
Chapter 2. Development Environment and Procedures [ 3 ] Add files to a project file You may add one or more source files and libraries to a project file. (1) Create a new project (Refer to [ 1 ] in this subsection) or select an existing project file to which you want to add files (Refer to [ 2 ] in this subsection). (2) In either of the following methods, display the Add File(s) dialog box shown below: ■ From the Project menu, choose the Add File command. ■ Click the add file button in the toolbar.
[ 4 ] Select files in the active project From files existing in the active project, you may select files that you want to compile or build. (1) In either of the following methods, display the Project Configuration Files dialog box shown below: ■ From the Project menu, choose the Select File command. ■ Click the select file button TIP (red) in the toolbar.
Chapter 2. Development Environment and Procedures • Main Object This display area shows the name of a main object in a user program if you have selected "User program (PD3)" with the "Type of File to be Created" selection button. If you have selected "Create library (LIB)," nothing will appear on this area. • Type of File to be Created Lets you select whether you create a user program (PD3) or library (LIB). • Add File button Adds the currently selected files to the active project.
2.4.4 Compiling and Building First specify the options and then proceed to the compiling or building process. [ 1 ] Specifying the compiling and linking options (1) In either of the following methods, display the Set Options dialog box shown below: ■ From the Tools menu, choose the Options command. ■ Click the option button in the toolbar. (2) Select the check boxes of the options you want to specify. For details about the options, refer to Subsection 2.4.7.
Chapter 2. Development Environment and Procedures [ 2 ] Compiling In any of the following methods, compile the currently selected source file(s) into an object file(s): ■ From the Build menu, choose the Compile command. ■ In the Project Configuration Files dialog box, click the Compile button. (For details about the Project Configuration Files dialog box, refer to Subsection 2.4.3.2, [ 4 ].) ■ Click the compile start button in the toolbar. ■ While holding down the Ctrl key, press the G key.
2.4.5 Setting the Editor for Displaying Files Set the editor that you want to use for displaying source files and error message files (XXX.ERR) according to the steps below. (1) From the Tools menu, choose the Set Editor command. The Set Editor dialog box appears as shown below. (2) In the Command line edit box, type the filename of the editor. If the editor is not located in the current directory or working directory, type the absolute path or relative path. (The default editor is Windows NotePad.
Chapter 2. Development Environment and Procedures 2.4.6 Error Messages and Their Indication onto the Main Window [ 1 ] Selecting either an editor or main window as an error message output device According to the procedure below, you may select whether error messages should be outputted to an editor or main window if an error message file (XXX.ERR) is produced. (1) From the Tools menu, choose the Options command. The Set Options dialog box appears as shown below.
[ 2 ] How error messages are displayed on the editor or main window During building, the BHT-BASIC 3.5 Compiler may detect errors which can be divided into two types: syntax errors and fatal errors. ■ Syntax errors If the Compiler detects a syntax error, it outputs the error message to the XXX.ERR file. For details about the file, refer to Subsection 2.4.9, "Output from the BHT-BASIC 3.5 Compiler.
Chapter 2. Development Environment and Procedures 2.4.7 Options To specify compiling options and linking options, select the check-box options you want in the Set Options dialog box. Each of available options is explained below. [ 1 ] Compiling options Compiling Options Debug information file Description Outputs debug information files (XXX.ADR, XXX.LBL, and XXX.SYM files). If this option is not selected, no debug information file will be outputted. (default) (For details, refer to [ 3 ].
[ 2 ] Linking options Linking Options Mapfile Description Outputs map information to the file XXX.MAP. If this option is not selected, no map information will be outputted. (default) (For details, refer to [ 5 ] in this subsection.) [ 3 ] Outputting debug information files If you select the "Debug information file" check box in the Set Options dialog box and run the Compiler, then the Compiler will output three types of debug information files.
Chapter 2. Development Environment and Procedures [ 4 ] Outputting list files The Compiler may output three types of list files as listed below depending upon the options specified at the start of compiling, in order to help you program and debug efficiently. List File Option Filename Extension Address-source list Symbol table Cross reference Select the Address-source List check box. Select the Symbol table check box. Select the X (Cross) reference check box. .
• Address of object program in intermediate language Shows an intermediate language address corresponding to a source program line in four-digit hexadecimal notation. • Line number in source program Shows a line number for a source program statement in four-digit decimal notation. • Source program statement Shows the same content as a statement written in a source program.
Chapter 2. Development Environment and Procedures • Symbol table for common variables Lists common variables arranged according to their types. An array variable has a suffix of parentheses ( ). • Symbol table for work variables Lists work variables and dummy arguments arranged according to their types. An array variable has a suffix of parentheses ( ). • Symbol table for register variables Lists register variables arranged according to their types. An array variable has a suffix of parentheses ( ).
■ Cross reference Select the X (Cross) reference check box and run the Compiler, and the following information will be outputted: • For common variables Outputs line numbers where common variables are defined and referred to. • For work variables Outputs line numbers where work variables and dummy arguments are referred to. • For register variables Outputs line numbers where register variables are defined and referred to. • For labels Outputs line numbers where labels are defined and referred to.
Chapter 2. Development Environment and Procedures [ 5 ] Outputting a mapfile Select the Mapfile check box of the Linking Options in the Set Options dialog box and build a user program, and the mapfile as shown below will be outputted. The mapfile will be given the same name as the project file and annexed with an extension .MAP.
• Map for user-defined functions Shows the symbols of user-defined functions in the Interpreter which are arranged according to their types (i.e., integer, real, and string types). If no user-defined functions are used, this item will not be outputted. • Map for variables and object codes Shows the addresses of variables and object codes in a user program.
Chapter 2. Development Environment and Procedures 2.4.8 Starting the BHT-BASIC Compiler from the Command Line You may start the BHT-BASIC Compiler from the command line in the MS-DOS Prompt of Windows95/98 or WindowsNT4.0/Windows2000. [ 1 ] Syntax At the MS-DOS command prompt, type in the following format: BHTC35W [options] [[directorypath]filename…][options] directorypath You may specify either an absolute path or relative path.
[ 2 ] Options The BHT-BASIC 3.5 Compiler supports three types of options—compiler processing options, compiling options, and linking option. ■ Compiler processing options Processing options Description +C Compiles one or more designated file(s) into object file(s). +B programname Builds a user program with the specified program name. If no programname is specified, the filename specified first will apply. +BL libraryname Builds a library with the specified library name.
Chapter 2. Development Environment and Procedures ■ Compiling options Compiling options Description +D Outputs debug information files (XXX.ADR, XXX.LBL. and XXX.SYM files). (Same as you select the Debug information file check box in the Set Options dialog box. Refer to Subsection 2.4.7, [ 1 ].) +L Outputs an address-source list to the file XXX.LST. (Same as you select the Address-source List check box in the Set Options dialog box. Refer to Subsection 2.4.7, [ 1 ].
[ 3 ] Error Level Indication by ERRORLEVEL If you specify a +E option at the command line and run the BHT-BASIC 3.5 Compiler, the ERRORLEVEL of MS-DOS allows the Compiler to set the compiling end status to the MS-DOS environmental variable ERRORLEVEL after completion of processing, as any of the error levels listed below. By referring to this ERRORLEVEL, you can learn the compiling end status. ERRORLEVEL 0 1 2 4 5 6 7 8 9 10 20 21 30 40 70 99 Description Normal end No designated file or path found.
Chapter 2. Development Environment and Procedures 2.4.9 Output from the BHT-BASIC 3.5 Compiler The BHT-BASIC 3.5 Compiler outputs the following information as well as object programs to the destination depending upon the conditions. Output Destination Conditions Object file File XXX.OBJ (in the directory where the source program is located) When the specified source program has been normally compiled without occurrence of a compiling error. User program File YYY.
Output Destination If the Address-source List check box is selected in the Set Options dialog box. Address–Source list Symbol table Conditions File XXX.LST (in the directory where the source program is located) Cross reference If the Symbol table check box is selected in the Set Options dialog box. If the X (Cross) reference check box is selected in the Set Options dialog box. Sizes of variables File XXX.ERR (in the directory where the source program is located) or File YYY.
Chapter 2. Development Environment and Procedures 2.4.10 Structure of User Programs and Libraries If you specify a user program to be produced in the Project Configuration Files dialog box, the BHT-BASIC 3.5 Compiler produces a user program provided that no compiling error or link error occurs. The user program file will be given the same name as the project file and annexed with an extension .PD3.
2.5 Downloading 2.5.1 Overview of Transfer Utility/Ir-Transfer Utility C/ Ir-Transfer Utility E Transfer Utility/Ir-Transfer Utility C/Ir-Transfer Utility E transfers user programs and data files (e.g., master files) between the BHT and the connected personal computer.
Chapter 2. Development Environment and Procedures 2.5.2 Setting up the BHT ■ BHT-3000 If the error message "Report to the personnel in charge (x)" appears, it is necessary to initialize the BHT before downloading user programs. The above error message appears in any of the following cases: • The BHT is first powered on from the time of purchase. • The BHT is powered on after being left without batteries (main and sub) loaded for a long time.
■ BHT-5000/BHT-6000/BHT-6500 If the error message given below appears, it is necessary to initialize the BHT before downloading user programs. "System error ! Contact your administrator. Note the error drive. (DRIVE x)" The above error message appears in any of the following cases: • The BHT is first powered on from the time of purchase. • The BHT is powered on after being left without main battery loaded for a long time.
Chapter 2. Development Environment and Procedures 2.6 Executing a User Program 2.6.1 Starting To run a user program, start System Mode and select the desired program in the Program Execution menu. If you have selected a user program as an execution program in the Setting menu of System Mode, the BHT automatically runs the user program when powered on. For the operating procedure of System Mode, refer to the BHT’s User’s Manual. 2.6.
Chapter 3 Program Structure CONTENTS 3.1 Program Overview ......................................................................................... 53 3.1.1 Statement Blocks ............................................................................... 53 [ 1 ] Subroutines ............................................................................... [ 2 ] Error-/Event-handling Routines ................................................. [ 3 ] User-defined Functions ........................................
Chapter 3. Program Structure 3.1 Program Overview 3.1.1 Statement Blocks A statement block is a significant set of statements (which is also called "program routine"). The following types of statement blocks are available in programming for the BHT: Statement Blocks Description Subroutine A routine called by the GOSUB statement. Error-/event-handling routine An error-/event-handling routine to which control is passed when an error trap or event (of keystroke) trap occurs, respectively.
[ 3 ] User-defined Functions Before calling user-defined functions, it is necessary to define those functions with any of the following statements. Generally, those statements should be placed before the main routine starts. DEF FN (in single-line form) DEF FN...END DEF (in block form) SUB...END SUB FUNCTION...END FUNCTION When using SUB and FUNCTION functions written in other files, it is necessary to declare them with the DECLARE statement before calling them.
Chapter 3. Program Structure 3.1.2 Notes for Jumping into/out of Statement Blocks It is not recommended to jump control from a main routine or subroutines into the midst of significant statement blocks or to jump out from the midst of those statement blocks, using the GOTO statement. Statement Blocks Jump into Jump out Subroutine ✕ ✕ Error-/event-handling routine ✕ ✕ Block-format user-defined function ✕ ✕ Block-structured statement ✕ ▲ ✕ : To be avoided. A run-time error may occur.
3.2 Handling User Programs 3.2.1 User Programs in the Memory The user area of the memory (memories) in the BHT can store more than one user program. (For details about memories, refer to Appendix F, "Memory Area.") If you have selected one of those programs as an execution program in the Setting menu of System Mode, the BHT automatically runs the user program when powered on. For the operating procedure of System Mode, refer to the BHT’s User’s Manual. 3.2.
Chapter 3. Program Structure 3.2.3 Included Files "Included files" are separate source programs which may be called by the INCLUDE metacommand. Upon encounter with the INCLUDE metacommand in a source program, the Compiler fetches the designated included file and then compiles the main source program while integrating that included file to generate a user program. You should specify the name of an included file by using the REM $INCLUDE or ’$INCLUDE.
Chapter 4 Basic Program Elements CONTENTS 4.1 Structure of a Program Line........................................................................... 59 4.1.1 Format of a Program Line .................................................................. [ 1 ] Labels........................................................................................ [ 2 ] Statements ................................................................................ [ 3 ] Comments ...............................................
Chapter 4. Basic Program Elements 4.1 Structure of a Program Line 4.1.1 Format of a Program Line A program line consists of the following elements: [label] [statement] [:statement] ... [comment] • label A label is placed at the beginning of a program line to identify lines. • statement A statement is a combination of functions, variables, and operators according to the syntax. A group of the statements is a program. • comment You may describe comments in order to make programs easy to understand.
[ 2 ] Statements Statements can come in two types: executable and declarative statements. • Executable statements They make the Interpreter process programs by instructing the operation to be executed. • Declarative statements They manage the memory allocation for variables and handle comments. Declarative statements available in BHT-BASIC are listed below.
Chapter 4. Basic Program Elements 4.1.2 Program Line Length A program line is terminated with a CR code by pressing the carriage return key. The allowable line length is basically 512 characters excluding a CR code placed at the end of the line. In either of the following two description ways, however, you can write a program line of up to 8192 characters: In the samples below, symbol "↓" denotes a CR code entered by the carriage return key. • Extend a program line with an underline (_) and a CR code.
4.2 Usable Characters 4.2.1 Usable Characters Listed below are characters which can be used for writing programs. Note that a double quote (") cannot be used inside a character string. Symbols | and ~ inside a character string will appear as ↓ and → on the LCD of the BHT, respectively. If used outside of a character string, symbols and control codes below have special meaning described in Subsection 4.2.2. • Alphabet letters Including both the uppercase and lowercase letters (A to Z and a to z).
Chapter 4. Basic Program Elements 4.2.
Symbols and control codes : (Colon) ; (Semicolon) [] (Square brackets) {} (Braces) # (Pound sign) Typical use • Separates statements. • Separates time information in TIME$ function. Line feed control character in INPUT and other statements. • Define the length of a string variable. • Define the string length of the returned value of a string userdefined function. Define the initial value for an array element. • File number prefix in OPEN, CLFILE, FIELD, and other statements.
Chapter 4. Basic Program Elements 4.3 Labels A label can contain the following characters: • Alphabet characters • Numeral characters • Period (.) ■ Rules for naming labels • The label length should be limited to 10 characters including periods. • A program can contain up to 9999 labels. • Label names make no distinction between uppercase and lowercase letters. The following labels, for example, will be treated as the same label.
4.4 Identifiers Identifiers for the names of variables should comprise the same alphanumerics as the labels. ■ Rules for naming identifiers • The identifier length should be limited to 10 characters including periods and excluding $ (dollar sign) and % (percent sign) suffixes. • Every type of variables can contain up to 255 identifiers. • A reserved word cannot be used by itself for an identifier name, but can be included within an identifier name.
Chapter 4. Basic Program Elements 4.5 Reserved Words "Reserved words" are keywords to be used in statements, functions, and operators. For the reserved words, refer to Appendix B, "Reserved Words." ■ Rules for using reserved words • A reserved word cannot be used by itself for a label name, a variable name, or other identifiers, but can be included within them.
Chapter 5 Data Types CONTENTS 5.1 Constants....................................................................................................... 69 5.1.1 Types of Constants ............................................................................ 69 [ 1 ] String Constants........................................................................ 69 [ 2 ] Numeric Constants.................................................................... 69 5.2 Variables................................................
Chapter 5. Data Types 5.1 Constants 5.1.1 Types of Constants A constant is a data item whose value does not change during program execution. Constants are classified into two types: string constants and numeric constants. Constant Example String constants "ABC", "123" Numeric constants Integer constants In decimal notation In hexadecimal notation Real constants 123%, -4567 &HFFF, &h1A2B 123.45, -67.
■ Real Constants Real constants should be formatted as shown below. Syntax: sign mantissa Syntax: sign mantissa E sign exponent Where a lowercase letter "e" is also allowed instead of uppercase letter "E." mantissa is a numeric string composed of a maximum of 10 significant digits. It can include a decimal point. If included in a real constant as shown below, a comma (,) for marking every three digits will cause a syntax error.
Chapter 5. Data Types 5.2 Variables A variable is a symbolic name that refers to a unit of data storage. The contents of a variable can change during program execution. 5.2.1 Types of Variables according to Format Variables are classified into two types: string variables and numeric variables, each of which is subclassified into non-array and array types.
■ Memory Occupation A string variable occupies the memory space by (the number of characters + one) bytes, where the added one byte is used for the character count. That is, it may occupy 2 to 256 bytes. If a non-array string variable consisting of 20 characters is declared, for example, it will occupy 21-byte memory space. [ 2 ] Numeric Variables • Non-array integer variables A non-array integer variable should be formatted with an identifier followed by a percentage sign (%) as shown below.
Chapter 5. Data Types 5.2.2 Classification of Variables ■ Work Variables A work variable is intended for general use. You may use it either by declaring with the DIM statement as a non-array variable or without declaration as an array variable. The following examples show work variables: DIM a(10),b%(5),c$(1) d=100:e%=45 FOR count% = s1% TO s2% NEXT count% At the start of a user program, the Interpreter initializes all of the work variables to zero (0) or a null character string.
5.3 User-defined Functions Out of user-defined functions, the SUB and FUNCTION functions can be called from other files. The DEF FN function can be called only in the file where that function is defined and should start with an FN.
Chapter 5. Data Types 5.4 Type Conversion 5.4.1 Type Conversion BHT-BASIC has the type conversion facility which automatically converts a value of one data type into another data type during value assignment to numeric variables and operations; from a real number into an integer number by rounding off, and vice versa, depending upon the conditions.
5.4.2 Type Conversion Examples The following examples show the type conversion from real to integer. ■ Assignment of Real Expressions to Integer Variables When assigning the value of the real expression (right side) to the integer variable (left side), the Interpreter carries out the type conversion. Syntax: integervariable = realexpression Example: b% = 123.45 Where b% will become 123.
Chapter 6 Expressions and Operators CONTENTS 6.1 Overview........................................................................................................ 78 6.2 Operator Precedence .................................................................................... 79 6.3 Operators....................................................................................................... 81 6.3.1 Arithmetic Operators .......................................................................... 6.3.
6.1 Overview An expression is defined as a combination of constants, variables, and other expressions which are connected using operators. There are two types of expressions--numeric expressions and string expressions. BHT-BASIC has the following types of operators: Operators Description Arithmetic operator Performs arithmetic operations. Relational operator Compares two values. Logical operator Combines multiple tests or Boolean expressions into a single true/false test.
Chapter 6. Expressions and Operators 6.2 Operator Precedence When an expression contains more than one operator, BHT-BASIC performs the operations in the standard precedence as shown below. Precedence 1. Parentheses ( ) The parentheses allow you to override operator precedence; that is, operations enclosed with parentheses are first carried out. For improving the readability of an expression, you can use parentheses to separate two operators placed in succession. 2. Function operations 3.
When more than one operator occurs at the same level of precedence, the BHT-BASIC resolves the expression by proceeding from left to right. a=4+5.0/20*2-1 In the above example, the operation order is as follows; 5.0/20 0.25*2 4+0.5 4.5-1 (=0.25) (=0.5) (=4.5) (=3.
Chapter 6. Expressions and Operators 6.3 Operators 6.3.1 Arithmetic Operators Arithmetic operators include a negative sign (-) and operators for multiplication (*), division (/), addition (+), and subtraction (-). They also include modulo operator MOD.
6.3.2 Relational Operators A relational operator compares two values. Depending upon whether the comparison is true or false, the operator returns true (–1) or false (0). With the operation result, you can control the program flow.
Chapter 6. Expressions and Operators 6.3.3 Logical Operators A logical operator combines multiple tests and manipulates Boolean operands, then returns the results. It is used, for example, to control the program execution flow or test the value of an INP function bitwise, as shown in the sample below. IF d<200 AND f<4 THEN ... WHILE i>10 OR k<0 ... IF NOT p THEN ... barcod% = INP(0) AND &h02 Listed below are the four types of logical operators available.
[ 2 ] The AND operator The AND operator ANDs the same order bits in two expressions on either side of the operator, then sets 1 to the resultant bit if both of these bits are 1. Syntax: expression1 AND expression2 Truth Table for AND Bit in Expression 1 Bit in Expression 2 Resultant Bit 0 0 1 1 0 1 0 1 0 0 0 1 [ 3 ] The OR operator The OR operator ORes the same order bits in two expressions on either side of the operator, then sets 1 to the resultant bit if at least one of those bits is 1.
Chapter 6. Expressions and Operators 6.3.4 Function Operators The following two types of functions are available in BHT-BASIC, both of which work as function operators: ■ Built-in Functions Already built in BHT-BASIC, e.g., ABS and INT. ■ User-defined Functions Defined by using DEF FN (in single-line form), DEF FN...END DEF (in block form), SUB...END SUB, or FUNCTION...END FUNCTION statement. 6.3.5 String Operators A character string operator may concatenate or compare character strings.
■ Comparison of Character Strings The relational operators compare two character strings according to character codes assigned to individual characters. In the example below, the expression a1$
Chapter 7 I/O Facilities CONTENTS 7.1 Output to the LCD Screen ............................................................................. 88 7.1.1 Display Fonts...................................................................................... 88 [ 1 ] Fonts available on each BHT .................................................... 88 [ 2 ] Switching the fonts .................................................................... 89 7.1.2 Number of Characters and Coordinates on the LCD ................
7.1 Output to the LCD Screen 7.1.1 Display Fonts [ 1 ] Fonts available on each BHT Listed below are the fonts available on each BHT series.
Chapter 7. I/O Facilities [ 2 ] Switching the fonts You may switch the screen mode and font size by using the statements below. • SCREEN statement • OUT statement To specify the single-byte ANK mode, two-byte Kanji mode, or condensed two-byte Kanji mode, use the SCREEN statement as listed below.
■ Locating Characters on the LCD Screen Using the LOCATE statement locates characters on the coordinates of the LCD screen. The coordinates differ depending upon the screen mode as shown below. Single-byte ANK Mode (16 columns x 4 lines) LOCATE 1,1 LOCATE 16,1 LOCATE 16,4 Two-byte Kanji Mode 6 columns x 2 lines for full-width characters only, 12 columns x 2 lines for half-width characters only Be careful about the specification of line numbers in the figures below.
Chapter 7. I/O Facilities [ 2 ] BHT-4000 ■ Screen mode Single-byte ANK mode Columns x Lines 26 x 10 Two-byte Kanji mode Full-width: 10 x 5 Half-width: 20 x 5 Condensed two-byte Kanji mode Full-width: 13 x 5 Half-width: 26 x 5 Displaying Kanji Characters To display characters in the condensed two-byte Kanji mode, the BHT-4000 condenses the Kanji patterns of 16 x 16 dots designed for the two-byte Kanji mode. For statements on how to condense, refer to Appendix C3.
Two-byte Kanji Mode 10 columns x 5 lines for full-width characters only, 20 columns x 5 lines for half-width characters only Be careful about the specification of line numbers in the figures below. A single column shown below represents an area for a half-width character; Double columns represent an area for a full-width character.
Chapter 7. I/O Facilities Condensed Two-byte Kanji Mode 13 columns x 5 lines for full-width characters only, 26 columns x 5 lines for half-width characters only Be careful about the specification of line numbers in the figures below. A single column shown below represents an area for a half-width character; Double columns represent an area for a full-width character. (For the Kanji patterns in the condensed two-byte Kanji mode, refer to Appendix C3.
[ 3 ] BHT-5000 Screen mode Columns x Lines ■ Single-byte ANK mode 21 x 8 Two-byte Kanji mode Condensed two-byte Kanji mode Full-width: 8 x 4 Half-width: 16 x 4 Full-width: 10 x 4 Half-width: 21 x 4 Displaying Kanji Characters To display Kanji characters, it is necessary to download the Kanji font file consisting of JIS Level 1 and Level 2 font files to the BHT-5000 beforehand. Even without those files, the half-width alphanumerics and Katakana may be displayed.
Chapter 7. I/O Facilities Two-byte Kanji Mode 8 columns x 4 lines for full-width characters only, 16 columns x 4 lines for half-width characters only Be careful about the specification of line numbers in the figures below. A single column shown below represents an area for a half-width character; Double columns represent an area for a full-width character.
Condensed Two-byte Kanji Mode 10 columns x 4 lines for full-width characters only, 21 columns x 4 lines for half-width characters only Be careful about the specification of line numbers in the figures below. A single column shown below represents an area for a half-width character; Double columns represent an area for a full-width character. (For the Kanji patterns in the condensed two-byte Kanji mode, refer to Appendix C3.
Chapter 7. I/O Facilities [ 4 ] BHT-6000/BHT-6500 Screen mode ■ Single-byte ANK mode Two-byte Kanji mode Font size Standard-size Small-size Standard-size Small-size Columns x Lines 16 x 10 16 x 8 Full-width: 6 x 3 Half-width: 12 x 3 Full-width: 8 x 4 Half-width: 16 x 4 Displaying Kanji Characters To display Kanji characters, it is necessary to download the Kanji font file consisting of JIS Level 1 and Level 2 font files to the BHT-6000/BHT-6500 beforehand.
Small-size font (16 columns x 8 lines) LOCATE 1,1 LOCATE 16,1 LOCATE 16,8 Two-byte Kanji Mode Standard-size font 6 columns x 3 lines for full-width characters only, 12 columns x 3 lines for half-width characters only Be careful about the specification of line numbers in the figures below. A single column shown below represents an area for a half-width character: Double columns represent an area for a full-width character.
Chapter 7. I/O Facilities Small-size font 8 columns x 4 lines for full-width characters only, 16 columns x 4 lines for half-width characters only Be careful about the specification of line numbers in the figures below. A single column shown below represents an area for a half-width character: Double columns represent an area for a full-width character.
[ 5 ] BHT-7000 (1) Normal-width Screen mode Single-byte ANK mode Two-byte Kanji mode Font size Standard-size Small-size Standard-size Small-size Columns x Lines 21 x 8 21 x 10 Full-width: 8 x 4 Half-width: 16 x 4 Full-width: 10 x 5 Half-width: 21 x 5 (2) Double-width Screen mode ■ Single-byte ANK mode Font size Standard-size Small-size Columns x Lines 10 x 8 10 x 10 Two-byte Kanji mode Standard-size Full-width: Half-width: 4x4 8x4 Small-size Full-width: 5 x 5 Half-width: 10 x 5 Disp
Chapter 7. I/O Facilities ■ Locating Characters on the LCD Screen Using the LOCATE statement locates characters on the coordinates of the LCD screen. The coordinates differ depending upon the screen mode and the display font size as shown below.
Two-byte Kanji Mode Standard-size font 8 columns x 4 lines for full-width characters only, 4 columns x 4 lines for full-width characters in double-width mode only, 16 columns x 4 lines for half-width characters only, 8 columns x 4 lines for half-width characters in double-width mode only Be careful about the specification of line numbers in figures below.
Chapter 7. I/O Facilities Small-size font 10 columns x 5 lines for full-width characters only, 5 columns x 5 lines for full-width characters in double-width mode only, 21 columns x 5 lines for half-width characters only, 10 columns x 5 lines for half-width characters in double-width mode only Be careful about the specification of line numbers in figures below.
[ 6 ] BHT-7500 (1) Normal-width Screen mode Single-byte ANK mode Two-byte Kanji mode Font size Standard-size Small-size Standard-size Small-size Columns x Lines 26 x 20 26 x 26 Full-width: 10 x 10 Half-width: 20 x 10 Full-width: 13 x 13 Half-width: 26 x 13 (2) Double-width Screen mode ■ Single-byte ANK mode Two-byte Kanji mode Font size Standard-size Small-size Standard-size Small-size Columns x Lines 13 x 20 13 x 26 Full-width: 5 x 10 Half-width: 10 x 10 Full-width: 6 x 13 Half-wi
Chapter 7. I/O Facilities ■ Locating Characters on the LCD Screen Using the LOCATE statement locates characters on the coordinates of the LCD screen. The coordinates differ depending upon the screen mode and the display font size as shown below.
Two-byte Kanji Mode Standard-size font 10 columns x 10 lines for full-width characters only, 5 columns x 10 lines for full-width characters in double-width mode only, 20 columns x 10 lines for half-width characters only, 10 columns x 10 lines for half-width characters in double-width mode only Be careful about the specification of line numbers in figures below.
Chapter 7. I/O Facilities Small-size font 13 columns x 13 lines for full-width characters only, 6 columns x 13 lines for full-width characters in double-width mode only, 26 columns x 13 lines for half-width characters only, 13 columns x 13 lines for half-width characters in double-width mode only Be careful about the specification of line numbers in figures below.
7.1.3 Dot Patterns of Fonts ■ Character fonts In the figures below, "■" shows a display area for characters. Any character is displayed within a set of the display areas. " " shows a delimiter area that separates characters from each other and contains no display data. The corresponding dots are always off. The double-width mode is supported by the BHT-7000/BHT-7500. Small-size fonts are supported by the BHT-6000/BHT-6500/BHT-7000/BHT-7500.
Chapter 7. I/O Facilities Two-byte Kanji Mode*1 Standard-size font Half-width Kanji 8 x 16 dots Full-width Kanji 16 x 16 dots Half-width Kanji (in double-width mode) 16 x 16 dots Full-width Kanji (in double-width mode) 32 x 16 dots Small-size font *1 Half-width Kanji 6 x 12 dots Half-width Kanji (in double-width mode) 12 x 12 dots Full-width Kanji 12 x 12 dots Full-width Kanji (in double-width mode) 24 x 12 dots The BHT-7000/BHT-7500 fonts do not use the lowermost dot line of the letter frame.
Condensed two-byte Kanji Mode Full-width Kanji 12 x 16 dots ■ Half-width Kanji 6 x 16 dots Cursor shape The LOCATE statement specifies the cursor shape--Underline cursor, full block cursor, or invisible. In the BHT-7000/BHT-7500, you may define and load the desired cursor shape with the APLOAD or KPLOAD statement and then specify the user-defined cursor with the LOCATE statement. In the double-width screen mode, the cursor will be displayed in double width.
Chapter 7. I/O Facilities Two-byte Kanji Mode Standard-size font (8 x 16 dots) Underline cursor*2 Full block cursor Invisible Small-size font (6 x 12 dots) Underline cursor *2 Full block cursor Invisible In the BHT-7500, the underline cursor of the standard-size font will be displayed not on the lowermost dot line of the letter frame but on the 2nd dot line from the bottom. This is because the BHT-7500 uses the lowermost dot line for showing the system status.
7.1.4 Mixed Display of Different Character Types or Different-size Fonts [ 1 ] Displaying ANK, Kanji, and Condensed Kanji in One Line It is possible to mix-display the ANK characters, Kanji characters (both full-width and halfwidth), and condensed Kanji characters (both full-width and half-width) in the same line on the LCD screen, as shown in the example below.
Chapter 7. I/O Facilities [ 3 ] Displaying Normal- and Double-width Characters on the Same Screen The BHT-7000/BHT-7500 can mix-display the normal- and double-width characters on the same screen.
7.1.6 VRAM The INP function may read the VRAM data. The OUT statement writes data into the VRAM so that graphics may be displayed on the LCD dotwise. ■ Specifying an address bytewise An address on the LCD may be specified bytewise by giving a port number in the OUT statement and INP function.
Chapter 7. I/O Facilities ■ Setting an 8-bit binary pattern The data of an 8-bit binary pattern should be designated by bit 7 (LSB) to bit 0 (MSB). If the bit is 1, the corresponding dot on the LCD will come ON. OUT &h10,&h80 ’Set bit 7 only to 1 10h 8Fh 90h 10Fh 110h 18Fh 190h 20Fh 210h 28Fh 290h 30Fh 310h 38Fh 390h 40Fh In the BHT-7500, you may set graphic data to the VRAM area assigned to the bottom dot line of the LCD by using the OUT statement.
7.1.7 Displaying the System Status (BHT-4000/BHT5000/BHT-6000/BHT-6500) The BHT-4000 may display the voltage level icon and shifted key icon on the bottom line of the LCD. The BHT-5000/BHT-6000/BHT-6500 may display the shifted key icon and alphabet input icon at the right end of the bottom line of the LCD. For details about the icon shapes, refer to the BHT’s User’s Manual.
Chapter 7. I/O Facilities ■ Notes relating to the system status Notes when the system status is displayed The following statements and functions will cause somewhat different operations when the system status is displayed. • CLS statement The CLS statement clears the VRAM area assigned to the bottom line of the LCD but does not erase the system status displayed.
[ 2 ] BHT-5000/BHT-6000/BHT-6500 ■ Turning the system status indication on or off You may turn the system status indication on or off on the SET DISPLAY menu in System Mode. The default is ON. (For the setting procedure, refer to the "BHT’s User’s Manual") You may control the system status indication also by using the OUT statement in user programs. (Refer to Appendix D, "I/O Ports.
Chapter 7. I/O Facilities 7.1.8 Other Facilities for the LCD ■ Setting national characters Using the COUNTRY$ function displays currency symbols and special characters for countries in the screen mode below. • Single-byte ANK mode: All BHT series • Two-byte Kanji mode (half-width): BHT-7000/BHT-7500 Refer to Appendix C2, "National Character Sets." ■ Highlighting characters The SCREEN statement highlights characters.
7.2 Input from the Keyboard 7.2.1 Function Keys Any of the following operations makes the pressed key act as a function key: - Pressing one of the function keys. *1 - Pressing one of the function keys while holding down the Shift key. *2 - Pressing one of the numeric keys while holding down the Shift key. *2 *1 Since each of the function keys is assigned its default value of a character code or control code, pressing it enters the default value.
Chapter 7. I/O Facilities ■ Defining a function key as the LCD backlight function on/off key You can define a particular function key as the backlight function on/off key and set the length of backlight ON-time by using the KEY statement, as shown below. - Example for defining the key numbered 5 and setting 60 seconds. KEY 5,"BL60" NOTE ■ It is impossible to assign both a character string and the backlight on/off function to a same function key. For details, refer to KEY in Chapter 14.
7.2.3 Alphabet Entry Function The alphabet entry function allows you to enter alphabetic characters, a space, and symbols from the BHT keyboard (keypad) during execution of a user program. [ 1 ] BHT-3000/BHT-4000/BHT-6000/BHT-6500 To activate or deactivate the alphabet entry function, use OUT statement in a user program. As shown below, three characters are assigned to each of 0-9 numerical keys and period key. For example, A, B, and C are assigned to the 7 key.
Chapter 7. I/O Facilities (2) Entering alphabetic characters from the keypad 1) Find a target key which is assigned an alphabetic character to be inputted, and then check the position of the character (Left, Center, or Right) relative to the three characters assigned to the target key. 2) Designate the character position by using the trigger switch and then press the target key.
In the example below, the character "A" may be entered with the alphabet entry function or may be generated by pressing the F1 key which has been assigned that character by the KEY statement. The user program, however, cannot distinguish between them so as to transfer control to the program step labelled FUNC1 in both cases. K$=INPUT$ (1) IF K$="A" THEN GOTO FUNC1 ENDIF . . . To prevent such a problem, assign any other character to the F1 key with the KEY statement and then modify the judgement condition.
Chapter 7. I/O Facilities 2) Hold down the trigger switch. 3) Without releasing the trigger switch, press the 5 key. 4) Release the trigger switch. 5) Hold down the trigger switch. 6) Without releasing the trigger switch, press the 8 key.
7) Release the trigger switch. 8) Press the Enter key to complete the entry operation. [ 2 ] BHT-5000/BHT-7000/BHT-7500 (32-key pad models) The BHT-5000/BHT-7000/BHT-7500 with a 32-key pad supports the alphabet entry function which can be activated by pressing the ALP key. To deactivate it, press the ALP key again. To enter lowercase letters in the alphabet input mode, shift the keypad with the SF key. Letter assignment to the keys is shown in Appendix E.
Chapter 7. I/O Facilities [ 3 ] BHT-7000 (26-key pad model) In addition to the numeric entry from the keypad, the BHT-7000 with a 26-key pad supports alphabet entry. ■ Switching between the Numeric Entry System and Alphanumeric Entry System To switch between the numeric entry system and alphanumeric entry system, use the OUT statement in a user program as shown below.
■ Alphabet Entry Procedure (1) Switch to the alphanumeric entry system as follows: Issue "OUT &h60B0,1". (2) Switch to the alphabet entry mode as follows: Press the SF key or issue "OUT &h60B1,1". The ALP status bar appears. (3) Enter alphabet letters from the keypad as follows: 1) Press a numerical key to which the desired alphabet letter is assigned by the required number of times until the desired alphabet letter appears, referring to the relationship between keys and their assigned data given below.
Chapter 7. I/O Facilities When no key is ready to be established, pressing any of the function keys, BS, C, ENT, and magic keys will return the key data of the pressed key. (Example: If you press the 1, 1, 2, and 3 keys) The key data of "T" and "V" will be returned. The "Y" is not established yet. (Example: If you press the C, 1, 1, 1, and ENT keys) The 18H and "U" will be returned.
7.2.4 Other Facilities for the Keyboard [ 1 ] Auto-repeat The keys on the BHT series are not auto-repeat. [ 2 ] Shift key ■ BHT-3000 The Shift key can be switched to non-lock type or lock type by selecting NRM or ONE on Set Resume screen in System Mode, respectively. • Non-lock type The keypad will be shifted only when the Shift key is held down. • Lock type Once the Shift key is pressed, the next one key pressed will be shifted and the following keys will not be shifted.
Chapter 7. I/O Facilities 7.3 Timer and Beeper 7.3.1 Timer Functions The timer functions (TIMEA, TIMEB, and TIMEC) are available in BHT-BASIC for accurate time measurement. Use these timer functions for monitoring the keyboard waiting time, communications timeout errors, etc. TIMEA = 100 WAIT 0,&H10 BEEP PRINT "10sec." ’10 sec TIMEC = 20 ’2 sec WAIT 0,&H41 BEEP PRINT "2sec. or Keyboard" 7.3.2 BEEP Statement The BEEP statement sounds a beeper and specifies the frequency of the beeper.
7.4 Controlling and Monitoring the I/Os 7.4.1 Controlling by the OUT Statement The OUT statement can control the input and output devices (I/Os) listed in Appendix D, I/O Ports." The table below lists some examples. I/O Devices OUT Statement OUT 1,&h02 OUT 1,&h01 OUT 1,&h00 Turns on the reading confirmation LED in green. Turns on the reading confirmation LED in red. Turns off the reading confirmation LED. OUT 3,&hXX (XX: 00 to 07) Sets the LCD contrast.
Chapter 7. I/O Facilities 7.4.3 Monitoring by the WAIT Statement The WAIT statement monitors the input and output devices (I/Os) listed in Appendix D, "I/O Ports." Unlike the INP function, the WAIT statement makes the I/O devices idle while no entry occurs, thus saving power consumption and increasing the battery service life. The table below lists some examples.
Chapter 8 Files CONTENS 8.1 File Overview ............................................................................................... 133 8.1.1 Data Files and Device I/O Files........................................................ 133 8.1.2 Access Methods ............................................................................... 133 8.2 Data Files..................................................................................................... 134 8.2.1 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.
Chapter 8. Files 8.1 File Overview 8.1.1 Data Files and Device I/O Files BHT-BASIC treats not only data files but also bar code device I/Os and communications device I/Os as files, by assigning the specified names to them. File Type Data File File Name Remarks filename.extension drivename:filename.
8.2 Data Files 8.2.1 Overview Like user programs, data files will be stored in the user area of the memory. The location of the user area differs depending upon the BHT series as shown below. BHT series Location of user area BHT-3000/BHT-4000 BHT-5000/BHT-6000/BHT-6500 BHT-7000/BHT-7500 A single drive (no drive specification) Drive A and drive B Drive A and drive B* * Drive B is provided for ensuring the compatibility with the BHT-5000/BHT-6000/BHT-6500.
Chapter 8. Files 8.2.3 Structure of Data Files ■ Record A data file is made up of a maximum of 32767 records. A record is a set of data in a data file and its format is defined by the FIELD statement. The maximum length of a record is 255 bytes including the number of the character count bytes* (= the number of the fields). * When transferring data files, the BHT-protocol/BHT-Ir protocol automatically prefixes a character count byte in binary format to each data field.
• Maximum Number of Registrable Records You may declare the maximum number of records registrable in a data file by using the RECORD option in the OPEN statement, as shown below. OPEN "work.DAT" AS #10 RECORD 50 FIELD #10,13 AS code$,5 AS price$ The above program allows you to write up to 50 records in the data file named work.DAT. If the statement below is executed following the above program, a run-time error will occur.
Chapter 8. Files 8.2.5 Programming for Data Files ■ Input/Output for Numeric Data - To write numeric data into a data file: It is necessary to use the STR$ function for converting the value of a numeric expression into a string. To write -12.56 into a data file, for example, the field length of at least 6 bytes is required. When using the FIELD statement, designate the sufficient field length; otherwise, the data will be lost from the lowest digit when written to the field.
■ Restrictions on Input/Output of Data Files No INPUT#, LINE INPUT#, or PRINT# statement or INPUT$ function can access data files. To access data files, use a PUT or GET statement. ■ Drive Defragmentation (BHT-7000/BHT-7500 only) During downloading in the BHT-7000/BHT-7500, a delay of a few seconds (response delay from the BHT) may occur according to the user area condition. To eliminate the delay, defragment the drive for the size required for downloading beforehand.
Chapter 8. Files 8.2.6 About Drives The BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500 has logical drives. ■ BHT-5000/BHT-6000/BHT-6500 Drive A and drive B are defined on the RAM and flash ROM, respectively. Accordingly, the file access is partially different between drive A and drive B as listed below.
8.3 Bar Code Device 8.3.1 Overview ■ Opening the Bar Code Device by OPEN "BAR:" Statement The OPEN "BAR:" statement opens the bar code device. In this statement, you may specify the following bar code types available in the BHT. The BHT can handle one of them or their combination. Available Bar Code Types Universal product codes Default Settings EAN-13* EAN-8 UPC-A* UPC-E No national flag specified. Interleaved 2 of 5 (ITF) No read data length specified. No check digit.
Chapter 8. Files ■ Specifying Options in the OPEN "BAR:" Statement You may also specify several options as listed below for each of the bar code types in the OPEN "BAR:" statement. Options - Check digit (only for ITF, Codabar, Code 39, and STF) - Read data length - Start/stop character (only for Codabar and STF) - Start character flag (only for universal product codes) - Supplemental code (only for universal product codes.
■ Read Mode of the Trigger Switch In the BHT-6000/BHT-6500/BHT-7000/BHT-7500, the trigger switch function is assigned to the following magic keys by default: BHT-6000: M1 and M2 keys BHT-6500: M1, M2, M3, and M4 keys BHT-7000/BHT-7500: M3 and M4 keys In the BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500, you may assign the trigger switch function to other keys by using the KEY statement. You may select the read mode of the trigger switch by using the OPEN "BAR:" statement.
Chapter 8. Files ■ Controlling the Reading Confirmation LED and Beeper (Vibrator) at the Time of Scanning for Confirmation of Successful Reading (BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500) By using the OPEN "BAR:" statement, you can control: • whether the reading confirmation LED should light in green or not (Default: Light in green) • whether the beeper should beep or not (Default: No beep) The BHT-6500/BHT-7000/BHT-7500 may control the vibrator also. when a bar code is read successfully.
8.4 Communications Device 8.4.1 Hardware Required for Data Communications [ 1 ] BHT-3000/BHT-4000/BHT-5000 The following hardware is required for communications between the BHT and the host computer: • Optical communications unit (CU-3000/CU-4000/CU-5000) and its interface cable or • Direct-connect interface cable For the communications specifications, refer to the "BHT’s User's Manual.
Chapter 8. Files 8.4.2 Programming for Data Communications Setting the Communications Parameters Use the OPEN "COM:" statement to set the communications parameters.
■ For direct-connect interface Communications Parameters Transmission speed (bps) Effective Setting Default 115200*1, 57600*1, 38400, 19200, 9600, 4800, 2400, 1200, 9600 600, or 300 Parity*2 None, even, or odd None Character length*2 7 or 8 bits 8 bits Stop bit length*2 1 or 2 bits 1 bit *1 The 115200 bps and 57600 bps are available in the BHT-7000/BHT-7500.
Chapter 8. Files 8.4.3 Overview of Communications Protocols The BHT series supports the three communications protocols—BHT-protocol, BHT-Ir protocol, and multilink protocol for file transmission, as listed below. Using the XFILE statement, the BHT may upload or download a file according to any of these protocols. • BHT-protocol : All BHT series • BHT-Ir protocol : BHT-6000/BHT-6500/BHT-7000/BHT-7500 • Multilink protocol : BHT-5000 [ 1 ] BHT-protocol All BHT series supports the BHT-protocol.
[ 2 ] BHT-Ir protocol (BHT-6000/BHT-6500/BHT-7000/BHT7500) In addition to the BHT-protocol, the BHT-6000/BHT-6500/BHT-7000/BHT-7500 supports the BHT-Ir protocol. If you select the BHT-Ir protocol by using the OUT statement (Port No. &h6060) or in System Mode, you can upload or download a data file with the XFILE statement. The BHT-Ir protocol is used also in System Mode or Easy Pack Pro.
Chapter 8. Files [ 3 ] Multilink protocol (BHT-5000 only) In addition to the BHT-protocol, the BHT-5000 may support the multilink protocol which is used for file transmission between the host computer and more than one BHT-5000 (placed on the multilinked CU-5003s), provided that Multilink Protocol System (MLTU3.EX3) is downloaded to the BHT-5000 beforehand. To transfer files by using the multilink protocol, you need Multilink Transfer Utility (MLTU3.EXE) to be run in the host computer and the CU-5003(s).
8.4.4 File Transfer Tools [ 1 ] Transfer Utility Transfer Utility is optionally available in two versions: MS-DOS–based and Windows-based. It supports the BHT-protocol and allows you to upload or download user program files and data files between the host and the BHT, when invoked by the XFILE statement. This utility can also transfer user program files and data files to/from System Mode.
Chapter 8. Files [ 4 ] Multilink Transfer Utility (BHT-5000 only) Multilink Transfer Utility is optional MS-DOS–based software. It supports the multilink protocol and allows you to upload or download user program files and data files between the host and the BHT-5000 (placed on the multilinked CU-5003s), when invoked by the XFILE statement. This utility can also transfer user program files and data files to/from System Mode.
Chapter 9 Event Polling and Error/Event Trapping CONTENTS 9.1 Overview...................................................................................................... 155 9.2 Event Polling................................................................................................ 156 [ 1 ] Programming sample .............................................................. 156 [ 2 ] I/O devices capable of being monitored by the event polling .. 157 9.3 Error Trapping.............................
Chapter 9. Event Polling and Error/Event Trapping 9.1 Overview BHT-BASIC supports event polling and two types of trapping: error trapping and event trapping. – Event polling – Trapping Error trapping Event (of keystroke) trapping ■ Event Polling Makes programs monitor the input devices for occurrence of events. ■ Error Trapping Traps a run-time error and handles it by interrupt to transfer control to the error-handling routine.
9.2 Event Polling [ 1 ] Programming sample The program below shows the event polling example which monitors the bar code reader and the keyboard for occurrence of events. This example uses the EOF and INKEY$ functions to check the data input for the bar code reader and the keyboard, respectively. OPEN "BAR:" AS #1 CODE "A" loop WAIT 0,3 IF NOT EOF(1) THEN GOSUB barcod ENDIF k$=INKEY$ IF k$<>"" THEN GOSUB keyin ENDIF GOTO loop barcod BEEP LINE INPUT #1,dat$ PRINT dat$ RETURN keyin . . .
Chapter 9. Event Polling and Error/Event Trapping [ 2 ] I/O devices capable of being monitored by the event polling Listed below are the I/O devices which the event polling can monitor.
9.3 Error Trapping [ 1 ] Overview If a run-time error occurs during program running, error trapping makes the program cause an interrupt upon completion of the machine statement so as to transfer control from the current program to the error-handling routine which has been specified by a label. If a run-time error occurs when this trapping ability is disabled, the Interpreter will terminate the current user program while displaying the error message as shown below.
Chapter 9. Event Polling and Error/Event Trapping [ 2 ] Programming for trapping errors To trap errors, use the ON ERROR GOTO statement in which you should designate the errorhandling routine (to which control is to be transferred if a run-time error occurs) by the label. ON ERROR GOTO err01 . . . (Main routine) . . .
9.4 Event (of Keystroke) Trapping [ 1 ] Overview If any of the function keys previously specified for keystroke trapping is pressed, event trapping makes the program cause an interrupt so as to transfer control from the current program to the specified event-handling routine. This trapping facility checks whether any of the function keys is pressed or not between every execution of the statements. [ 2 ] Programming for trapping keystrokes To trap keystrokes, use both the ON KEY...
Chapter 9. Event Polling and Error/Event Trapping The RETURN statement in the event-handling routine will return control to the statement immediately following that statement where the keyboard interrupt occurred. Even if a function key is assigned a null string by the KEY statement, pressing the function key will cause a keyboard interrupt when the KEY ON statement activates that function key.
Chapter 10 Sleep Function CONTENTS 10.1 Sleep Function.............................................................................................
Chapter 10. Sleep Function 10.1 Sleep Function The BHT supports the sleep function that automatically interrupts program execution if no event takes place within the specified length of time in the BHT, thereby minimizing its power consumption. Upon detection of any event, the BHT in the sleep state immediately starts the interrupted user program. By using the OUT statement, you may set the desired length of time to the sleep timer within the range from 0 to 25.5 seconds in increment of 100 ms.
Chapter 11 Resume Function CONTENTS 11.1 Resume Function.........................................................................................
Chapter 11. Resume Function 11.1 Resume Function The resume function automatically preserves the current status of a running application program (user program or Easy Pack) when the BHT is powered off, and then resumes it when the BHT is powered on. That is, even if you unintentionally turn off the BHT or the automatic powering-off function turns off the BHT, turning on the BHT once again resumes the previous status of the program to allow you to continue the program execution.
Chapter 12 Power-related Functions CONTENTS 12.1 Low Battery Warning ................................................................................... 167 12.2 Prohibited Simultaneous Operation of the Beeper*, Illumination LED (Laser Source**), and LCD Backlight 168 12.3 Wakeup Function......................................................................................... 169 12.4 Remote Wakeup Function (BHT-7000/BHT-7500) ...................................... [ 1 ] Outline ..........................
Chapter 12. Power-related Functions 12.1 Low Battery Warning ■ BHT-3000 If the battery voltage is below the specified level when the BHT-3000 is powered on, the "Battery voltage has lowered" message appears on the LCD. If the battery voltage drops while the BHT-3000 is in operation, the beeper beeps three times every 10 seconds.
12.2 Prohibited Simultaneous Operation of the Beeper*, Illumination LED (Laser Source**), and LCD Backlight (* Beeper and vibrator in the BHT-6500/BHT-7000/BHT-7500) (** Laser source in the BHT-6500/BHT-7500) ■ BHT-3000 The BHT-3000 is so designed that the beeper, illumination LED, and LCD backlight will not work simultaneously to save power consumption at peak load.
Chapter 12. Power-related Functions 12.3 Wakeup Function ■ BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500 The wakeup function allows you to turn on the BHT from "OFF" at the wakeup time (of the system clock) specified in user programs. To set the wakeup time by using the TIME$ function: (1) Set 1 to bit 2 on port 8. Switches the TIME$ function to the setting of the wakeup time. (2) Set the wakeup time by using the TIME$ function. (3) Set 1 to bit 0 on port 8. Activates the wakeup function.
12.4 Remote Wakeup Function (BHT-7000/BHT-7500) [ 1 ] Outline The remote wakeup function allows you to remotely power on the BHT and run the specified user program (hereafter referred to "remote wakeup program") by sending the specified message from the host computer to the BHT via the CU. Developing user programs utilizing the remote wakeup at both the host computer and BHT enables you to automatically maintain the master system or update user programs.
Chapter 12. Power-related Functions (5) The BHT will exit from the sleep state and execute the remote wakeup program developed by the user. ■ At the host computer (1) The host computer sends a “WAKE” character string to the BHT at least two times. (2) Upon receipt of "ACK + "0" + ID" from the BHT, the host computer should conduct transactions with the remote wakeup program in the BHT.
If in the BHT no remote wakeup program exists: BHT Host computer Sends 1st time "WAKE" In charge state (in sleep) Sends 2nd time "WAKE" Ready-to-receive Handled by the BHT system program ACK + "1" + ID Detects "WAKE" and sends its response Receives response Proceeds to the error processing If in the BHT the remote wakeup is deactivated: BHT Host computer Sends 1st time "WAKE" In charge state (in sleep) Sends 2nd time "WAKE" Ready-to-receive Handled by the BHT system program ACK + "2" + ID
Chapter 12. Power-related Functions [ 3 ] Remote wakeup program ■ File name The BHT may handle the file named "BHTRMT.PD3" as a remote wakeup program. Upon receipt of data containing a “WAKE” character string in the ready-to-receive state, the BHT checks whether the BHTRMT.PD3 file exists. If the file exists, the BHT will start the remote wakeup operation described in [ 2 ].
(4) Set the BHT station ID to be used in the BHT response message Set a 6-byte numeric string referring to the lower 6 digits of the BHT serial number as a station ID which will be used in the response message to the host. To write and read the setting, use the extension function SYSTEM.FN3 (Functions #3 and #4). For details, refer to Chapter 16, "Extended Functions." Once made in a user program, the above settings will be retained even after termination the user program.
Chapter 12. Power-related Functions ■ Checking the execution record of remote wakeup When starting, a user program (including a remote wakeup program) may check via the I/O ports whether the BHT remotely woke up at the last powering on and its operation was normally ended. (Refer to Appendix D, "I/O Ports," D5.) Making use of the execution record, you may display an alarm message. Port No. Bit 0 Bit 1 Specifications 60F2h 0 0 0 1 At the last powering on, the BHT did not remotely wake up.
Chapter 13 LCD Backlight Function CONTENTS 13.1 LCD Backlight Function ...............................................................................
Chapter 13. LCD Backlight Function 13.1 LCD Backlight Function The BHT has an LCD backlight function. Pressing the trigger switch* while holding down the Shift key activates or deactivates the backlight function. The default length of backlight ONtime (ON-duration) is 3 seconds. By using a KEY statement, you can select the backlight function on/off key instead of the combination of the trigger switch* and Shift key, as well as modifying the ON-duration of the backlight.
In the BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500, you can control the backlight function by using the OUT statement as described below. Setting 1 to port 6020h with the OUT statement activates the LCD backlight function and turns on the backlight. If no key is pressed for the time length preset to port 6021h (default time: 5 seconds), the backlight goes off but the backlight function remains activated. Setting 0 to port 6020h deactivates the LCD backlight function and turns off the backlight if lit.
Chapter 14 Statement Reference CONTENTS APLOAD .............................................. 180 BEEP ................................................... 185 CALL ................................................... 188 CHAIN ................................................. 192 CLFILE ................................................ 194 CLOSE ................................................ 196 CLS ..................................................... 197 COMMON ...........................................
Chapter 14. Statement Reference ANK Pattern LOAD I/O statement APLOAD Loads a user-defined font in the single-byte ANK* mode *ANK: Alphanumeric and Katakana Syntax: Syntax 1 (Loading a user-defined font): APLOAD characode,fontarrayname Syntax 2 (Loading a user-defined cursor. Valid in the BHT-7000/BHT-7500): APLOAD characode,cursorarrayname Parameter: characode • For user-defined font A numeric expression which returns a value from 128 (80h) to 159 (9Fh).
• If you issue more than one APLOAD statement specifying a same character code, the last statement takes effect. • Only when the Interpreter executes the APLOAD statement, it refers to the array data defined by fontarrayname. So, once a user program has finished loading the user font, changing the data in the array or deleting the array itself (by the ERASE statement) will not affect the already loaded user font.
Chapter 14. Statement Reference • The cursor size will differ depending upon the display font currently selected, as shown below. Display font Size (W x H) No. of elements Standard-size 6 x 8 dots 6 0 1 2 3 4 5 LSB MSB Small-size 6 x 6 dots 6 0 1 2 3 4 5 LSB MSB • An array integer variable--a work array, register array, or common array--for cursorarrayname should be declared by the DIM, DEFREG, or COMMON statement, respectively.
• In the double-width screen mode, user-defined cursors loaded by the APLOAD will be doubled in width when displayed, as shown below.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 05h Parameter out of the range (• characode is out of the specified range.) (• The array structure is not correct.
I/O statement BEEP Drives the beeper or vibrator. (The vibrator is provided in the BHT-6500/BHT-7000/BHT-7500 to which vibrator-related descriptions given below should apply.) Syntax: BEEP[onduration[,offduration[,repetitioncount [,frequency]]]] Parameter: onduration, offduration, and repetitioncount Numeric expressions, each of which returns a value from 0 to 255. frequency A numeric expression which returns a value from 0 to 32767.
Chapter 14. Statement Reference In the BHT-6500/BHT-7000/BHT-7500, specification of 0, 1, or 2 to frequency drives the beeper or vibrator depending upon the settings made on the "LCD contrast & beeper volume adjustment and the beeper & vibrator switching" screen. If 0, 1, or 2 is set to frequency (or if the frequency option is omitted), then you can adjust the beeper volume on the LCD when powering on the BHT. (For the adjustment procedure, refer to the BHT User’s Manual.
• The BEEP statement does not suspend execution of the subsequent statement until the beeper completes sounding or vibrating. Instead, the execution of the subsequent statement proceeds immediately. If a second BEEP statement is encountered while the BHT is still beeping or vibrating by a first BEEP, the first BEEP is cancelled and the new BEEP statement executes.
Chapter 14. Statement Reference Flow control statement CALL Calls an FN3 or SUB function. Syntax: Syntax 1 (Calling an FN3): CALL "[drivename:]filename" functionnumber [data [,data]...] Syntax 2 (Calling a SUB): CALL functionname [(realparameter[,realparameter…])] Parameter: [drivename:]filename A string expression. functionnumber An integer constant. data A string variable or a numeric variable. functionname Real function name. realparameter A numeric expression or a string expression.
• filename is the name of an FN3 function. The extension of the file names is fixed to .FN3. (For the FN3 functions, refer to Chapter 16, "Extended Functions" or the "BHT-BASIC Extension Library Manual.") • functionnumber is the function number of an FN3 specified by "[drivename:]filename". • data is a variable for the function number of the FN3 (that is, it is used as an argument to the FN3 function). • When specifying an array to data, add a pair of parentheses containing nothing as shown below.
Chapter 14. Statement Reference NOTE To use FN3 functions except extended functions given in Chapter 16, you need to download the extension programs from an extension library sold separately. (The BHT-BASIC Extension Library is supported by the BHT5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500.) ■ Calling a user-defined function (SUB function) This statement calls a user-defined function specified by functionname. You may omit CALL when calling a SUB function.
Run-time errors: Error code Meaning 02h Syntax error ("[drivename:]filename" is in incorrect syntax or the extension is not .FN3.) 05h Parameter value out of range (In calling an FN3 function, the number of parameters exceeds 16.) 07h Insufficient memory space (You nested calling statements of a user-defined function to more than 10 levels.
Chapter 14. Statement Reference Flow control statement CHAIN Transfers control to another program. Syntax: CHAIN "[drivename:]programfilename" Parameter: "[drivename:]programfilename" A string expression. Description: CHAIN transfers control to a program specified by "[drivename:]programfilename". That is, it terminates the current running program (1st program) and closes all of the files being opened.
Syntax errors: Error code and message Meaning error 3: ’"’ missing No double quote precedes or follows [drivename:]programfilename. error 71: Syntax error [drivename:]programfilename is not enclosed in double quotes. Run-time errors: Error code Meaning 02h Syntax error ("[drivename:]programfilename" is in incorrect sytax or the extension is not .PD3.) 07h Insufficient memory space (The 1st program uses too many variables.
Chapter 14. Statement Reference CLear FILE File I/O statement CLFILE Erases the data stored in a data file. Syntax: CLFILE [#]filenumber Parameter: filenumber A numeric expression which returns a value from 1 to 16. Description: CLFILE erases data in the data file specified by filenumber and resets the number of written records in the directory to zero. • The memory area freed by CLFILE can be used for other data files or user program files. • User programs can no longer refer to the erased data.
Example: OPEN "master.
Chapter 14. Statement Reference ‘File I/O statement CLOSE Closes file(s). Syntax: CLOSE [[#]filenumber[,[#]filenumber...]] Parameter: filenumber A numeric expression which returns a value from 1 to 16. Description: CLOSE closes file(s) specified by filenumber(s). • The file number(s) closed by the CLOSE statement becomes available for a subsequent OPEN statement. • If no file number is specified, the CLOSE statement closes all of the opened data files and device I/O files.
CLear Screen I/O statement CLS Clears the LCD screen. Syntax: CLS Description: CLS clears the liquid crystal display (LCD) screen and returns the cursor to the upper left corner of the screen. • The CLS statement does not affect the screen mode (the single-byte ANK mode, two-byte Kanji mode, and condensed two-byte Kanji mode) or the character attribute (normal or highlighted), but it turns off the cursor.
Chapter 14. Statement Reference Declarative statement COMMON Declares common variables for sharing between user programs. Syntax: COMMON commonvariable[,commonvariable...] Parameter: commonvariable A non-array integer variable, a non-array real variable, a non-array string variable, an array integer variable, an array real variable, or an array string variable. Description: COMMON defines common variables for sharing them when one program chains to another.
Syntax errors: Error code and message Meaning error 5: Variable name redefinition A same variable name is double declared in a program. error 73: Improper string length The length of a string variable is out of the range from 1 to 255. Run-time errors: Error code Meaning 07h Insufficient memory space (The COMMON statement defines too much data.
Chapter 14. Statement Reference Declarative statement CONST Defines symbolic constants to be replaced with labels. Syntax: CONST constname = expr Parameter: constname A label, identifier, or string expression of a maximum of 10 characters consisting of alphanumerics and period (.). expr A string constant Description: CONST replaces a label, identifier or a character string specified by constname with a string constant defined by expr before compiling.
I/O statement CURSOR Turns the cursor on or off. Syntax: CURSOR {ON|OFF} Description: When a user program is initiated, the cursor is set to OFF. CURSOR ON turns on the cursor for keyboard entry operation by the INKEY$ function. CURSOR OFF turns off the cursor. • In the BHT-3000/BHT-4000/BHT-5000, the cursor size depends upon the screen mode (the single-byte ANK mode, two-byte Kanji mode, or condensed two-byte Kanji mode).
Chapter 14. Statement Reference Declarative statement DATA Stores numeric and string literals for READ statements. Syntax: DATA literal[,literal...] Parameter: literal A numeric or string constant. Description: DATA stores numeric and string literals so that READ statements can assign them to variables. • A DATA statement can appear anywhere in a source program. • A string data should be enclosed with a pair of double quotation marks ("). • You may have any number of DATA statements in a program.
User-defined function declarative statement DECLARE Declares user-created function FUNCTION or SUB externally defined. Syntax: Syntax 1 (Defining a numeric FUNCTION): DECLARE FUNCTION funcname [(dummyparameter[,dummyparameter...])] Syntax 2 (Defining a character FUNCTION): DECLARE FUNCTION funcname [(dummyparameter [,dummyparameter...])][[stringlength]] Syntax 3 (Defining a SUB): DECLARE SUB subname[(dummyparameter [,dummyparameter...
Chapter 14. Statement Reference Description: DECLARE defines a user-created function defined in other source program files. • Declaration of a user-defined function should appear preceding a calling statement of the user-defined function in your source program. • funcname, subname, and dummyparameter should be declared in the same way as the function names and real parameters defined in the original functions (defined in other source program files).
DEFine FuNction User-created function definition statement DEF FN (Single-line form) Names and defines a user-created function. Syntax: Syntax 1 (Defining a numeric function): DEF FNfunctionname[(dummyparameter[,dummyparameter ...])]=expression Syntax 2 (Defining a string function): DEF FNfunctionname[(dummyparameter [,dummyparameter...])] [[stringlength]]=expression Syntax 3 (Calling the function): FNfunctionname[(realparameter[,realparameter ...
Chapter 14. Statement Reference Description: ■ Creating a user-defined function DEF FN creates a user-defined function. • Definition of a user-defined function should appear preceding a calling statement of the user-defined function in a source program. • You cannot make double definition to a same function name. • The DEF FN statement should not be defined in the block-structured statements (DEF FN...END DEF, FOR...NEXT, FUNCTION...END FUNCTION, IF...THEN ...ELSE...END IF, SELECT...CASE...
Syntax errors: ■ When defining a user-defined function Error code and message Meaning error 61: Cannot use DEF FN in control structure The DEF FN statement is defined in block-structured statements such as FOR and IF statements. error 64: Function redefinition You made double definition to a same function name. error 65: Function definitions exceed 200 error 66: Arguments exceed 50 error 71: Syntax error • functionname is an integer function name, but expression is a real type.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 07h Insufficient memory space (You nested DEF FN statements to more than 10 levels.) 0Fh String length out of the range (The returned value of the stringlength exceeds the allowable range.
DEFine FuNction...END DEFine User-created function definition statement DEF FN...END DEF (Block form) Names and defines a user-created function. Syntax: Syntax 1 (Defining a numeric function): DEF FNfunctionname[(dummyparameter[,dummyparameter ...])] Syntax 2 (Defining a character function): DEF FNcharafunctionname[(dummyparameter [,dummyparameter...
Chapter 14. Statement Reference Description: ■ Creating a user-defined function DEF FN...END DEF creates a user-defined function. The function definition block between DEF FN and END DEF is a set of some statements and functions. • Definition of a user-defined function should appear preceding a calling statement of the user-defined function in a source program. • You cannot make double definition to a same function name.
■ Calling a user-defined function FNfunctionname calls a user-defined function. • The number of realparameters should be equal to that of dummyparameters, and the types of the corresponding variables used in those parameters should be identical. • If you specify a global variable in realparameter when calling a user-defined function, the user-defined function cannot update the value of the global variable. This is because all realparameters are passed not by address but by value.
Chapter 14. Statement Reference ■ When calling a user-defined function Error code and message Meaning error 68: Mismatch argument type or number • The number of the real parameters is not equal to that of the dummy parameters. • dummyparameter was an integer variable in defining a function, but realparameter is a real type in calling the function. (If dummyparameter was a real variable in defining a function and realparameter is an integer type, then no error occurs.
DEFine REGister Declarative statement DEFREG Defines register variables. Syntax: DEFREG registerdefinition[,registerdefinition ...] Parameter: registerdefinition non-arraynumericvariable [=numericconstant] DEFREG n1%=10 DEFREG n2=12.
Chapter 14. Statement Reference numericinitialvaluedefinition For one-dimensional: numericconstant[,numericconstant...]} DEFREG n6%(3)={9,8,7,6} For two-dimensional: {{numericconstant[,numericconstant...]}, {numericconstant[,numericconstant...]} ...} DEFREG n7(1,2)={{10,11,12},{13,14,15}} stringinitialvaluedefinition For one-dimensional: {stringconstant[,stringconstant...]} DEFREG s3$(3)={"a","bc","123","45"} For two-dimensional: {{stringconstant[,stringconstant...]}, constant[,stringconstant...]} ...
Syntax errors: Error code and message Meaning error 6: Variable name redefinition A same register variable name is double declared in a program. error 71: Syntax error • stringlength is not an integer constant. • The number of the specified initial values is greater than that of the array elements. • The list of initial values is terminated with a comma. • The type of the specified variable does not match that of its initial value.
Chapter 14.
s DIMension Memory control statement DIM Declares and dimensions arrays; also declares the string length for a string variable. Syntax: DIM arraydeclaration[,arraydeclaration...
Chapter 14. Statement Reference • In declaring an array string variable, you can specify the string length. If its specification is omitted, the default value of 20 characters takes effect. • If no subscript is specified for a string variable, the Compiler automatically regards the string variable as a non-array string variable so that the default for a non-array string variable, 40 characters, takes effect.
Flow control statement END Terminates program execution. Syntax: END Description: END terminates program execution and sounds the beeper for a second. • An END can appear anywhere in a source program. • When an END statement occurs, all of the files being opened become closed, and then the following operation takes place depending upon whether or not any application program (user program or Easy Pack) has been selected as an execution program (to be run when the BHT is powered on) in System Mode.
Chapter 14. Statement Reference Memory control statement ERASE Erases array variables. Syntax: ERASE arrayvariablename[,arrayvariablename...] Parameter: arrayvariablename An array numeric or array string variable. Description: ERASE erases an array variable(s) specified by arrayvariablename and frees the memory used by the array. • arrayvariablename is the name of an array variable already declared by the DIM statement. If it has not been declared by DIM, the ERASE statement will be ignored.
File I/O statement FIELD Allocates string variables as field variables. Syntax: FIELD [#]filenumber,fieldwidth AS fieldvariable [,fieldwidth AS fieldvariable...] Parameter: filenumber A numeric expression which returns a value from 1 to 16. fieldwidth A numeric expression which returns a value from 1 to 254. fieldvariable A non-array string variable. Description: FIELD declares the length and field variable of each field of a record in a data file.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error filenumber is missing. Run-time errors: Error code Meaning 05h Parameter out of the range (fieldwidth out of the range) 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a file other than data files.
Flow control statement FOR...NEXT Defines a loop containing statements to be executed a specified number of times. Syntax: FOR controlvariable = initialvalue TO finalvalue [STEP increment] . . . NEXT [controlvariable] Parameter: controlvariable A non-array numeric variable. initialvalue, finalvalue, and increment Numeric expressions.
Chapter 14. Statement Reference • The default value of increment is 1. • You can nest FOR...NEXT statements to a maximum of 10 levels. • When using the FOR...NEXT statement together with block-structured statements (DEF FN...END DEF, FOR...NEXT, FUNCTION...END FUNCTION, IF...THEN ...ELSE...END IF, SELECT...CASE...END SELECT, SUB...END SUB and WHILE...WEND), you can nest them to a maximum of 30 levels. • A same controlvariable should not be reused in a nested loop.
User-defined function statement FUNCTION…END FUNCTION Names and defines user-created function FUNCTION. Syntax: Syntax 1 (Defining a numeric function): FUNCTION funcname [(dummyparameter [,dummyparameter...])] Syntax 2 (Defining a character function): FUNCTION funcname [(dummyparameter [,dummyparameter...
Chapter 14. Statement Reference Description: ■ Creating a user-defined function FUNCTION...END FUNCTION creates a user-defined function. The function definition block between FUNCTION and END FUNCTION is a set of some statements and functions. • You cannot make double definition to a same function name. • This statement block should not be defined in the block-structured statements (DEF FN...END DEF, FOR...NEXT, FUNCTION...END FUNCTION, IF...THEN ...ELSE...END IF, SELECT...CASE...END SELECT, SUB...
• If you specify a global variable in realparameter when calling a user-defined function, the user-defined function cannot update the value of the global variable. This is because all realparameters are passed not by address but by value. (So called "Call-by-value") NOTE Before any call to a FUNCTION...END FUNCTION, you need to place definition of the FUNCTION function or declaration of the FUNCTION by the DECLARE statement in your source program. A function name is defined globally.
Chapter 14. Statement Reference Error code and message Meaning error 96: Incomplete control structure (FUNCTION...END FUNCTION) END FUNCTION is missing. error 97: Cannot use FUNCTION in control structure The FUNCTION…END FUNCTION statement is defined in other blockstructured statements such as FOR and IF statement blocks.
Example: File 1 File 2 DECLARE FUNCTION add(x,y) A=1:B=2 PRINT "TEST" C=add(A,B) PRINT C . . .
Chapter 14. Statement Reference File I/O statement GET Reads a record from a data file. Syntax: GET [#]filenumber[,recordnumber] Parameter: filenumber A numeric expression which returns a value from 1 to 16. recordnumber A numeric expression which returns a value from 1 to 32767. Description: GET reads the record specified by recordnumber from the data file specified by filenumber and assigns the data to the field variable(s) specified by the FIELD statement.
Syntax errors: Error code and message Meaning error 71: Syntax error filenumber is missing. Run-time errors: Error code Meaning 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a file other than data files.) 3Ah File number out of the range 3Eh A PUT or GET statement executed without a FIELD statement. 3Fh Bad record number (No record to be read in a data file.
Chapter 14. Statement Reference Declarative statement GLOBAL Declares one or more work variables or register variables defined in a file, to be global. Syntax: GLOBAL varname [,varname...] Parameter: varname numericvariable [(subscript)] stringvariable [(subscript)[stringlength]] subscript For one-dimensional: integerconstant For two-dimensional: integerconstant, integerconstant Where integerconstant is a numeric expression which returns a value from 0 to 254.
Syntax errors: Error code and message Meaning error 7: Variable name redefinition The array declared with GLOBAL statement had been already declared with DEFREG statement. error 71: Syntax error • stringlength range. is out of the • stringlength is not an integer constant. error 72: Variable name redefinition • A same variable name is double declared inside a same GLOBAL statement. • A same variable name is used for a non-array variable and array variable.
Chapter 14. Statement Reference Flow control statement GOSUB Branches to a subroutine. Syntax: GOSUB label Description: GOSUB calls a subroutine specified by label. • Within the subroutine itself, you use a RETURN statement which indicates the logical end of the subroutine and returns control to the statement just after the GOSUB that called the subroutine. • You may call a subroutine any number of times as long as the Interpreter allows the nest level and other conditions.
Run-time errors: Error code Meaning 03h RETURN without GOSUB statement 07h Insufficient memory space (Too deep nesting) Reference: Statements: RETURN 235
Chapter 14. Statement Reference Flow control statement GOTO Branches to a specified label. Syntax: GOTO label Description: GOTO unconditionally transfers control to a label specified by label. • In an IF statement block, you can omit GOTO immediately following THEN or ELSE, as shown below. IF a=0 THEN Lbl1 ELSE Lbl2 END IF • GOTO allows you to branch anywhere in your program. However, you should branch only to another line in a program module or subroutine at the same program level.
Flow control statement IF...THEN...ELSE...END IF Conditionally executes specified statement blocks depending upon the evaluation of a conditional expression. Syntax: Syntax 1: IF conditionalexpression THEN statementblock1 [ELSE statementblock2] END IF Syntax 2: IF conditionalexpression ELSE statementblock END IF Parameter: conditionalexpression A numeric expression which evaluates to true or false. Description: IF statement block tests whether conditionalexpression is true or false.
Chapter 14. Statement Reference • A block-structured IF statement block has the following advantages over a single-line IF statement (which is not supported in BHT-BASIC): - More complex conditions can be tested since an IF statement block can contain more than one line for describing conditions. - You can describe as many statements or statement blocks as you want.
I/O statement INPUT Reads input from the keyboard into a variable. Syntax: INPUT [;]["prompt"{,|;}]variable Parameter: "prompt" A string constant. variable A numeric or string variable. Description: When execution reaches an INPUT statement, the program pauses and waits for the user to enter data from the keyboard while showing a prompting message specified by "prompt". After typing data, the user must press the ENT key. Then, the INPUT statement assigns the typed data to variable.
Chapter 14. Statement Reference • Even after execution of the CURSOR OFF statement, the INPUT statement displays the cursor. • Data inputted by the user will echo back to the LCD. To assign it to variable, it is necessary to press the ENT key. Pressing the ENT key causes also a line feed. If INPUT is followed by a semicolon (;) in an INPUT statement, however, line feed is suppressed.
Syntax errors: Error code and message Meaning error 71: Syntax error • Neither a comma (,) nor semicolon (;) follows "prompt". • "prompt" is not a string constant. Run-time errors: Error code Meaning 06h The operation result is out of the allowable range. (Numeric variable is out of the range.
Chapter 14. Statement Reference File I/O statement INPUT # Reads data from a device I/O file into specified variables. Syntax: INPUT #filenumber,variable[,variable...] Parameter: filenumber A numeric expression which returns a value from 1 to 16. variable A numeric or string variable. Description: INPUT # reads data from a device I/O file (a communications device file or bar code device file) specified by filenumber and assigns it to variable.
• Notes for entering numeric data: Valid characters include 0 to 9, a minus sign (-), and a period (.). They should be in correct numeric data form. If not, INPUT # statement accepts only numeric data from the first character up to correctly formed character, as valid data. If no valid data is found, the INPUT # statement automatically assigns a zero (0) to variable. If the INPUT # statement reads alphabetical characters with a numeric variable, it automatically assigns a zero (0) to variable.
Chapter 14. Statement Reference I/O statement KEY 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 a magic key as the trigger switch, shift key, or battery voltage display key.
backlightkeynumber (BHT-3000/BHT-4000) A numeric expression which returns a value from 0 to 29. (BHT-5000 with 32-key pad) A numeric expression which returns a value from 0 to 46. (BHT-5000 with 26-key pad) A numeric expression which returns a value from 0 to 34. (BHT-6000) A numeric expression which returns a value from 1 to 31, 33, and 34. (BHT-6500) A numeric expression which returns a value from 1 to 31 and 33 to 38.
Chapter 14. Statement Reference • 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, you specify a null string to stringdata as shown below.
• 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.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error • keynumber is missing. • stringdata is missing. • backlightkeynumber is missing. • stringdata is a numeric expression. Run-time errors: Error code Meaning 05h Parameter out of the range (keynumber, backlightkeynumber, or magickeynumber is out of the range.) Example: Syntax 1: KEY 1,"a" KEY 2,"F"+CHR$(13) KEY 3,"" Syntax 2: KEY 1,"BL60" Reference: Statements: KEY OFF, KEY ON, and ON KEY...
I/O statement KEY ON and KEY OFF Enables or disables keystroke trapping for a specified function key. Syntax: KEY (keynumber){ON|OFF} Parameter: keynumber (BHT-3000/BHT-4000) A numeric expression which returns a value from 1 to 29. (BHT-5000 with 32-key pad) A numeric expression which returns a value from 1 to 46. (BHT-5000 with 26-key pad) A numeric expression which returns a value from 1 to 34. (BHT-6000) A numeric expression which returns a value from 1 to 31, 33, and 34.
Chapter 14. Statement Reference • 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. • In the BHT-6000/BHT-6500/BHT-7000 with 26-key pad/BHT-7500, specifying 32 to keynumber will be ignored. ■ KEY OFF KEY OFF disables keystroke trapping for a function key specified by keynumber.
File I/O statement KILL Deletes a specified file from the memory. Syntax: KILL "[drivename:]filename" Parameter: "[drivename:]filename" A string expression. Description: KILL deletes a data file or a user program file specified by "[drivename:]filename". In the BHT-5000/BHT-6000/BHT-6500, the drivename may be A: or B:. If the drivename is omitted, the default A: applies. In the BHT-7000/BHT-7500, the drivename (A: or B:) will be ignored.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 02h Syntax error (The format of "[drivename:]filename" is not correct.) 35h File not found 37h File already open Example: CLOSE IF kyIn$="Y" THEN KILL "Master.
I/O statement KPLOAD Loads a user-defined Kanji font in the two-byte Kanji mode. This statement also loads a user-defined cursor for the BHT-7000/BHT-7500. Syntax: Syntax 1 (Loading a user-defined Kanji font): KPLOAD kanjicode, fontarrayname Syntax 2 (Loading a user-defined cursor.
Chapter 14. Statement Reference • The loaded user-defined fonts are effective during execution of the user program which loaded those fonts and during execution of the successive user programs chained by the CHAIN statement. • If you load a font to the same kanjicode more than one time, the most recently specified font takes effect. • Only when the Interpreter executes the KPLOAD statement, it refers to the array data defined by fontarrayname.
• An array integer variable--a work array, register array, or common array--for cursorarrayname should be declared by the DIM, DEFREG, or COMMON statement, respectively. DIM kp0%(5) DEFREG kp1%(5) COMMON kp2%(5) The array variable should be one-dimensional and have at least 6 elements. Each element data should be an integer and stored in the area from the 1st to 6th elements of the array.
Chapter 14.
Run-time errors: Error code Meaning 05h Parameter out of the range (• kanjicode is out of the range.) (• fontarrayname or cursorarrayname is not correct.) 08h Array not defined Example: DIM kp%(15) kp%(0)=&H0000 kp%(1)=&H8011 kp%(2)=&H6022 kp%(3)=&H1844 kp%(4)=&H0600 kp%(5)=&H8802 kp%(6)=&H8AF2 kp%(7)=&H4A92 kp%(8)=&H4A97 kp%(9)=&H2A92 kp%(10)=&H1FF2 kp%(11)=&H2A92 kp%(12)=&H4A97 kp%(13)=&H4A92 kp%(14)=&H8AF2 kp%(15)=&H8802 . . .
Chapter 14. Statement Reference Assignment statement LET 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 lefthand side. • In a numeric data assignment, the assignment statement automatically converts an integer value to a real value.
Run-time errors: Error code Meaning 06h The operation result is out of the allowable range. 0Fh String length out of the range (In a string assignment, the string length of the evaluated result on the right-hand side exceeds the maximum length of the string variable on the left-hand side.
Chapter 14. Statement Reference I/O statement LINE INPUT Reads input from the keyboard into a string variable. Syntax: LINE INPUT ["prompt"{,|;}]stringvariable Parameter: "prompt" A string constant. stringvariable A string variable. Description: When execution reaches a LINE INPUT statement, the program pauses and waits for the user to enter data from the keyboard while showing a prompting message specified by "prompt". After typing data, the user must press the ENT key.
If "prompt" is followed by a comma, the statement displays the prompting message but no question mark or space is appended to the prompting message. LINE INPUT "data= ",a$ data= • The cursor shape specified by the most recently executed LOCATE statement takes effect. • Even after execution of the CURSOR OFF statement, the LINE INPUT statement displays the cursor. • Data inputted by the user will echo back to the LCD. To assign it to stringvariable, it is necessary to press the ENT key.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error • INPUT is missing. • Neither a comma (,) or semicolon (;) follows "prompt". • "prompt" is not a string constant. • stringvariable has a numeric variable. • A semicolon (;) immediately follows LINE INPUT.
File I/O statement LINE INPUT # Reads data from a device I/O file into a string variable. Syntax: LINE INPUT #filenumber,stringvariable Parameter: filenumber A numeric expression which returns a value from 1 to 16. stringvariable A string variable. Description: LINE INPUT # reads data from a device I/O file (a communications device file or bar code device file) specified by filenumber and assigns it to stringvariable. • filenumber is a number assigned to the device I/O file when it was opened.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error • INPUT is missing. • filenumber is missing. • "prompt" is not a string constant. • stringvariable has a numeric variable. Run-time errors: Error code Meaning 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a file other than device I/O files.
I/O statement LOCATE Moves the cursor to a specified position and changes the cursor shape. Syntax: Syntax 1: LOCATE [column][,row[,cursorswitch]] Syntax 2: LOCATE,,cursorswitch Parameter: A numeric expression which returns a value given below.
Chapter 14.
• Specification of the maximum value to column moves the cursor off the screen and out of sight. Example: Single-byte ANK mode in the BHT-3000 LOCATE 17 ← Cursor If you display data on the screen under the above condition, the cursor moves to the 1st column of the next row, from where the data appears. • In the BHT-4000, if the system status indication is set to ON, the cursor cannot move to the bottom line of the LCD.
Chapter 14. Statement Reference Error control statement ON ERROR GOTO Enables error trapping. Syntax: ON ERROR GOTO label Description: ON ERROR GOTO enables error trapping so as to pass control to the first line of an error-handling routine specified by label if an error occurs during program execution. • To return control from an error-handling routine to a specified program location, you use a RESUME statement in the error-handling routine. • Specification of zero (0) to label disables error trapping.
Flow control statement ON...GOSUB and ON...GOTO Branches to one of specified labels according to the value of an expression. Syntax: Syntax 1: ON expression GOSUB label [,label...] Syntax 2: ON expression GOTO label [,label...] Parameter: expression A numeric expression which returns a value from 1 to 255. Description: ON...GOSUB or ON...GOTO block branches to a label in the label list according to the value of expression.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error • label has not been defined. • label is missing. Run-time errors: Error code Meaning 05h Parameter out of the range (expression is negative or greater than 255.) 07h Insufficient memory space (The program nesting by GOSUB statements only is too deep.) Reference: Statements: GOSUB, GOTO, and SELECT...CASE...
I/O statement ON KEY...GOSUB Specifies an event-handling routine for keystroke interrupt. Syntax: ON KEY (keynumber) GOSUB label Parameter: keynumber (BHT-3000/BHT-4000) A numeric expression which returns a value from 1 to 29. (BHT-5000 with 32-key pad) A numeric expression which returns a value from 1 to 46. (BHT-5000 with 26-key pad) A numeric expression which returns a value from 1 to 34. (BHT-6000) A numeric expression which returns a value from 1 to 31, 33, and 34.
Chapter 14. Statement Reference • If a keystroke trap occurs, the Interpreter automatically executes KEY OFF statement for the pressed function key before passing control to an event-handling routine specified by label in ON KEY...GOSUB statement. This prevents a same event-handling routine from becoming invoked again by pressing a same function key during execution of the routine until the current event-handling routine is completed by issuing a RETURN statement.
File I/O statement OPEN Opens a file for I/O activities. Syntax: OPEN "[drivename:]filename" AS [#] filenumber [RECORD filelength] Parameter: filenumber A numeric expression which returns a value from 1 to 16. "[drivename:]filename" A string expression. filelength An integer constant which has the value from 1 to 32767. Description: OPEN opens a data file specified by "[drivename:]filename" and associates the opened file with filenumber for allowing I/O activities according to filenumber.
Chapter 14. Statement Reference • In the BHT-7000/BHT-7500, if the drivename is B:, the file specified by filename will be opened as a read-only file. If the drivename is A: or omitted, the file will be opened as a read/write file. • filelength is the maximum number of registrable records in a file. It can be set only when a new data file is created by an OPEN statement. If you specify filelength when opening any of existing data files (including downloaded data files), the filelength will be ignored.
File I/O statement OPEN "BAR:" Opens the bar code device file. In the BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500, this statement also activates or deactivates the reading confirmation LED and the beeper (vibrator) individually. (Vibrator control valid only in the BHT-6500/BHT-7000/BHT-7500) Syntax: OPEN "BAR:[readmode][beepercontrol][LEDcontrol]" AS [#]filenumber CODE readcode[,readcode...] Parameter: readmode A string expression.
Chapter 14. Statement Reference • If the BHT reads a bar code successfully, the indicator LED for reading confirmation will illuminate in green. The BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT7500 may activate or deactivate the indicator LED. The BHT-6500/BHT-7000/ BHT-7500 may activate or deactivate the beeper and vibrator function. • A bar code read will be decoded and then transferred to the barcode buffer.
Auto-off mode (F) OPEN "BAR:F" AS #7 CODE "A" If you press the trigger switch*1, the illumination LED (laser source*2) comes on. When you release the switch or when the BHT completes bard code reading, the illumination LED (laser source*2) will go off. Holding down the trigger switch*1 lights the illumination LED (laser source*2) for a maximum of 5 seconds.
Chapter 14. Statement Reference Continuous reading mode (C) OPEN "BAR:C" AS #7 CODE "A" Upon execution of the above statement, the BHT turns on the illumination LED (laser source*2) and keeps it on until the bar code device file becomes closed, irrespective of the trigger switch*1. While the illumination LED (laser source*2) is on, the BHT can read a bar code.
■ readcode The BHT supports six types of bar codes--the universal product codes, Interleaved 2 of 5 (ITF), Codabar (NW-7), Code 39, Code 93, and Code 128. In addition to them, the BHT-4000/BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT7500 supports the Standard 2 of 5 (STF). The BHT-6000/BHT-6500/BHT-7000/ BHT-7500 can read also EAN-128 if Code 128 is specified. (For the allowable bar code types, refer to the BHT User’s Manual.
Chapter 14. Statement Reference Interleaved 2 of 5 (ITF) (I) Syntax 1: I[:[mini.no.digits[-max.no.digits]][CD]] Syntax 2 (BHT-6500/BHT-7000/BHT-7500): I[:[mini.no.digits[-max.no.digits]][CD] [,[mini.no.digits[-max.no.digits]][CD]] [,[mini.no.digits[-max.no.digits]][CD]]] where mini.no.digits and max.no.digits are the minimum and maximum numbers of digits for bar codes to be read by the BHT, respectively.
Codabar (NW-7) (N) Syntax 1: N[:[mini.no.digits[-max.no.digits]][startstop][CD]] Syntax 2 (BHT-6500/BHT-7000/BHT-7500): N[:[mini.no.digits[-max.no.digits]][startstop][CD] [,[mini.no.digits[-max.no.digits]][startstop][CD]] [,[mini.no.digits[-max.no.digits]][startstop][CD]]] where mini.no.digits and max.no.digits are the minimum and maximum numbers of digits for bar codes to be read by the BHT, respectively.
Chapter 14. Statement Reference Code 39 (M) Syntax 1: M[:[mini.no.digits[-max.no.digits]][CD]] Syntax 2 (BHT-6500/BHT-7000/BHT-7500): M[:[mini.no.digits[-max.no.digits]][CD] [,[mini.no.digits[-max.no.digits]][CD]] [,[mini.no.digits[-max.no.digits]][CD]]] where mini.no.digits and max.no.digits are the minimum and maximum numbers of digits for bar codes to be read by the BHT, respectively.
Code 128 (K) Syntax 1: K[:[mini.no.digits[-max.no.digits]]] Syntax 2 (BHT-6500/BHT-7000/BHT-7500): K[:[mini.no.digits[-max.no.digits]] [,[mini.no.digits[-max.no.digits]]] [,[mini.no.digits[-max.no.digits]]]] where mini.no.digits and max.no.digits are the minimum and maximum numbers of digits for bar codes to be read by the BHT, respectively.
Chapter 14. Statement Reference (2) FNC2 If the BHT reads a bar code containing an FNC2 character(s), it will not buffer such data but transfer it excluding the FNC2 character(s). (3) FNC3 If the BHT-3000/BHT-4000/BHT-5000/BHT-6000 reads a bar code containing an FNC3 character(s), it will transfer it excluding the FNC3 character(s), to the barcode buffer.
Standard 2 of 5 (STF) (H) (For the BHT-4000/BHT-5000/BHT-6000/BHT6500/BHT-7000/BHT-7500) Syntax 1: H[:[mini.no.digits[-max.no.digits]][CD][startstop]] Syntax 2 (BHT-6500/BHT-7000/BHT-7500): H[:[mini.no.digits[-max.no.digits]][CD] [startstop] [,[mini.no.digits[-max.no.digits]][CD] [startstop]] [,[mini.no.digits[-max.no.digits]][CD] [startstop]]] where mini.no.digits and max.no.digits are the minimum and maximum numbers of digits for bar codes to be read.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error The number of the specified read codes exceeds eight. Run-time errors: Error code Meaning 02h Syntax error (readcode is missing.) 05h Parameter out of the range (readcode is not correct.
File I/O statement OPEN "COM:" Opens a communications device file.
Chapter 14. Statement Reference parity N, E, or O charalength 8 or 7 stopbit 1 or 2 RS/CS 0, 1, 2, 3 or 4 timeout An integer numeral from 0 to 255. RS 0 or 1 ER 0 or 1 filenumber A numeric expression which returns a value from 1 to 16. Description: OPEN "COM:" opens a communications device file and associates it with filenumber for allowing input/output activities using the communications interface.
■ COMn COMn is a communications device file name. For the BHT-3000 which supports both the optical and direct-connect interfaces and can open them concurrently, you can set both "COM1:" and "COM2:". For the BHT-4000/BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500 which supports both the optical and direct-connect interfaces but cannot open them concurrently, you should set one of the specifications listed above. If you attempt to open both interfaces concurrently, a run-time error will occur.
Chapter 14. Statement Reference ■ stopbit stopbit is the number of stop bits. It should be 1 (default) or 2 bits. NOTE The optical interface of the BHT-6000/BHT-6500/BHT-7000/BHT-7500 is compliant with the IrDA physical layer (IrDA-SIR1.0), so the vertical parity, character length, and stop bit length are fixed to none, 8 bits, and 1 bit, respectively. If selected, those parameters will be ignored. ■ RS/CS RS/CS enables or disables the RS/CS control.
Shown below is a coding sample for enabling the RS/CS control. OPEN "COM:,,,,1" AS #16 Instead of the OPEN "COM:" statement, you can use an OUT statement for controlling the RS signal (supported by the optical interface of the BHT-5000 and by the BHT-4000) or the ER signal (which is supported by the BHT-4000). Also, you can use a WAIT statement or INP function for monitoring the CS signal or CD signal (supported by the BHT-4000).
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error filenumber is missing. Run-time errors: Error code Meaning 02h Syntax error (The x in "COM:x" contains an invalid parameter.) 37h File already open 3Ah File number out of the range 45h File already open (You attempted to open the bar code device file and the optical interface of the communications device file concurrently in the BHT-6000/BHT-6500/BHT-7000/BHT-7500.
I/O statement OUT Sends a data byte to an output port. Syntax: OUT portnumber,data Parameter: portnumber A numeric expression. data A numeric expression which returns a value from 0 to 255. Description: OUT sends a data byte designated by data to a port specified by portnumber. • portnumber is not an actual hardware port number on the BHT but a logical one which the Interpreter assigns. (Refer to Appendix D, "I/O Ports.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 05h Parameter out of the range (portnumber or data is out of the range.) Example: OUT 3,7 The above example sets the LCD contrast to the maximum.
I/O statement POWER Controls the automatic power-off facility. Syntax: Syntax 1 (Turning off the power according to the power-off counter): POWER counter Syntax 2 (Turning off the power immediately): POWER {OFF|0} Syntax 3 (Disabling the automatic power-off facility): POWER CONT Parameter: counter A numeric expression which returns a value from 0 to 32767.
Chapter 14. Statement Reference ■ Turning off the power immediately Execution of POWER OFF or POWER 0 immediately turns off the power. • The execution of POWER OFF or POWER 0 deactivates the resume function if preset. ■ Disabling the automatic power-off facility POWER CONT disables the automatic power-off facility. Run-time errors: Error code Meaning 05h Parameter out of the range (counter is out of the range.
I/O statement PRINT Displays data on the LCD screen. Syntax: PRINT [data[CR/LFcontrol...]] Parameter: data A numeric or string expression. CR/LFcontrol A comma (,) or a semicolon (;). Description: PRINT displays a number or a character string specified by data at the current cursor position on the LCD screen (To position the cursor, use a LOCATE statement.) and then repositions the cursor according to CR/LFcontrol.
Chapter 14. Statement Reference • In the BHT-6000/BHT-6500/BHT-7000/BHT-7500, data may be displayed in standard size or small size depending upon the display font size selected. • If you omit data option, a blank line is outputted. That is, the cursor moves to the first column of the next screen line. • Positive numbers and zero automatically display with a leading space. • Control codes (08h to 1Fh) appear as a space, except for BS (08h), CR (0Dh) and C (18h) codes.
• If neither a comma (,) nor semicolon (;) is specified to CR/LFcontrol, the cursor moves to the first column on the next screen line. Statement example: PRINT 123 Output: 123 _ In any of the above cases, the screen automatically scrolls up so that the cursor always positions in view on the LCD screen. To extend one program line to more than 512 characters in a single PRINT statement, you should use an underline (_) preceding a CR code, not a comma (,) preceding a CR code.
Chapter 14. Statement Reference File I/O statement PRINT # Outputs data to a communications device file. Syntax: PRINT #filenumber[,data[CR/LFcontrol...]] Parameter: filenumber A numeric expression which returns a value from 1 to 16. data A numeric or string expression. CR/LFcontrol A comma (,) or a semicolon (;). Description: PRINT # outputs a numeric value or a character string specified by data to a communications device file specified by filenumber.
• If CR/LFcontrol is a semicolon (;), the PRINT # statement outputs data without adding spaces or control codes. Statement example: PRINT #1,"ABC";"123"; Output: ABC123 • If neither a comma (,) nor semicolon (;) is specified to CR/LFcontrol, the PRINT # statement adds a CR and LF codes.
Chapter 14. Statement Reference I/O statement PRINT USING Displays data on the LCD screen under formatting control. Syntax: Syntax 1 (Displaying numbers): PRINT USING "numericformat";expression[CR/LFcontrol [expression]...] Syntax 2 (Displaying strings): PRINT USING "stringformat";stringexpression [CR/LFcontrol[stringexpression]...] Parameter: numericformat #, a decimal point (.), and/or +. stringformat !, @, and/or & CR/LFcontrol A comma (,) or a semicolon (;).
■ numericformat numericformat is a formatting string consisting of #, decimal point (.), and/or +, each of which causes a special printing effect as described below. # Represents a digit position. If the number specified by expression has fewer digits than the number of digit positions specified by #, it is padded with spaces and right-justified.
Chapter 14. Statement Reference ■ stringformat stringformat is a formatting string consisting of !, @, and/or &&, each of which causes a special printing effect as described below. ! Displays the first character of the stringexpression. Statement example: PRINT USING "!";"ABC" Output: A @ Displays the entire stringexpression.
■ CR/LFcontrol CR/LFcontrol determines where the cursor is to be positioned after the PRINT USING statement executes. For details, refer to the CR/LFcontrol in the PRINT statement. Syntax errors: Error code and message Meaning error 71: Syntax error • numericformat is not correct. • expression or stringexpression contains a comma (,) or semicolon (;). No semicolon (;) follows "numericformat" or "string-format".
Chapter 14. Statement Reference Declarative statement PRIVATE Declares one or more work variables or register variables defined in a file, to be private. Syntax: Syntax 1: PRIVATE varname [,varname...] Syntax 2: PRIVATE DEFREG registerdefinition [,registerdefinition...
subscript For one-dimensional: integerconstant For two-dimensional: integerconstant,integerconstant Where integerconstant is a numeric expression which returns a value from 0 to 254. stringlength An integer constant from 1 to 255. Description: PRIVATE allows variables declared by varname or registerdefinition to be referred to or updated in that file. • Inside one PRIVATE statement, up to 30 variables can be declared to varname or registerdefinition.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 05h Parameter out of the range 07h Insufficient memory space (The variable area has run out.) 0Ah Duplicate definition (An array is double declared.
File I/O statement PUT Writes a record from a field variable to a data file. Syntax: PUT [#]filenumber[,recordnumber] Parameter: filenumber A numeric expression which returns a value from 1 to 16. recordnumber A numeric expression which returns a value from 1 to 32767. Description: PUT writes a record from a field variable(s) declared by the FIELD statement to a data file specified by filenumber. • filenumber is the number of a data file opened by the OPEN statement.
Chapter 14. Statement Reference Syntax errors: Error code and message Meaning error 71: Syntax error filenumber is missing. Run-time errors: Error code Meaning 05h Parameter out of the range (• filenumber is out of the range.) (• recordnumber is out of the range.) 07h Insufficient memory space 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a file other than data files.
I/O statement READ Reads data defined by DATA statement(s) and assigns them to variables. Syntax: READ variable[,variable...] Parameter: variable A numeric or string variable. Description: READ reads as many data values as necessary in turn from data stored by DATA statement and assigns them, one by one, to each variable in the READ statement.
Chapter 14. Statement Reference If the string data is invalid as numeric data, the READ statement assigns the value 0 to the numeric variable. Statement example: DATA "ABC" READ c PRINT c Output: 0 • The number of data values stored by the DATA statement must be equal to or greater than that of variables specified by the READ statement. If not, a run-time error occurs. • To specify the desired DATA statement location where the READ statement should start reading data, you use the RESTORE statement.
Declarative statement REM Declares the rest of a program line to be remarks or comments. Syntax: Syntax 1: REM comment Syntax 2: ’ comment Description: REM causes the rest of a program line to be treated as a programmer’s remark or comment for the sake of the program readability and future program maintenance. The remark statements are non-executable. • Difference in description between syntax 1 and syntax 2: The keyword REM cannot begin in the first column of a program line.
Chapter 14. Statement Reference I/O statement RESTORE Specifies a DATA statement location where the READ statement should start reading data. Syntax: RESTORE [label] Description: RESTORE specifies a DATA statement location where the READ statement should start reading data, according to label designating the DATA statement. • You can specify DATA statements in included files. • If label option is omitted, the default label is a DATA statement appearing first in the user program.
Error control statement RESUME Causes program execution to resume at a specified location after control is transferred to an error-handling routine. Syntax: Syntax 1: RESUME [0] Syntax 2: RESUME NEXT Syntax 3: RESUME label Description: RESUME returns control from the error-handling routine to a specified location of the main program to resume program execution. • The RESUME statement has three forms as listed below. The form determines where execution resumes.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 14h RESUME without error (RESUME statement occurs outside of an error-handling routine.
Flow control statement RETURN Returns control from a subroutine or an event-handling routine (for keystroke interrupt). Syntax: RETURN Description: RETURN statement in a subroutine returns control to the statement immediately following the GOSUB that called the subroutine. RETURN statement in an event-handling routine for keystroke interrupt returns control to the program location immediately following the one where the keystroke trap occurred.
Chapter 14. Statement Reference I/O statement SCREEN Sets the screen mode and the character attribute. Syntax: Syntax 1: SCREEN screenmode[,charaattribute] Syntax 2: SCREEN ,charaattribute Parameter: screenmode and charaattribute A numeric expression which returns a value from 0 to 3. Description: SCREEN sets the screen mode and the character attribute of the LCD screen according to screenmode and charaattribute, respectively, as listed below.
• At program startup, the defaults--single-byte ANK mode and normal display--are active. • If a parameter is omitted, the corresponding screen mode or character attribute does not change. • In the two-byte Kanji mode, characters can be displayed in either the full-width size (16 dots wide by 16 dots high) or the half-width size (8 dots wide by 16 dots high).
Chapter 14. Statement Reference Flow control statement SELECT...CASE...END SELECT Conditionally executes one of statement blocks depending upon the value of an expression. Syntax: SELECT conditionalexpression CASE test1 [statementblock] [CASE test2 [statementblock]]... [CASE ELSE [statementblock]] END SELECT Parameter: conditionalexpression, test1, and test2 A numeric or string expression.
• You can nest the SELECT…CASE…END SELECT statements to a maximum of 10 levels. SELECT a CASE 1 SELECT b CASE 3 PRINT "a=1,b=3" END SELECT CASE 2 PRINT "a=2" END SELECT • When using the SELECT...CASE statement block together with block-structured statements (DEF FN...END DEF, FOR...NEXT, FUNCTION...END FUNCTION, IF...THEN...ELSE...END IF, SELECT...CASE...END SELECT, SUB...END SUB and WHILE...WEND), you can nest them to a maximum of 30 levels.
Chapter 14. Statement Reference User-defined function statement SUB...END SUB Names and defines user-created function SUB. Syntax: Syntax 1 (Defining a numeric function): SUB subname [(dummyparameter[,dummyparameter]...)] Syntax 2 (Exiting from the function block prematurely): EXIT SUB Syntax 3 (Ending the function block): END SUB Syntax 4 (Calling a function): [CALL] subname[(realparameter[,realparameter]...
Description: ■ Creating a user-defined function SUB...END SUB creates a user-defined function. The function definition block between SUB and END SUB is a set of some statements and functions. • You cannot make double definition to a same function name. • This statement block should not be defined in the block-structured statements (DEF FN...END DEF, FOR...NEXT, FUNCTION...END FUNCTION, IF...THEN ...ELSE...END IF, SELECT...CASE...END SELECT, SUB...END SUB, and WHILE...
Chapter 14. Statement Reference NOTE Before any call to a SUB...END SUB function, you need to place definition of the SUB function or declaration of the SUB by the DECLARE statement in your source program. A function name is defined globally. If more than one same function name exists in a same project, therefore, a multiple symbol definition error will occur when files will be linked. The same error will occur also if the SUB...
■ When calling a user-defined function Error code and message Meaning error 68: Mismatch argument type or number • The number of the real parameters is not equal to that of the dummy parameters. • dummyparameter was an integer variable in defining a function, but realparameter is a real type in calling the function. (If dummyparameter was a real variable in defining a function and realparameter is an integer type, then no error occurs.
Chapter 14. Statement Reference I/O statement WAIT Pauses program execution until a designated input port presents a given bit pattern. Syntax: WAIT portnumber,ANDbyte[,XORbyte] Parameter: portnumber A numeric expression ANDbyte and XORbyte A numeric expression which returns a value from 0 to 255. Description: WAIT suspends a user program while monitoring the input port designated by portnumber until the port presents the bit pattern given by ANDbyte and XORbyte. (Refer to Appendix D, "I/O Ports.
Syntax errors: Error code and message Meaning error 71: Syntax error • portnumber is missing. • ANDbyte is missing. Run-time errors: Error code Meaning 05h Parameter out of the range Example: WAIT 0,&H03 The above statement suspends a user program until any data is inputted from the keyboard or the bar code reader.
Chapter 14. Statement Reference Flow control statement WHILE...WEND Continues to execute a statement block as long as the conditional expression is true. Syntax: WHILE conditionalexpression [statementblock] WEND Description: A WHILE...WEND continues to execute statementblock as long as the conditionalexpression is true (not zero) according to the steps below. (1) The conditionalexpression in the WHILE statement is evaluated.
Syntax errors: Error code and message Meaning error 26: Too deep nesting. error 57: Incorrect use of WHILE...WEND WEND appears outside of the WHILE error 58: Incomplete control structure No WEND corresponds to WHILE. Reference: Statements: FOR…NEXT 329 statement block.
Chapter 14. Statement Reference I/O statement XFILE Transmits a designated file according to the specified communications protocol. Syntax: XFILE "[drivename:]filename"[,"protocolspec"] Parameter: "[drivename:]filename" and "protocolspec" String expressions. Description: XFILE transmits a data file designated by "[drivename:]filename" between the BHT and host computer or between BHTs according to the communications protocol specified by "protocolspec.
- Transmission direction Parameter omitted (default) Transmits a file from the BHT. Receives a file from the host computer or any other BHT. R or r Example: XFILE "d2.dat","R" "[drivename:]filename" cannot be omitted even in file reception. - Serial number Parameter omitted (default) No serial number setting. Adds a serial number to every transmission block. S or s Example: XFILE "d2.dat","S" A serial number immediately follows a text control character heading each transmission block.
Chapter 14. Statement Reference - Timeout length when a link will be established (for the BHT-5000/BHT-6000/BHT6500/BHT-7000/BHT-7500) Specify the timeout length by 1 to 9. Uploading Set value Downloading BHT-protocol BHT-Ir protocol 1 30 sec. Retries of ENQ, 10 times Retries of ENQ, 60 times 2 60 sec. Retries of ENQ, 20 times Retries of ENQ, 120 times 3 90 sec. Retries of ENQ, 30 times Retries of ENQ, 180 times 4 120 sec. Retries of ENQ, 40 times Retries of ENQ, 240 times 5 150 sec.
• A communications device file should be opened before execution of the XFILE statement. (For the file opening, refer to the OPEN "COM:" statement.) • The XFILE statement uses the interface specified by the OPEN "COM:" statement. (If an XFILE statement is executed in the BHT-3000, not the interface specified by the OPEN "COM:" statement but the interface selected for the BHT-BASIC on the Set Com menu in System Mode will become active.) • A data file to be transmitted should be closed beforehand.
Chapter 14. Statement Reference Run-time errors: Error code Meaning 02h Syntax error ([drivename:]filename is not correct.) 07h Insufficient memory space (During file reception, the memory runs out.) 32h File type mismatch (The received file is not a data file.) 33h Received text format not correct 34h Bad file name or number (You specified filename of an unopened file.) 35h File not found 37h File already open 38h The file name is different from that in the receive header.
File I/O statement $INCLUDE Specifies an included file. Syntax: Syntax 1: REM $INCLUDE:’filename’ Syntax 2: ’$INCLUDE:’filename’ Description: $INCLUDE reads a source program specified by ’filename’ into the program line immediately following the $INCLUDE line in compilation. Storing definitions of variables, subroutines, user-defined functions, and other data to be shared by source programs into the included files will promote application of valuable program resources.
Chapter 14. Statement Reference Fatal Error: Error code and message Meaning fatal error 30: Cannot find include file "XXX" No included file is found. fatal error 31: Cannot nest include file Included files are nested.
Additional Explanation for Statements ■ Effective range of labels Labels are effective only in a file. ■ Definition of common variables (by COMMON statement) In an object to be executed first (that is, in a main object), you should define all common variables to be accessed. In any other objects, declare common variables required only in each object. If a first executed object is linked with an object where an undefined common variable(s) is newly defined, an error will result.
Chapter 15 Function Reference CONTENTS ABS ..................................................... 339 ASC ..................................................... 340 BCC$ ................................................... 341 CHKDGT$ ........................................... 343 CHR$ .................................................. 347 COUNTRY$ ........................................ 349 CSRLIN ............................................... 351 DATE$ .................................................
Chapter 15. Function Reference ABSolute Numeric function ABS Returns the absolute value of a numeric expression. Syntax: ABS(numericexpression) Description: ABS returns the absolute value of numericexpression. The absolute value is the magnitude of numericexpression without regard to sign. For example, both ABS (-12.34) and ABS (12.34) are equal to 12.34. • If you give a real number, this function returns a real number; if an integer number, this function returns an integer number.
ASCii code String function ASC Returns the ASCII code value of a given character. Syntax: ASC(stringexpression) Description: ASC returns the ASCII code value of the first character of stringexpression, which is an integer from 0 to 255. (For the ASCII character codes, refer to Appendix C, "Character Sets.") • If stringexpression is a null string, this function returns the value 0. • If given a two-byte Kanji character, this function cannot return the two-byte Kanji code.
Chapter 15. Function Reference Block Check Character String function BCC$ Returns a block check character (BCC) of a data block. Syntax: BCC$(datablock,checktype) Parameter: datablock A string expression. checktype A numeric expression which returns a value from 0 to 2. Description: BCC$ calculates a block check character (BCC) of datablock according to the block checking method specified by checktype, and returns the BCC.
Run-time errors: Error code Meaning 05h Parameter out of the range (checktype is out of the range.
Chapter 15. Function Reference CHecK DiGiT String function CHKDGT$ Returns a check digit of bar code data. Syntax: CHKDGT$(barcodedata,CDtype) Parameter: barcodedata and CDtype String expressions. Description: CHKDGT$ calculates a check digit (CD) of barcodedata according to the calculation method specified by CDtype, and then returns it as one-character string. • CDtype is A, H, I, M or N, which specifies the bar code type and the corresponding calculation method as listed below.
Sample coding 4: CD.Data$=CHKDGT$("a123Qa","N") "Q" is a CD position character, so CHKDGT$ calculates the correct CD and CD.Data$ will become "-." ■ When CDtype is A (EAN or UPC), CHKDGT$ identifies the EAN or UPC of barcodedata depending upon the data length (number of digits) as listed below. Data length of barcodedata Universal Product Codes 13 EAN-13 or UPC-A 8 EAN-8 7 UPC-E If the data length is a value other than 13, 8, and 7, this function returns a null string.
Chapter 15. Function Reference ■ When CDtype is I (ITF), the length of barcodedata must be an even number of two or more digits. If not, CHKDGT$ returns a null string. - To check that the CD is correct: Pass a CD-suffixed barcodedata to a CHKDGT$ as shown below. If the returned value is equal to the CD, the CD data is suitable for the barcodedata. Sample coding: IF CHKDGT$("123457","I")="7" THEN... - To add a CD to barcode data: Pass barcodedata followed by a dummy character to a CHKDGT$ as shown below.
■ When CDtype is N (Codabar), the length of barcodedata must be three digits or more including start and stop characters. If not, CHKDGT$ returns a null string. - To check that the CD is correct: Pass a CD-suffixed barcodedata to a CHKDGT$ as shown below. If the returned value is equal to the CD, the CD data is suitable for the barcodedata. Sample coding: IF CHKDGT$("a0123-a","N")="-" THEN...
Chapter 15. Function Reference CHaRacter code String function CHR$ Returns the character corresponding to a given ASCII code. Syntax: CHR$(characode) Parameter: characode A numeric expression which returns a value from 0 to 255. Description: CHR$ converts a numerical ASCII code specified by characode into the equivalent single-byte character. This function is used to send control codes (e.g.
• To display a Kanji code, use a shift JIS code as shown below. The shift JIS code for is 8ABFh.
Chapter 15. Function Reference COUNTRY I/O function COUNTRY$ Sets a national character set or returns a current country code. Syntax: Syntax 1 (Setting a national character set): COUNTRY$="countrycode" Syntax 2 (Returning a country code): COUNTRY$ Parameter: countrycode A string expression--A, D, E, F, G, I, J, N, S, or W Description: ■ Syntax 1 COUNTRY$ sets a national character set specified by "countrycode". The national character set is assigned to codes from 32 (20h) to 127 (7Fh).
• After setting a national character set, you may display it for codes from 32 (20h) to 127 (7Fh), on the LCD. • If "countrycode" is omitted, the default national character set is America (code A) or Japan (code J) when you have selected the English or Japanese message version on the menu screen* in System Mode, respectively.
Chapter 15. Function Reference CurSoR LINe I/O function CSRLIN Returns the current row number of the cursor. Syntax: CSRLIN Description: CSRLIN returns the current row number of the cursor as an integer, in the current screen mode selected by a SCREEN statement.
DATE I/O function DATE$ Returns the current system date or sets a specified system date. Syntax: Syntax 1 (Retrieving the current system date): DATE$ Syntax 2 (Setting the current system date): DATE$="date" Parameter: date A string expression. Description: ■ Syntax 1 DATE$ returns the current system date as an 8-byte string. The string has the format below. yy/mm/dd where yy is the lower two digits of the year from 00 to 99, mm is the month from 01 to 12, and dd is the day from 01 to 31.
Chapter 15. Function Reference Run-time errors: Error code Meaning 05h Parameter out of the range (date is out of the range.
End Of File File I/O function EOF Tests whether the end of a device I/O file has been reached. Syntax: EOF([#]filenumber) Parameter: filenumber A numeric expression which returns a value from 1 to 16. Description: EOF tests for an end of a device I/O file designated by filenumber. Then it returns -1 (true) if no data remains; it returns 0 (false) if any data remains, as listed below.
Chapter 15. Function Reference Run-time errors: Error code Meaning 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a data file.
ERror Line Error-handling function ERL Returns the current statement location of the program where a run-time error occurred. Syntax: ERL Description: ERL returns the current statement location of the program where a run-time error occurred most recently. • The ERL function works only with line numbers and not with labels. • The returned value is in decimals, so it may be necessary to use the HEX$ function for decimal-to-hexadecimal conversion when using the ERL function in errorhandling routines.
Chapter 15. Function Reference ERRor code Error-handling function ERR Returns the error code of the most recent run-time error. Syntax: ERR Description: ERR returns the code of a run-time error that invoked the error-handling routine. • The returned value is in decimals, so it may be necessary to use the HEX$ function for decimal-to-hexadecimal conversion when using the ERR function in errorhandling routines.
End of TeXt I/O function ETX$ Modifies the value of a terminator (ETX) for the BHT-protocol; also returns the current value of a terminator. Syntax: Syntax 1 (Changing the value of a terminator): ETX$=stringexpression Syntax 2 (Returning the current value of a terminator): ETX$ Parameter: stringexpression A string expression which returns a single-byte character.
Chapter 15. Function Reference FREe area Memory management function FRE Returns the number of bytes available in a specified area of the memory. Syntax: FRE(areaspec) Parameter: areaspec A numeric expression which returns a value from 0 to 3. Description: FRE returns the number of bytes left unused in a memory area specified by areaspec listed below.
HEXadecimal String function HEX$ Converts a decimal number into the equivalent hexadecimal string. Syntax: HEX$(numericexpression) Parameter: numericexpression A numeric expression which returns a value from -32768 to 32767. Description: HEX$ function converts a decimal number from -32768 to 32767 into the equivalent hexadecimal string which is expressed with 0 to 9 and A to F. Listed below are conversion examples.
Chapter 15. Function Reference INput KEYboard I/O function INKEY$ Returns a character read from the keyboard. Syntax: INKEY$ Description: INKEY$ reads from the keyboard to see whether a key has been pressed, and returns one character read. If no key has been pressed, INKEY$ returns a null string. (For the character codes, refer to Appendix C. For the key number assignment, refer to Appendix E.) • INKEY$ does not echo back a read character on the LCD screen.
INPort data I/O function INP Returns a byte read from a specified input port. Syntax: INP(portnumber) Parameter: portnumber A numeric expression which returns a value from 0 to 32767. Description: INP reads one-byte data from an input port specified by portnumber and returns the value. (For the input port numbers, refer to Appendix D, "I/O Ports.") • If you specify an invalid value to portnumber, INP returns an indeterminate value.
Chapter 15. Function Reference INPUT File I/O function INPUT$ Returns a specified number of characters read from the keyboard or from a device file. Syntax: Syntax 1 (Reading from the keyboard): INPUT$(numcharas) Syntax 2 (Reading from a device file): INPUT$(numcharas,[#]filenumber) Parameter: numcharas A numeric expression which returns a value from 1 to 255. filenumber A numeric expression which returns a value from 1 to 16.
Run-time errors: Error code Meaning 05h Parameter out of the range (numcharas is out of the range.) 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a data file.
Chapter 15. Function Reference IN STRing String function INSTR Searches a specified target string for a specified search string, and then returns the position where the search string is found. Syntax: INSTR([startposition,]targetstring,searchstring) Parameter: startposition A numeric expression which returns a value from 1 to 32767. targetstring and searchstring A string expression.
• A returned value of INSTR is a decimal number from 0 to 255, depending upon the conditions as listed below. Conditions Returned value If searchstring is found within targetstring: First character position of the search string first found If startposition is greater than the length of targetstring or 255: 0 If targetstring is a null string: 0 If searchstring is not found: 0 If searchstring is a null string: Value of startposition 1 if startposition option is omitted.
Chapter 15. Function Reference INTeger Numeric operation function INT Returns the largest whole number less than or equal to the value of a given numeric expression Syntax: INT(numericexpression) Parameter: numericexpression A real expression. Description: INT returns the largest whole number less than or equal to the value of numericexpression by stripping off the fractional part. • You use INT as shown below to round off the fractional part of a real number. INT(realnumber+0.5) Example: dat=1.
LEFT String function LEFT$ Returns the specified number of leftmost characters from a given string expression. Syntax: LEFT$(stringexpression,stringlength) Parameter: stringlength A numeric expression which returns a value from 0 to 255. Description: LEFT$ extracts a portion of a string specified by stringexpression by the number of characters specified by stringlength, starting at the left side of the string. • If stringlength is zero, LEFT$ returns a null string.
Chapter 15. Function Reference LENgth String function LEN Returns the length (number of bytes) of a given string. Syntax: LEN(stringexpression) Description: LEN returns the length of stringexpression, that is, the number of bytes in the range from 0 to 255. • If stringexpression is a null string, LEN returns the value 0. • LEN counts a full-width Kanji (in the two-byte code mode) as two characters.
LOcation Counter of file File I/O function LOC Returns the current position within a specified file. Syntax: LOC([#]filenumber) Parameter: filenumber A numeric expression which returns a value from 1 to 16. Description: LOC returns the current position within a file (a data file, communications device file, or bar code device file) specified by filenumber. • Depending upon the file type, the content of the returned value differs as listed below.
Chapter 15. Function Reference Run-time errors: Error code Meaning 34h Bad file name or number (You specified filenumber of an unopened file.) 3Ah File number out of the range 3Eh A PUT or GET statement executed without a FIELD statement. (No FIELD statement is found.
Location Of File File I/O function LOF Returns the length of a specified file. Syntax: LOF([#]filenumber) Parameter: filenumber A numeric expression which returns a value from 1 to 16. Description: LOF returns the length of a data file or communications device file specified by filenumber. • Depending upon the file type, the content of the returned value differs as listed below.
Chapter 15. Function Reference code MARK I/O function MARK$ Returns a bar code type and the number of digits of the bar code. Syntax: MARK$ Description: MARK$ returns a 3-byte string which consists of the first one byte representing a bar code type and the remaining two bytes indicating the number of digits of the bar code.
MIDdle String function MID$ Returns a portion of a given string expression from anywhere in the string. Syntax: MID$(stringexpression,startposition[,stringlength]) Parameter: startposition A numeric expression which returns a value from 1 to 255. stringlength A numeric expression which returns a value from 0 to 255. Description: Starting from a position specified by startposition, MID$ extracts a portion of a string specified by stringexpression, by the number of characters specified by stringlength.
Chapter 15. Function Reference NOTE BHT-BASIC does not support such MID$ function that replaces a part of a string variable.
POSition I/O function POS Returns the current column number of the cursor. Syntax: POS(0) Description: POS returns the current column number of the cursor in the current screen mode selected by a SCREEN statement, as an integer.
Chapter 15. Function Reference RIGHT String function RIGHT$ Returns the specified number of rightmost characters from a given string expression. Syntax: RIGHT$(stringexpression,stringlength) Parameter: stringlength A numeric expression which returns a value from 0 to 255. Description: Starting at the right side of the string, RIGHT$ extracts a portion of a string specified by stringexpression by the number of characters specified by stringlength.
SEARCH File I/O function SEARCH Searches a specified data file for specified data, and then returns the record number where the search data is found. Syntax: SEARCH([#]filenumber,fieldvariable,searchdata [,startrecord]) Parameter: filenumber A numeric expression which returns a value from 1 to 16. fieldvariable A non-array string variable. searchdata A string expression. startrecord A numeric expression which returns a value from 1 to 32767.
Chapter 15. Function Reference Run-time errors: Error code Meaning 05h Parameter out of the range 34h Bad file name or number (You specified filenumber of an unopened file.) 36h Improper file type (You specified filenumber of a file other than data files.) 3Ah File number out of the range 3Eh A PUT or GET statement executed without a FIELD statement. (No FIELD statement is found.
Start Of Heading I/O function SOH$ Modifies the value of a header (SOH) for the BHT-protocol; also returns the current value of a header. Syntax: Syntax 1 (Changing the value of a header): SOH$=stringexpression Syntax 2 (Returning the current value of a header): SOH$ Parameter: stringexpression A string expression which returns a single-byte character.
Chapter 15. Function Reference STRing String function STR$ Converts the value of a numeric expression into a string. Syntax: STR$(numericexpression) Parameter: numericexpression A numeric expression. Description: STR$ converts the value of numericexpression into a string. • If numericexpression is 0 or positive, STR$ automatically adds a leading space as shown below. PRINT STR$(123);LEN(STR$(123)) 123 4 To delete the leading space, you should use the MID$ function as shown below.
Start of TeXt I/O function STX$ Modifies the value of a header (STX) for the BHT-protocol; also returns the current value of a header. Syntax: Syntax 1 (Changing the value of a header): STX$=stringexpression Syntax 2 (Returning the current value of a header): STX$ Parameter: stringexpression A string expression which returns a single-byte character.
Chapter 15. Function Reference TIME I/O function TIME$ Returns the current system time or wakeup time, or sets a specified system time or wakeup time. Syntax: Syntax 1 (Retrieving the current system time or the wakeup time): TIME$ Syntax 2 (Setting the current system time or the wakeup time): TIME$="time" Parameter: time A string expression. Description: ■ Syntax 1 Retrieving the current system time TIME$ returns the current system time as an 8-byte string. The string has the format below.
■ Syntax 2 Setting the system time TIME$ sets the system time specified by "time." The format of "time" is the same as that in syntax 1. Example: TIME$="13:35:45" Setting the wakeup time (For the BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT7500) TIME$ sets the wakeup time specified by "time." The format of "time" is the same as that in syntax 1. • The calendar clock is backed up by the battery. (For the system date, refer to the DATE$ function.
Chapter 15. Function Reference TIMER-A/TIMER-B/TIMER-C I/O function TIMEA/TIMEB/TIMEC Returns the current value of a specified timer or sets a specified timer. Syntax: Syntax 1 (Retrieving the current value of a specified timer): TIMEA TIMEB TIMEC Syntax 2 (Setting a specified timer): TIMEA=count TIMEB=count TIMEC=count Parameter: count A numeric expression which returns a value from 0 to 32767.
VALue String function VAL Converts a string into a numeric value. Syntax: VAL(stringexpression) Parameter: stringexpression A string expression which represents a decimal number. Description: VAL converts the string specified by stringexpression into a numeric value. • If stringexpression is nonnumeric, VAL returns the value 0.
Chapter 16 Extended Functions CONTENTS 16.1 Overview...................................................................................................... 388 16.2 Reading or writing system settings from/to the memory (SYSTEM.FN3).... 388 16.2.1 Function Number List of SYSTEM.FN3............................................ 388 16.2.2 Detailed Function Specifications ......................................................
Chapter 16. Extended Functions 16.1 Overview In addition to the BHT-BASIC statements and functions, the BHT-7000/BHT-7500/BHT-7500S supports the following extended functions which can be invoked by the CALL statement. Extented functions Used to: Integrated in: SYSTEM.FN3 Read or write system settings from/to the memory. BHT-7000/ BHT-7500/ BHT-7500S SS.FN3 Connect or disconnect the BHT-7500S to/from the spread spectrum system. (For details, see Chapter 17.) BHT-7500S SOCKET.
16.2.2 Detailed Function Specifications Function #0: Get SYSTEM.FN3 version Syntax: CALL "SYSTEM.FN3" 0 VERSION$ Description: This function returns the SYSTEM.FN3 library version in VER- SION$. Parameter: (None) Returned value: VERSION$ Function #1: Version which is fixed to 7 characters Read numeric data from System Mode settings Syntax: CALL "SYSTEM.FN3" 1 PARA%,DATA% Description: This function reads numeric data (DATA%) from the system menu item specified by PARA%.
Chapter 16.
Item number (PARA%) System menu item Attribute*1 DATA%, numeric data of the system menu item Initial value 30 Communications protocol type R/W 0: BHT protocol 2: BHT-Ir protocol 31 Resume function R/W 0: OFF 1: ON 32 | 34 Reserved for system 35 RAM size RO 512/1024/2048 (kilobytes) *3 36 ROM size RO 2048/4096/8192 (kilobytes) *3 37 Cluster size RO 4096 (bytes) 38 Scanning range marker (BHT-7000 only) R/W 0: Normal mode 1: OFF mode *1 *2 *3 0 1*2 – 0 R/W: Read and write p
Chapter 16. Extended Functions Function #3: Read string data from System Mode settings Syntax: CALL "SYSTEM.FN3" 3 PARA%,DATA$ Description: This funcion reads string data (DATA$) from the system menu item specified by PARA%. Parameter: Returned value: PARA% DATA$ Item number of the system menu String data read from the specified system menu item System menu items list: Item number (PARA%) System menu item Attribute RO DATA$, numeric data of the system menu item 1 System version "X.
Function #5: Get font information Syntax: CALL "SYSTEM.FN3" 5 N.FONT%,VERSION$() Description: This funcion returns font information--the number of downloaded fonts, font name, font size, and font version. Parameter: None Returned value: N.FONT% VERSION$ Note: Number of fonts Sets of the font name, font size, and font version in the following format Font name Font size Font version 8 bytes 2 bytes 8 bytes If the number of elements of VERSION$ is less than the number of fonts, the SYSTEM.
Chapter 17 Spread Spectrum Communication (BHT-7500S only) CONTENTS 17.1 Overview...................................................................................................... 395 17.2 Programming for Wireless Communication ................................................. 397 17.3 Wireless Communications-related Statement.............................................. 398 17.4 Wireless Communication Library (SS.FN3) ................................................. 399 17.4.1 Overview ...............
17.1 Overview ■ Spread spectrum wireless device The BHT-7500S system consists of the BHT main system and the spread spectrum wireless device; the former executes user programs and the latter performs spread spectrum communications. User programs use the logical device file (named "COM3") to control the spread spectrum wireless device.
Chapter 17. Spread Spectrum Communication (BHT-7500S only) The table below shows the communications status transition as the state of the wireless communications device built in the BHT-7500S changes.
17.2 Programming for Wireless Communication When programming for spread spectrum communications, use the following statement and extension functions: (1) OPEN statement (OPEN "COM3:") Refer to Section 17.3, "Wireless Communications-related Statement." (2) Spread spectrum library (SS.FN3) for controlling the spread spectrum wireless device Refer to Section 17.4, "Wireless Communication Library (SS.FN3)." (3) Socket library (SOCKET.FN3) for data transmission according to TCP/IP Refer to Section 18.
Chapter 17. Spread Spectrum Communication (BHT-7500S only) 17.3 Wireless Communicationsrelated Statement OPEN "COM3:"Open a wireless communications device file Syntax: OPEN "COM3:" AS [#] filenumber Description: This statement opens a wireless communications device file. A wireless communications device file cannot be opened with an optical interface device file concurrently. If you attempt to open them concurrently, a run-time error will occur.
17.4 Wireless Communication Library (SS.FN3) 17.4.1 Overview The spread spectrum library (SS.FN3) used in a BHT-BASIC CALL statement gets or sets parameters from/to the wireless block. If wireless communications are frequent, a run-time error may occur when you set or refer to wireless-related parameters. In such a case, set or refer to them again. ■ Function Number List of SS.FN3 Number Function 0 Get SS.
Chapter 17. Spread Spectrum Communication (BHT-7500S only) 17.4.2 Detailed Function Specifications Function #0 Get SS.FN3 version Syntax: CALL "SS.FN3" 0 VERSION$ Description: This function returns the SS.FN3 library version in VERSION$.
Function #2 Get parameter value (string) from the wireless block Syntax: CALL "SS.FN3" 2 PARA%,DATA$ Description: This function gets string (DATA$) from the wireless block setting specified by PARA%.
Chapter 17. Spread Spectrum Communication (BHT-7500S only) Function #3 Set parameter value (integer) to the wireless block Syntax: CALL "SS.FN3" 3 PARA%,DATA% Description: This function sets integer (DATA%) to the wireless block setting specified by PARA%.
Function #4 Set parameter value (string) to the wireless block Syntax: CALL "SS.FN3" 4 PARA%,DATA% Description: This function sets string (DATA$) to the wireless block setting specified by PARA%.
Chapter 17. Spread Spectrum Communication (BHT-7500S only) Function #7 Check wireless block synchronization with master Syntax: CALL "SS.FN3" 7 TIMEOUT%,ASSOC% Description: This function checks whether the wireless block is synchronized with the master. According to the timeout length specified by TIMEOUT%, the system operates as follows: - If greater than zero (0) is specified to TIMEOUT% (recommended), this program will check synchronization with the master during the specified time.
Chapter 18 TCP/IP CONTENTS 18.1 Two Sides .................................................................................................... 406 18.1.1 BHT-7500S....................................................................................... 406 18.1.2 Hosts ................................................................................................ 406 18.2 TCP/IP over Spread SpectrumSystem ........................................................ 407 18.2.1 General Procedure ..................
18.1 Two Sides 18.1.1 BHT-7500S The BHT-7500S includes two built-in libraries providing BHT-BASIC programs with access to a subset of the TCP/IP family of protocols over the spread spectrum communication system. SOCKET.FN3: This library implements a subset of the BSD4.4 socket application program interface (API). FTP.FN3: 18.1.2 This library implements FTP client services for file transfers to and from FTP servers. Hosts SOCKET.FN3 and FTP.
Chapter 18. TCP/IP 18.2 TCP/IP over Spread Spectrum System 18.2.1 General Procedure The following is the procedure for using TCP/IP over a wireless communications device. [ 1 ] Configure Wireless Communications Device To connect to the wireless communications pathway, specify the following system settings in System Mode or by using the extension library SS.FN3 in a user program: • Domain • Security ID For the procedure in System Mode, refer to the "BHT-7500/BHT-7500S User’s Manual.
[ 2 ] Configure TCP/IP System To connect to the TCP/IP pathway, specify the following system settings in System Mode or by using the extension library SOCKET.FN3 in a user program: • IP address • Subnet mask • Default gateway These settings will be used in [ 6 ]. For the procedure in System Mode, refer to the "BHT-7500/7500S User’s Manual." For the details of the SOCKET.FN3, refer to Section 18.5, "Socket Library (SOCKET.FN3)." Given below is a setting example with SOCKET.FN3: my.addr$ = "192.168.0.
Chapter 18. TCP/IP [ 3 ] Declare TCP/IP Communications Pathway Specify the following system settings by using the socket library (SOCKET.FN3): • Communications device: Wireless communications device • Link layer: Ethernet For the setting procedure with the SOCKET.FN3, refer to Section 18.5, "Socket Library (SOCKET.FN3)." Given below is a setting example using SOCKET.FN3: iftype% = 2 layermode% = 2 ’Specify wireless communications device ’Specify Ethernest as a link layer call "socket.
[ 5 ] Check Wireless Communications Device Synchronization with Master Using a wireless communications device for TCP/IP communication requires synchronizing with the master (e.g., access point). To check the synchronization, use the extension library SS.FN3.
Chapter 18. TCP/IP [ 6 ] Connect to TCP/IP Communications Pathway Use the extension library SOCKET.FN3. Connecting to the TCP/IP communications pathway requires the following settings (specified in [ 2 ]): • IP address • Subnet mask • Default gateway There are two ways to specify these parameters. (a) Use the system settings with the extension library SOCKET.FN3. Refer to Section 18.5, "Socket Library (SOCKET.FN3)." Given below is an example using SOCKET.FN3. call "socket.
[ 8 ] Disconnect TCP/IP Communications Pathway Use the extension library SOCKET.FN3. Refer to Section 18.5, "Socket Library (SOCKET.FN3)." Given below is an example using SOCKET.FN3. Call "socket.fn3" 43 interface% ’Disconnect TCP/IP communications pathway ’(SOCKET.FN3 function #43) ’Use the returned value of [3] in interface%. [ 9 ] Close Spread Spectrum Wireless Device Use the CLOSE statement in BHT-BASIC. Closing the device will power off the wireless block.
Chapter 18. TCP/IP 18.2.2 Programming Notes for Socket API According to UDP The user datagram protocol (UDP) has no flow control, so send/receive data may go missing due to poor line conditions or difference of communications capabilities between wireless and Ethernet. To prevent data missing, be sure to incorporate some flow control process into user programs at both the BHT and host. Given below are message transmission examples that support retransmission controls at each of the BHT and host.
■ Host’s retransmission control for a transmission error Assume that the host uses the protocol of receiving transmission completion message from the BHT after sending a message. If the host times out for waiting a transmission completion message, it will transmit the unsent message again.
Chapter 18. TCP/IP 18.2.3 Programming Notes for Resume Function If the BHT is turned off and on during data transmission in wireless communications, the wireless communications device will remain off so that subsequent data will no longer be sent or received. In such a case, BHT-BASIC interpreter will return a run-time error (Error code: &h105) informing that the power is off. Develop such user programs that perform the following procedure and then open the wireless communications device again.
main: on error goto Err.TCP .. . open "COM3:" as #hCom3% .. . sock.stts% = 1 .. . call "socket.fn3" 41 interface% ’ Main program ’ Prepare for error interrupt (To Err.TCP ’ at the time of error occurrence) ’ Open a wireless communications device ’ Use the OPEN "COM3:" statement ’ Set "1" to socket processing number ’ Connect TCP/IP communications pathway ’ (system settings) ’ Use SOCKET.FN3 function #41 .. . sock.stts% = 2 ’ Set "2" to socket processing number .. . call "socket.
Chapter 18. TCP/IP 18.3 Socket API 18.3.1 Overview The SOCKET.FN3 library implements a subset of the BSD4.4 socket application program interface (API). The following flowcharts show the BSD4.4 socket API calls for the two communications protocols required for the TCP/IP transport layer: transmission control protocol (TCP) for streams and user datagram protocol (UDP) for datagrams.
■ User Datagram Protocol (UDP) Client Server socket() socket() bind() bind() select() sendto() recvfrom() select() sendto() recvfrom() close() close() 418
Chapter 18. TCP/IP 18.4 FTP Client 18.4.1 Overview The FTP.FN3 library implements FTP client services for file transfers to and from FTP servers. Note that there are no server capabilities. This FTP client transfers files between operating systems in image (binary) format. The only translation support is for line delimiter conversion. In particular, note that this FTP client does not convert between such double-byte character encodings as Shift JIS and EUC.
The FTP client automatically pads the last record of a downloaded program file with null codes (00h) to maintain the fixed-length format. (The number required is 128 less the number of bytes in the last record). Record length (128 bytes) CR LF CR LF CR LF Download Record length (128 bytes) Zeros Aside: To conserve memory and boost performance, the BHT packs a pair of ASCII bytes into a single byte by converting each byte into a 4-bit hexadecimal number.
Chapter 18. TCP/IP [ 2 ] Extension Libraries (*.FN3 and *.EX3) The FTP client treats files with extensions .FN3 and .EX3 as extension libraries. Extension libraries use a fixed record length of 130 bytes for all records except the last. These records are separated with line delimiters. Record length (130 bytes) Record CR LF CR LF Program code CR LF CR LF CR LF CR LF The FTP client automatically pads the last record of a downloaded program file with null codes (00h) to maintain the fixed-length format.
[ 3 ] Data Files The FTP client treats files with extensions other than .PD3, .FN3, and .EX3 as data files. Data file records consist of fields separated with line delimiters. An EOF (1Ah) at the end of the data file is optional. Data files are not limited to ASCII characters. They can use all bytes codes from 00h to FFh. Record length Record Field 1 Field 2 Field n CR LF CR LF CR LF CR LF CR LF EOF (optional) There can be 1 to 16 fields, each 1 to 254 bytes long.
Chapter 18. TCP/IP The treatment of short records is under application control. The default is to delete any trailing spaces (20h). Specified record length Record 1 Record 2 Record 3 CR LF ← Specified length ← Short CR LF Spaces CR LF ← Short, with trailing spaces Specified record length Record 1 ← As is Record 2 ← As is ← Truncated further Record 3 Alternatively, the FTP client can pad such short records to the specified record length with spaces (20h).
Line Delimiters inside Data Records The treatment of line delimiters (CR-LF, CR, or LF) inside downloaded data records, which can use all codes from 00h to FFh, is under application control. The default, described above, is to split the incoming stream into short records.
Chapter 18. TCP/IP 18.4.3 Using FTP Client [ 1 ] Basic Procedure First, set up for using the FTP client, as necessary, with the following steps. All three are optional, but the last two are highly recommended for downloads. (1) Configure the FTP client with the appropriate FTP.FN3 extension functions. (2) Use the FRE function to check whether there is sufficient free memory available to hold the downloaded file. (3) Use a BHT-BASIC OUT statement to optimize the drive.
[ 3 ] Calculating Memory Requirements The FTP protocol specifications do not provide for checking the amount of BHT memory available during downloads. If the BHT runs out of memory during a download, the FTP client cancels the transfer and deletes the partially downloaded file. The user application program must, therefore, check availability with the FRE function or equivalent method and compare the result with the BHT file size (BFS) before using the download function.
Chapter 18. TCP/IP ■ Data Files Determine MEM from the field lengths and number of records. BPR = bytes per record = (number of fields) + (sum of field lengths) RPB = records per block = ROUND_DOWN (4096 ÷ BPR) MEM = ROUND_UP (records ÷ RPB) × 4096 Example: File with 1000 records with four fields of lengths 13, 12, 6, and 1 BPR = 4 + (13 + 12 + 6 + 1) = 36 RPB = ROUND_UP (4096 ÷ 36) = ROUND_UP (113.778) = 113 MEM = ROUND_UP (1000 ÷ 113) × 4096 = ROUND_UP (8.
18.5 Socket Library (SOCKET.FN3) 18.5.1 ■ Overview String Variables The following are the string variables used by this library together with their memory requirements. Description ■ Name Size in Bytes Version information VERSION$ min. 7 Internet address IPADDRESS$ min. 15 Subnet mask SUBNETMASK$ min. 15 Default gateway GATEWAY$ min. 15 Receive buffer RECVBUFF$ 1 to 255 Transmit buffer SENDBUFF$ 1 to 255 Socket identifier set SOCKFDSET$ READFDSET$ WRITEFDSET$ EXCEPTFDSET$ min.
Chapter 18. TCP/IP ■ Function Number List Number 0 Function Corresponding Socket API Function Get socket.
Number Function Corresponding Socket API Function 40 Specify TCP/IP communications pathway Unique to BHT 41 Connect TCP/IP communications pathway with system settings Unique to BHT 42 Connect TCP/IP communications pathway with user settings Unique to BHT 43 Disconnect TCP/IP communications pathway Unique to BHT 44 Get TCP/IP system settings Unique to BHT 45 Set TCP/IP system settings Unique to BHT 46 Get TCP socket status Unique to BHT * Socket API function not supported by SOCKET.
Chapter 18. TCP/IP 18.5.2 Detailed Function Specifications Function #0 Get SOCKET.FN3 version Syntax: CALL "SOCKET.FN3" 0 VERSION$ Description: This function returns the SOCKET.FN3 library version in VERSION$. Parameters: (None) Return value: VERSION$: Version information, 7 characters, fixed length Function #2 Assign address to socket Syntax: CALL "SOCKET.
Function #3: Connect socket Syntax: CALL "SOCKET.FN3" 3 SOCKFD%, FAMILY%, PORT%, address where address is ADDRESS or IPADDRESS$ Description: This function connects the specified socket identifier to another socket. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API connect() function.
Chapter 18. TCP/IP Function #6: Get socket option Syntax: CALL "SOCKET.FN3" 6 SOCKFD%, OPTNAME%, option where option is OPTION% or OPTION Description: This function gets the specified option setting for the specified socket. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API getsockopt() function.
Function #7: Convert host long (4 bytes) to network byte order Syntax: CALL "SOCKET.FN3" 7 HOSTLONG, NETLONG Description: This function converts a (4-byte) long from host byte order to network byte order. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API htonl() function. Parameters: HOSTLONG Long in host byte order Return value: NETLONG Long in network byte order Function #8: Convert host short (2 bytes) to network byte order Syntax: CALL "SOCKET.
Chapter 18. TCP/IP Function #11: Convert network long (4 bytes) to host byte order Syntax: CALL "SOCKET.FN3" 11 NETLONG, HOSTLONG Description: This function converts a (4-byte) long from network byte to host byte order. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API ntohl() function.
The storage method (RECVFLAG%) must be one of the following values: 0 1 Append data to buffer (default if omitted) Overwrite buffer with data Note: If RECVFLAG% is 0 or omitted, the user application program must initialize the receive buffer string array variable before receiving any data. Return value: RECVSIZE% Number of bytes received Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 209h Socket identifier is invalid. 216h A parameter is invalid.
Chapter 18. TCP/IP Example: Append operation Incoming data: 1024 bytes ("0123456789..........
Example: Overwrite operation Incoming data: 1024 bytes ("0123456789..........
Chapter 18. TCP/IP Function #15: Receive message from UDP socket Syntax: CALL "SOCKET.FN3" 15 SOCKFD%, RECVBUFF$[()], RECVLEN%, RECVMODE%, FAMILY%, PORT%, address, RECVSIZE% [,RECVFLAG%] where address is ADDRESS or IPADDRESS$ Description: This function receives data from the IP address and port number connected to the specified socket identifier into the specified buffer. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API recvfrom() function.
Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 209h Socket identifier is invalid. 216h A parameter is invalid. 228h The maximum number of bytes to receive is too small. 229h TCP is the wrong protocol here. 237h There is insufficient system area memory.
Chapter 18. TCP/IP Function #17: Monitor socket requests Syntax: CALL "SOCKET.FN3" 17 MAXFD%, READFDSET$, WRITEFDSET$, EXCEPTFDSET$, TIMEOUT, RESULT% Description: This function waits for changes in the socket identifier sets (read, write, and exception conditions) for the specified socket identifiers. The only exception condition is out of band data. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API select() function.
Function #19: Add socket identifier to socket identifier set Syntax: CALL "SOCKET.FN3" 19 SOCKFD%, SOCKFDSET$ Description: This function adds the specified socket identifier to the specified identifier set. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API FD_SET macro. Parameters: SOCKFD% SOCKFDSET$ Return value: (None) Socket identifier Socket identifier set Function #20: Delete socket identifier from socket identifier set Syntax: CALL "SOCKET.
Chapter 18. TCP/IP Function #22: Send message to another TCP socket Syntax: CALL "SOCKET.FN3" 22 SOCKFD%, SENDLEN%, SENDMODE%, SENDSIZE% Description: This function transmits data from the specified buffer to the IP address and port number connected to the specified socket identifier. SENDBUFF$[()], BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API send() function.
Function #23: Send message to another UDP socket Syntax: CALL "SOCKET.FN3" 23 SOCKFD%, SENDBUFF$[()], SENDLEN%, SENDMODE%, FAMILY%, PORT%, address, SENDSIZE% where address is ADDRESS or IPADDRESS$ Description: This function transmits data from the specified buffer to the IP address and port number connected to the specified socket identifier. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API sendto() function.
Chapter 18. TCP/IP Function #24: Set socket options Syntax: CALL "SOCKET.FN3" 24 SOCKFD%, OPTNAME%, option where option is OPTION% or OPTION Description: This function sets the specified option for the specified socket to the new value. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API setsockopt() function.
Function #25: Shut down socket Syntax: CALL "SOCKET.FN3" 25 SOCKFD%, HOWTO% Description: This function shuts down socket transfers in the specified direction. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API shutdown() function.
Chapter 18. TCP/IP Function #26: Create socket Syntax: CALL "SOCKET.FN3" 26 SOCKFD% Description: This function creates a socket from the specified protocol family, socket type, and protocol layer and assigns it to a socket identifier. FAMILY%, TYPE%, PROTOCOL%, BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API socket() function.
Function #28: Close socket Syntax: CALL "SOCKET.FN3" 28 SOCKFD% Description: This function closes the specified socket identifier. BSD4.4 socket API equivalent: This function is equivalent to the BSD4.4 socket API close() function. Parameters: SOCKFD% Return value: (None) Socket identifier Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 209h Socket identifier is invalid. 225h The last close operation for the specified socket is not complete.
Chapter 18. TCP/IP Function #41: Connect TCP/IP communications pathway with system settings Syntax: CALL "SOCKET.FN3" 41 INTERFACE% Description: This function connects the TCP/IP communications pathway based on the system settings. Parameters: INTERFACE% Return value: (None) Communications pathway Run-time errors: Error code 34h Meaning Communications device file not open. 101h Cannot connect to communications pathway. 102h Communications pathway not specified.
Function #43: Disconnect TCP/IP communications pathway Syntax: CALL "SOCKET.FN3" 43 INTERFACE% Description: This function disconnects the specified TCP/IP communications pathway. Parameters: INTERFACE% Return value: (None) Communications pathway Run-time errors: Error code Meaning 104h Communications pathway already disconnected. 105h Power-off detected. (BHT-7500S only) 216h A parameter is invalid. Function #44: Get TCP/IP system settings Syntax: CALL "SOCKET.
Chapter 18. TCP/IP Function #45: Set TCP/IP system settings Syntax: CALL "SOCKET.FN3" 45 PARA%, DATA$ Description: This function sets the specified TCP/IP system settings to the new value. Parameters: PARA% DATA$ Return value: (None) Setting number New setting for TCP/IP system settings Correspondence tables: See Table under function #44. Function #46: Get TCP socket status Syntax: CALL "SOCKET.
18.6 FTP Library (FTP.FN3) 18.6.1 ■ Overview String Variables The following are the string variables used by this library together with their memory requirements. Description Name Size in Bytes Version information VERSION$ 7 Server IP address SERV.IP 15 Login user name USERNAME$ 0 to 16 Login password PASSWORD$ 0 to 16 Directory names CURDIR$ NEWDIR$ 0 to 255 File names SERV.FNAME$ CLNT.FNAME$ OLD.FNAME$ NEW.
Chapter 18. TCP/IP ■ Reply Codes The messages that FTP servers send during and after FTP operations vary, but servers all use the same reply codes. (See Table.) All function numbers therefore supply these as their return value (REPLY%). Reply Codes Description 110 Restart marker replay. 120 Service ready in nnn minutes. 125 Data connection already open; transfer starting. 150 File status okay; about to open data connection. 200 Command okay.
Reply Codes Description 425 Can’t open data connection. 426 Connection closed; transfer aborted. 450 Requested file action not taken. File unavailable (e.g., file busy). 451 Requested action aborted: local error in processing. 452 Requested action not taken. Insufficient storage space in system. 500 Syntax error, command unrecognized. This may include errors such as command line too long. 501 Syntax error in parameters or arguments. 502 Command not implemented.
Chapter 18. TCP/IP Function #1: Open FTP client session with system settings Syntax: CALL "FTP.FN3" 1 FTPHANDLE%, REPLY% Description: This function opens an FTP client session using the system settings. Parameters: (None) Return value: FTPHANDLE% REPLY% FTP client handle, for use by following functions Server response to FTP command Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 110h Response other than 2XX received.
Function #3: Close FTP client session Syntax: CALL "FTP.FN3" 3 FTPHANDLE%, REPLY% Description: This function closes the specified FTP client session. Parameters: FTPHANDLE% FTP client handle Return value: REPLY% Server response to FTP command Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 110h Response other than 2XX received. 216h The FTP client handle is invalid. 239h The specified socket is not connected.
Chapter 18. TCP/IP Function #5: Change current directory on FTP server Syntax: CALL "FTP.FN3" 5 FTPHANDLE%, NEWDIR$, REPLY% Description: This function changes the current directory on the FTP server. Parameters: FTPHANDLE% NEWDIR$ FTP client handle New directory Return value: REPLY% Server response to FTP command Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 110h Response other than 2XX received. 216h The FTP client handle is invalid.
CRLF.MODE% Treatment of line delimiters inside records and trailing spaces in fields Note: CRLF.MODE% will be ignored for files except data files. 0 Treat line delimiters inside records as SEPARATORS. TRIM trailing spaces in fields. 1 Treat line delimiters inside records as DATA. TRIM trailing spaces in fields. 10 Treat line delimiters inside records as SEPARATORS. RETAIN trailing spaces in fields. 11 Treat line delimiters inside records as DATA. RETAIN trailing spaces in fields.
Chapter 18. TCP/IP Run-time errors: Error code Meaning 02h Syntax error (Incorrect file name). 05h Number of field items or number of digits in a field out of the range. 07h Insufficient memory space. 32h Wrong file type. 33h Invalid text received. 37h File already open. 39h Too many files. 3Ch Record exceeds 255 bytes. 3Dh Field mismatch error. 41h File damaged. 47h User break with cancel (C) key. 49h Invalid program file received. (Invalid program size.
Function #7: Upload file to FTP server Syntax: CALL "FTP.FN3" 7 FTPHANDLE%, SERV.FNAME$, CLNT.FNAME$, CRLF.TYPE%, UP.MODE%, REPLY% [,DISP.MODE%] Description: This function uploads, from the handy terminal to the current directory on the FTP server, the specified file using the specified parameters. Parameters: FTPHANDLE% SERV.FNAME$ FTP client handle CLNT.FNAME$ CRLF.TYPE% Name of file to upload to FTP server. UP.MODE% Flag controlling treatment of existing files Name for file on FTP server.
Chapter 18. TCP/IP Run-time errors: Error code Meaning 35h File not found. 37h File already open. 47h User break with cancel (C) key. 105h Power-off detected. (BHT-7500S only) 110h Response other than 2XX received. 111h File not closed. 216h The FTP client handle is invalid. 239h The specified socket is not connected. 295h There is no user for login request. Function #8: Get FTP system settings Syntax: CALL "FTP.FN3" 8 PARA%, ftp.para where ftp.para is FTP.PARA% or FTP.
Setting Number (PARA%) Description Values for Setting (FTP.PARA$) 3 Password for FTP authentication Character string, maximum 16 bytes 4 Initial directory on FTP server character string, a maximum of 63 bytes long Function #9: Set FTP system settings Syntax: CALL "FTP.FN3" 9 PARA%, ftp.para where ftp.para is FTP.PARA% or FTP.PARA$ Description: This function sets the specified FTP system settings to the new value. Parameters: PARA% ftp.
Chapter 18. TCP/IP Function #11: Set port number for file transfer Syntax: CALL "FTP.FN3" 11 FTPHANDLE%, PORT% Description: This function sets a port number specified by PORT% for file transfer. Parameters: FTPHANDLE% PORT% Return value: (None) FTP client handle Port number Run-time errors: Error code Meaning 105h Power-off detected. (BHT-7500S only) 216h The FTP client handle is invalid. 239h The specified socket is not connected. 295h There is no user for login request.
Appendices CONTENTS Appendix A Error Codes and Error Messages....................................................... 465 A1. A2. Run-time Errors.............................................................................. 465 Compilation Errors ......................................................................... 468 Appendix B Reserved Words................................................................................. 477 Appendix C Character Sets .................................................
Appendices Appendix A Error Codes and Error Messages A1. Run-time Errors Error code Meaning 00h Internal system error 01h NEXT without FOR 02h Syntax error 03h RETURN without GOSUB 04h Out of DATA (No DATA values remain to be read by the READ statement.) 05h Parameter out of the range 06h The operation result is out of the allowable range. 07h Insufficient memory space (Too deep nesting, etc.) 08h Array not defined 09h Subscript out of range (An array subscript is out of the array.
Error code Meaning 36h Improper file type (The statement attempts an operation that conflicts with the file type-data file, communications device file, or bar code device file.) 37h File already open (An OPEN statement executed for the already opened file.) 38h The file name is different from that in the receive header. 39h Too many files 3Ah File number out of the range 3Bh The number of the records is greater than the defined maximum value.
Appendices Error code Meaning 103h Communications pathway already connected. 104h Communications pathway already disconnected. 105h Power-off detected. 110h Response other than 2XX received. 111h File not closed. 201h Cannot connect to socket. 209h Socket identifier is invalid. 20Dh Attempt to connect to different FTP server without disconnecting. 216h A parameter is invalid. The FTP client handle is invalid. A parameter is invalid, or the socket is already bound.
A2.
Appendices Error code & Message fatal error 29: Out of memory for cross reference fatal error 30: Cannot find include file fatal error 31: Cannot nest include file fatal error 32: Internal memory allocation error (tag list buffer) [function name] fatal error 33: (Preprocess) Source file I/O error fatal error 34: (Preprocess) Internal memory overflow fatal error 35: (Preprocess) Macro work file I/O error fatal error 36: (Preprocess) Macro double defined [Macro name] fatal error 37: (Prepro
■ Syntax Errors Error code & Message error 1: Improper label format error 2: Improper label name (redefinition, variable name, or reserved word used) error 3: ’"’missing error 4: Improper expression error 5: Variable name redefinition (common variable already defined as label name or variable name) error 6: Variable name redefinition (register variable already defined as label name or variable name) error 7: Variable name redefinition (variable already defined as label name, non-array string w
Appendices Error code & Message error 21: Too many variables (register float array) error 22: Too many variables (register string array) error 23: Too many variables (common integer array) error 24: Too many variables (common float array) error 25: Too many variables (common string array) error 26: Too many variables (work integer array, two-dimensional) error 27: Too many variables (work float array, two-dimensional) error 28: Too many variables (work string array, two-dimensional) error
Error code & Message error 46: error 47: error 48: error 49: error 50: Incorrect use of IF...THEN...ELSE...ENDIF error 51: Incomplete control structure (IF...THEN...ELSE...ENDIF) error 52: Incorrect use of FOR...NEXT error 53: Incomplete control structure (FOR...NEXT) error 54: Incorrect FOR index variable error 55: Incorrect use of SELECT...CASE...END SELECT error 56: Incomplete control structure (SELECT...CASE...END SELECT) error 57: Incorrect use of WHILE...
Appendices Error code & Message error 77: Initial string too long error 78: Array symbols exceed 30 for one DIM, GLOBAL, or PRIVATE statement error 79: Record number out of range (1 to 32767) error 80: Label undefined error 81: Must be DATA statement label (in RESTORE statement) error 82: ’(’ missing error 83: ’)’ missing error 84: ’]’ missing error 85: ’,’ missing error 86: ’;’ missing error 87: ’DEF’ missing error 88: ’TO’ missing error 89: ’INPUT’ missing error 90: ’{’ missin
■ Linking Errors Error Message PRC area size different Out of space in REG area Out of space in PRD area Cannot open project file Cannot open object file [object name] Cannot open MAP file Cannot open PD3 file [PD3 filename] Cannot close PD3 file [PD3 filename] Write error to PD3 file [PD3 filename] Seek error: Cannot move to the filename position Seek error: Cannot move to the head of the block Filename area too large Symbolname area too large Too many records in symbol table Too many modules Too many li
Appendices Error Message Non-array integer register variable area overflow Non-array float register variable area overflow Register memory pool area overflow Failed to set up initial setting of register data * To the [Variable type], any of the following character strings applies: • Non-array integer common variable • Non-array float common variable • Non-array string common variable • Non-array integer work variable • Non-array float work variable • Non-array string work variable • Non-array integer regi
■ Library Errors Error Message Cannot find object to be deleted [objectname] Designated object already existing [objectname] Cannot find object to be updated [objectname] Module already defined [modulename] Filename area too large Too many block information pieces Cannot open library file Seek error: Cannot move to the filename position Seek error: Cannot move to the head of the block NOTE No error code precedes any linking error or library error.
Appendices Appendix B Reserved Words The following list shows reserved words (keywords) of BHT-BASIC. Any of these words must not be used as a variable name or label name.
Appendix C Character Sets C1. Character Set The table below lists the character set which the BHT can display on the LCD screen. It is based on the ASCII codes. NOTE 1: You can assign user-defined fonts to codes from 80h to 9Fh with APLOAD statement. (Refer to APLOAD statement in Chapter 14.) NOTE2: Characters assigned to codes 20h to 7Fh are default national characters when the English message version is selected on the menu screen* in System Mode.
Appendices C2. National Character Sets You may switch characters assigned to codes 20h to 7Fh of the character set table listed in Appendix C1 to one of the national character sets by using the COUNTRY$ function. The default national character set is America (code A) or Japan (code J) depending upon the English or Japanese message version selected on the menu screen* in System Mode, respectively.
C3.
Appendices ■ Generating the small-size font patterns BHT-6000/BHT-6500 - Single-byte ANK characters To display single-byte ANK characters in small size of fonts, their small-size font patterns stored in the flash ROM will be used and no condensation will take place. For the patterns loaded by the APLOAD statement, the Interpreter condenses them as follows: 1 2 3 4 5 6 1 2 3 4 5 6 7 8 The Interpreter ORs adjacent horizontal two rows--2nd and 3rd rows and 5th and 6th rows--to produce a single row each.
BHT-7000/BHT-7500 - Single-byte ANK characters To display single-byte ANK characters in small size of fonts, their small-size font patterns stored in the flash ROM will be used and no condensation will take place. For the patterns loaded by the APLOAD statement, the Interpreter uses a total of 6 bits (bit 0 to 5) in each vertical row and ignores bits 6 and 7.
Appendices Appendix D I/O Ports D1. BHT-3000 ■ Input Ports A user program can monitor the hardware status through the input ports by using the WAIT statement or INP function. BHT-BASIC defines each of these ports as a byte. The table below lists the input ports and their monitoring function in the BHT. Port No.
*4 Lower three bits (bit 2 to bit 0) in this byte represent the contrast level of the LCD in 000 to 111 in binary notation or in 0 to 7 in decimal notation. 0 means the lowest contrast; 7 means the highest. *5 The LCD contrast, message version (English/Japanese), and VRAM should not be monitored by using a WAIT statement. These status may not change while a user program monitors them by this statement. The WAIT statement used for this purpose may cause the program to enter an infinite loop.
Appendices D2. BHT-4000 ■ Input Ports A user program can monitor the hardware status through the input ports by using the WAIT statement or INP function. BHT-BASIC defines each of these ports as a byte. The table below lists the input ports and their monitoring function in the BHT. Port No.
*8 The BHT-4000 returns the re-read prevention enabled time length in units of 100 ms. If the returned value is zero (0), it means that the re-read prevention is permanently enabled so that the BHT-4000 does not read same bar codes in succession. *9 An 8-bit binary pattern (bits 7 to 0) on the input ports 10h to 64Fh (which read VRAM) represents a basic dot pattern column of the LCD. Bit value 1 means a black dot. The port number gives the dot column address.
Appendices *7 The BHT-4000 may display the system status on the bottom line of the LCD. To display the system status, set 1 to this port; to erase it, set 0. For the system status indication, refer to Chapter 7, Subsection 7.1.7. *8 This byte sets the re-read prevention enabled time length in units of 100 ms. Specification of zero (0) permanently enables the re-read prevention so that the BHT-4000 does not read same bar codes in succession.
D3. BHT-5000 ■ Input Ports A user program can monitor the hardware status through the input ports by using the WAIT statement or INP function. BHT-BASIC defines each of these ports as a byte. The table below lists the input ports and their monitoring function in the BHT. Port No.
Appendices During the direct-connect interface operation, a user program can regard RD signal as CS signal, provided that the returned value of CS should be specified by RS/CS control parameter in the OPEN "COM:" statement as listed below. OPEN "COM:" state- Returned value of CS (CTS) ment OPEN OPEN OPEN OPEN OPEN "COM:,,,,0" "COM:,,,,1" "COM:,,,,2" "COM:,,,,3" "COM:,,,,4" Always 1 Always 1 1 if RD signal is High. 1 if RD signal is Low. Depends upon the RD signal state.
■ Output Ports A user program can control the hardware through the output ports by using the OUT statement. BHT-BASIC defines each of these ports as a byte. The table below lists the output ports and their controlling function in the BHT. Port No.
Appendices *5 The sleep timer feature automatically interrupts program execution if no event takes place within the specified length of time preset by bit 7 to 0. Shown below are examples of OUT statements. Setting 0 to this byte disables the sleep timer feature. (Refer to Chapter 10.) OUT 6,30 OUT 6,0 ’3 seconds ’No sleep operation *6 To activate the wakeup function, set 1 to this bit; to deactivate it, set 0.
D4. BHT-6000/BHT-6500 ■ Input Ports A user program can monitor the hardware status through the input ports by using the WAIT statement or INP function. BHT-BASIC defines each of these ports as a byte. The table below lists the input ports and their monitoring function in the BHT. Port No.
Appendices *1 BHT-BASIC represents the bit order by the exponent of each binary digit in the byte. For example, bit 0 means LSB; bit 7 means MSB. *2 Only when the trigger switch function is assigned to any of the magic keys, a user program returns the ON/OFF state of the switch.
*14 A user program returns the BHT’s ID number which is required for the use of the BHT-Ir protocol. The ID number is expressed by two bytes: lower byte on port 6061h and upper byte on port 6062h. The range of the returned value is from 1 to FFFFh. If the ID number is 1234h, for example, the value on 6061h is 34h and that on 6062h is 12h.
Appendices ■ Output Ports A user program can control the hardware through the output ports by using the OUT statement. BHT-BASIC defines each of these ports as a byte. The table below lists the output ports and their controlling function in the BHT. Port No.
*1 BHT-BASIC represents the bit order by the exponent of each binary digit in the byte. For example, bit 0 means LSB; bit 7 means MSB. *2 The reading confirmation LED is controllable only when the bar code device file is closed. If the file is opened, the OUT statement will be ignored. If you have set the confirmation LED to OFF in the OPEN "BAR:" statement a user program can control the reading confirmation LED although the bar code device file is opened.
Appendices *13 You can set the communications protocol type for transmitting files with the XFILE statement. *14 You may set the BHT’s ID number to be used for the BHT-Ir protocol. The ID number is expressed by two bytes: lower byte on port 6061h and upper byte on port 6062h. The setting range is from 1 to FFFFh.
D5. BHT-7000/BHT-7500 ■ Input Ports A user program can monitor the hardware status through the input ports by using the WAIT statement or INP function. BHT-BASIC defines each of these ports as a byte. The table below lists the input ports and their monitoring function in the BHT. Port No.
Appendices Port No.
*8 An 8-bit binary pattern (bits 7 to 0) on the input ports (which read VRAM) 10h to 40Fh in the BHT-7000 or 10h to C8Fh in the BHT-7500 represents a basic dot pattern column of the LCD. Bit value 1 means a black dot. The port number gives the dot column address. On input ports BE0h to C8Fh, which represents the bottom line of the LCD, is a 7-bit binary pattern (bits 6 to 0) only. If "1" is set to bit 7 for output, bit 7 returns "1"; if "0," bit 7 returns "0.
Appendices *17 A user program returns the currently specified size of the empty area to be defragmented in units of 4 kilobytes. The size is expressed by two bytes: lower byte on port 60E0h and upper byte on port 60E1h. The range of the returned value is from 1 to FFFFh. (The actually allowable maximum value is the size of the empty user area. If a value exceeding the size is returned, it means that the whole empty area is specified to be defragmented.
Port No.
Appendices *6 To make the TIME$ function return or set the system time, set 0 to this bit; to make the TIME$ function return or set the wakeup time, set 1. Execution of the TIME$ function after selection of the wakeup time will automatically reset this bit to zero. *7 This byte sets the re-read prevention enabled time length in units of 100 ms. Specification of zero (0) permanently enables the re-read prevention so that the BHT-7000/BHT7500 does not read same bar codes in succession.
*18 To update the BHT system by using an application program, download an update file to the BHT and then execute an OUT statement. Updating the system will take approx. 30 seconds. During updating, the BHT power should be kept on. If an execution program has been set, execution of OUT &H60D0, 1 may cold-start the application. *19 You may specify the size of the empty user area to be defragmented in units of 4 kilobytes.
Appendices Appendix E Key Number Assignment on the Keyboard E1. BHT-3000 ■ Key Number Assignment The keys on the BHT-3000 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
E2. BHT-4000 ■ Key Number Assignment The keys on the BHT-4000 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
Appendices E3. BHT-5000 [ 1 ] 32-key pad ■ Key Number Assignment The keys on the BHT-5000 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
■ Alphabet Letter Assignment Shown below are the alphabet letter assignments which are available when the alphabet input function is activated. Non-shift mode Shift mode *1 BS, CR, C, and SPC are a backspace (08h), carriage return (0Dh), cancel (18h), and space (20h) code, respectively.
Appendices [ 2 ] 26-key pad ■ Key Number Assignment The keys on the BHT-5000 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
E4. BHT-6000 ■ Key Number Assignment The keys on the BHT-6000 keyboard are assigned numbers as shown below. Non-shift mode Shift mode 34 33 31 30 17 18 19 21 22 23 25 26 27 28 29 1 2 3 4 9 10 11 12 5 6 7 8 13 14 15 16 24 20 ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
Appendices E5. BHT-6500 ■ Key Number Assignment The keys on the BHT-6500 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
E6. BHT-7000/BHT-7500 [ 1 ] 32-key pad ■ Key Number Assignment The keys on the BHT-7000/BHT-7500 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
Appendices ■ Alphabet Letter Assignment Shown below are the alphabet letter assignments which are available when the alphabet input function is activated. Non-shift mode Shift mode *1 BS, CR, C, and SPC are a backspace (08h), carriage return (0Dh), cancel (18h), and space (20h) code, respectively.
[ 2 ] 26-key pad (BHT-7000 only) ■ Key Number Assignment The keys on the BHT-7000 keyboard are assigned numbers as shown below. Non-shift mode Shift mode ■ Default Data Assignment The default data assignment is shown below. Non-shift mode Shift mode *1 BS, CR, and C are a backspace (08h), carriage return (0Dh), and cancel (18h) code, respectively.
Appendices Appendix F Memory Area ■ Memory Map The memory maps are shown below.
BHT-6500 BHT-7000 System program area (196 KB) System work area (512 KB) JIS Level 1 Kanji font area (128 KB) JIS Level 2 Kanji font area (128 KB) ROM Font area User area (60 KB) JIS Level 1 font, 16-dot (120 KB) JIS Level 2 font, 16-dot (112 KB) JIS Level 1 font, 12-dot (88 KB) JIS Level 2 font, 12-dot (84 KB) System work area (48 or 72 KB) User area (464 or 1976 KB) System program area (1536 KB) RAM User area (2156 KB) BHT-7500 System work area (512 or 1024 KB) System program area (1728 KB)
Appendices The size and area allocation of the memory incorporated in the BHT differ depending upon the models as listed below.
■ Memory Space Available for Variables Listed below are the maximum memory spaces available for work, common, and register variables. Variables Max. memory space Work and common variable area 6 KB* Register variable area 64 KB * 32 KB in the BHT-7000/BHT-7500 Each variable occupies the memory space as listed below. Variables Max.
Appendices Appendix G Handling Space Characters in Downloading ■ Space characters used as padding characters A data file can be downloaded with System Mode or an XFILE statement according to the communications protocol which is designed to eliminate space characters padded in the tail of each data field. That is, such space characters in a data file will not be handled as data in the BHT-3000/BHT-4000 since the BHT-3000/BHT-4000 has no feature for regenerating those eliminated ones automatically.
■ To handle space characters as data To handle space characters in the tail of a data field as data (not as padding characters), you must take special considerations in programming. If you want to search for a field data containing space characters in its tail by using a SEARCH function, for instance, use any of the following methods: [Example 1] After downloading a data file, fill the unused spaces in each field with space characters and then search for the target field data.
Appendices [Example 3] When specifying a field data to be searched, do not include space characters in the tail of the data field. A B C Send data A B C Receive data A B C Data to be searched A B C Search data to be specified ( denotes a space character.
■ To make the BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500 handle space characters as data You can specify the handling of space characters in the tail of a data field with System Mode or an XFILE statement. System Mode: To handle space characters as data, select "Data" on the field space setting screen on the communications parameter setting menu called up from the SET SYSTEM menu. XFILE statement: To handle space characters as data, specify T to "protocolspec" in the XFILE statement. XFILE "d2.
Appendices Appendix H Programming Notes [ 1 ] Flash ROM ■ BHT-5000/BHT-6000/BHT-6500 You can store user program files and data files in the flash ROM as well as in the RAM. The following tips help you use the flash ROM correctly. (1) Memory areas required for user programs If you store a user program into the flash ROM, the area for its register variables is also reserved in the flash ROM.
[ 2 ] BHT-2000 compatible mode ■ BHT-5000 You can run user programs written for the BHT-2000 on the BHT-5000 without any program modification if you select the BHT-2000 compatible mode on the OTHERS menu of the SET SYSTEM menu in System Mode. When those user program are running, they appear only in the middle section of the LCD as shown below. This is because the BHT-5000 is larger than the BHT-2000 in the numbers of columns and lines.
Appendices [ 3 ] Program file named APLINT.PD3 ■ BHT-5000/BHT-6000/BHT-6500/BHT-7000/BHT-7500 If a program file named APLINT.PD3 is stored in the BHT-5000/BHT-6000/BHT-6500/BHT7000/BHT-7500, the System Mode initiation sequence (by pressing the PW key with the SF and 1 keys held down) will not start System Mode but execute that user program. Making a program file named APLINT.
Appendix I Program Samples Writing the function for receiving both bar code entry and key entry Feature: This function receives earlier one of either bar code entry or key entry. If bar code reading is completed, the function returns the scanned bar code data; if key entry comes first, the function inhibits bar code reading and echoes back the key entry data, then returns the key entry data when the ENT key is pressed.
Appendices fnbarkey$ = .kb$ ’ Then, return the character. exit def endif select .kb$ case chr$(13) fnbarkey$ = .rt$ exit def case chr$(8) ’ BS key. if len(.rt$) then print chr$(8); ’ Erase one character. .rt$ = left$(.rt$, len(.rt$)-1) endif case chr$(24) ’ Clear key. while len(.rt$) ’ Erase all characters entered. print chr$(8); .rt$ = left$(.rt$, len(.rt$)-1) wend case else if len(.rt$)
Testing the written function while 1 a$ = fnbarkey$ (1, "A", 15, "DL") print if a$<>"D" and a$<>"L" then print "Data="; a$ else print "ESC(";a$;") key push" endif wend end 528 ’Infinite loop ’F4 and SFT/F4 as escape characters.
Appendices Appendix J Quick Reference for Statements and Functions Controlling program flow Statements CALL Calls an FN3 or SUB function. CHAIN Transfers control to another program. END Terminates program execution. FOR…NEXT Defines a loop containing statements to be executed a specified number of times. GOSUB Branches to a subroutine. GOTO Branches to a specified label.
Handling errors Statements ON ERROR GOTO Enables error trapping. RESUME Causes program execution to resume at a specified location after control is transferred to an errorhandling routine. Functions ERL Returns the current statement location of the program where a run-time error occurred. ERR Returns the error code of the most recent run-time error. Defining and allocating variables Statements COMMON Declares common variables for sharing between user programs.
Appendices Controlling the LCD screen Statements APLOAD Loads a user-defined font in the single-byte ANK mode. CLS Clears the LCD screen. CURSOR Turns the cursor on or off. KEY 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 a magic key as the trigger switch, shift key, or battery voltage display key. KPLOAD Loads a user-defined Kanji font in the two-byte Kanji mode.
Controlling the keyboard input Statements INPUT Reads input from the keyboard into a variable. KEY 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 a magic key as the trigger switch, shift key, or battery voltage display key. KEY ON Enables keystroke trapping for a specified function key. KEY OFF Disables keystroke trapping for a specified function key.
Appendices Communicating with I/Os Statements OUT Sends a data byte to an output port. POWER Controls the automatic power-off facility. WAIT Pauses program execution until a designated input port presents a given bit pattern. Functions FRE Returns the number of bytes available in a specified area of the memory. INP Returns a byte read from a specified input port. Communicating with the barcode device Statements CLOSE Closes file(s).
Manipulating data files and user program files Statements CLFILE Erases the data stored in a data file. CLOSE Closes file(s). FIELD Allocates string variables as field variables. GET Reads a record from a data file. KILL Deletes a specified file from the memory. OPEN Opens a file for I/O activities. PUT Writes a record from a field variable to a data file. Functions LOC Returns the current position within a specified file. LOF Returns the length of a specified file.
Appendices Functions BCC$ Returns a block check character (BCC) of a data block. EOF Tests whether the end of a device I/O file has been reached. ETX$ Modifies the value of a terminator (ETX) for the BHT-protocol; also returns the current value of a terminator. INPUT$ Returns a specified number of characters read from the keyboard or from a device file. LOC Returns the current position within a specified file. LOF Returns the length of a specified file.
Manipulating string data Functions ASC Returns the ASCII code value of a given character. CHR$ Returns the character corresponding to a given ASCII code. HEX$ Converts a decimal number into the equivalent hexadecimal string. INSTR Searches a specified target string for a specified search string, and then returns the position where the search string is found. LEFT$ Returns the specified number of leftmost characters from a given string expression.
Appendices Appendix K Unsupported Statements and Functions BHT-BASIC does not support the following MS-BASIC statements and functions: - For handling sequential data files CVD CVI CVS LSET MKD$ MKI$ MKS$ PRINT# PRINT# USING RSET WRITE# - For RS-232C interface operation PRINT# USING WRITE# - For interrupt handling COM OFF COM ON COM STOP ON STCOM GOSUB ON STOP GOSUB STOP OFF STOP ON - For graphics and color control CIRCLE COLOR CONSOLE CSRLIN DRAW LINE POINT PSET WIDTH WINDOW - For I/O control
- For others CDBL CINT CLEAR COPY DEF DBL DEF SNG DEFINT FIX IF GOTO LPOS OCT$ OPTION BASE RANDOMIZE RND 538 SGN STRING$ SWAP TAB WRITE
Index 72, 198 Symbols array register variable 214 array string type, array string variable, arraystringvariable 19, 37, 71, 183, 198, 213, 214, 218, 220, 256, 306 _ (underline, underscore) 18, 36, 61, 62, 64, 79, 273, 299, 300, 301, 302, 458, 460 ’ (single quotation, single quote, apostrophe) 19, 60, 63, 313, 335 ASCII code 284, 340, 347, 403, 478, 536 $INCLUDE 57, 313, 335, 477, 536 auto-off mode 144, 163, 276, 277, 278 , (comma) 18, 36, 61, 64, 69, 70, 128, 214, 215, 239, 241, 260, 261, 262, 297, 2
character attribute, charaattribute 197, 201, 318, 319, 531 412, 425, 427, 477, 483, 484, 485, 486, 488, 490, 492, 493, 495, 496, 498, 499, 501, 502, 537 character code 86, 120, 152, 180, 181, 245, 253, 340, 341, 347, 361 BHT-BASIC 3.
cursor shape 110, 119, 201, 239, 261, 265, 266, 363, 531 communications protocol 149, 330, 334, 391, 417, 488, 489, 490, 491, 492, 493, 495, 497, 498, 500, 502, 503, 519, 534 cursorswitch 181, 254, 265, 266 compilation error 57, 335, 468 D compiler vi, 8, 9, 11, 15, 16, 17, 18, 20, 21, 22, 32, 34, 35, 36, 38, 40, 41, 42, 43, 44, 45, 47, 57, 62, 158, 192, 214, 218, 419 DATA 60, 131, 189, 202, 311, 312, 314, 389, 390, 391, 392, 400, 401, 402, 403, 450, 451, 458, 465, 473, 477, 530 compiling option 33
error-handling routine 53, 155, 158, 159, 268, 315, 316, 323, 357, 465, 530 255, 257, 307, 308, 473, 477, 530 direct-connect interface 14, 146, 147, 148, 276, 287, 288, 289, 290, 291, 292, 390, 483, 485, 486, 489, 493, 499 ERRORLEVEL 32, 44 event polling ii, 154, 155, 156, 157 event trapping ii, 155, 160 directory, directories 30, 41, 45, 46, 47, 137, 139, 194, 251, 419, 427, 452, 453, 454, 456, 457, 460, 462 event-handling routine 161 executable statement 313, 320 execution program 51, 56, 219, 392, 50
GOTO 19, 53, 55, 59, 124, 156, 234, 236, 269, 270, 313, 477, 529 300, 301, 309, 310, 354, 355, 363, 364, 370, 371, 372, 378, 379, 398, 409, 412, 465, 466, 526 H file type 34, 135, 194, 222, 231, 243, 264, 274, 301, 310, 334, 354, 355, 364, 370, 372, 379, 459, 465, 466 header 35, 36, 149, 150, 151, 152, 279, 331, 334, 380, 382, 466, 535 flash ROM vi, 4, 5, 50, 73, 141, 466, 480, 481, 482, 523 highlighting characters 119 heading text 380 font size 88, 89, 97, 100, 101, 104, 105, 201, 240, 255, 261, 29
281, 282, 285, 293, 359, 385, 415, 480, 481, 482, 523 LINE INPUT # 140, 143, 156, 243, 263, 264, 355, 534 interrupt 53, 155, 158, 160, 161, 163, 174, 175, 271, 317, 415, 416, 484, 486, 491, 496, 502, 529, 532, 537 local variable 9, 10, 36, 206, 210, 226, 323 LOCATE 89, 90, 110, 112, 201, 239, 265, 266, 351, 361, 531 IR interface port 14 Ir-Transfer Utility C vii, 15, 16, 17, 48, 152 91, 94, 97, 101, 113, 117, 119, 241, 254, 261, 267, 297, 299, 363, 364, 376, 105, 181, 262, 334, 477, logical operation
341, 347, 354, 359, 360, 362, 363, 365, 367, 368, 370, 372, 374, 377, 378, 381, 385, 535, 536 momentary switching mode 144, 163, 276, 278 MSB 115, 184, 483, 484, 485, 486, 488, 490, 493, 496, 499, 502 multilink protocol, Multilink Protocol System 149, 151, 153, 330, 333, 488, 489, 490, 491 O object program vi, 6, 8, 9, 16, 17, 21, 34, 36, 45, 56, 192 Multilink Transfer Utility vii, 151, 153, 491 offduration 185, 186 multiple code reading 143 ON ERROR GOTO 65, 159, 192, 268, 316, 356, 357, 415, 530 mu
458, 459, 460, 466, 523, 534 optimizing drive 427 program file name, programfilename 46, 192, 193, 525 OR 19, 61, 75, 76, 79, 83, 84, 477 OUT 89, 112, 113, 114, 115, 116, 117, 118, 122, 124, 130, 132, 140, 145, 150, 151, 163, 173, 178, 186, 278, 291, 293, 294, 327, 362, 384, 425, 427, 477, 484, 486, 487, 490, 491, 495, 496, 497, 501, 502, 503, 504, 533 protocol function 149, 150, 151, 152, 358, 380, 382 PUT 137, 138, 140, 141, 222, 231, 274, 309, 310, 371, 379, 466, 477, 534 output port 145, 293, 484,
sizes of variables 33, 46 489, 490, 491, 492, 493, 495, 496, 498, 499, 501, 503 slave station 151 reserved word iii, iv, 65, 66, 67, 313, 470, 477 sleep timer 132, 163, 484, 486, 490, 491, 495, 496, 501, 502 RESTORE 202, 312, 314, 473, 477, 530 small-size font, small-size 88, 89, 97, 98, 99, 100, 101, 103, 104, 105, 107, 108, 109, 110, 111, 112, 113, 181, 182, 183, 201, 240, 254, 255, 256, 261, 265, 266, 319, 351, 376, 480, 481, 482, 492, 494, 497, 498, 500, 502, 503 RESUME 53, 65, 158, 159, 268, 315
147, 149, 150, 151, 152, 158, 159, 160, 161, 163, 174, 177, 178, 180, 181, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 216, 217, 218, 219, 220, 222, 223, 224, 225, 226, 228, 229, 230, 231, 232, 234, 235, 236, 237, 238, 240, 241, 242, 243, 244, 246, 247, 248, 249, 250, 252, 253, 254, 255, 257, 260, 261, 262, 263, 264, 268, 269, 270, 271, 272, 274, 275, 278, 284, 287, 293, 294, 295, 297, 298, 300, 301, 302, 303, 304, 306, 307, 30
14, 15, 16, 17, 20, 21, 22, 23, 26, 27, 29, 39, 40, 41, 42, 45, 47, 48, 49, 50, 51, 56, 57, 73, 94, 97, 116, 118, 122, 123, 124, 127, 136, 140, 145, 155, 158, 163, 165, 169, 170, 174, 175, 180, 181, 192, 194, 198, 201, 214, 219, 245, 254, 314, 326, 327, 390, 391, 395, 396, 407, 408, 413, 415, 419, 426, 457, 459, 483, 484, 485, 486, 488, 489, 490, 492, 493, 494, 495, 496, 498, 499, 500, 501, 502, 517, 523, 524, 525, 530 T tag-jump function, tag jump 30 terminator 149, 150, 151, 152, 331, 358, 535 text contr
W WAIT 131, 133, 143, 144, 156, 173, 291, 294, 326, 327, 477, 483, 484, 485, 488, 489, 492, 493, 498, 533 wakeup ii, 174, 490, 498, 532 169, 175, 491, 499, 170, 383, 492, 501, 171, 384, 493, 502, 172, 488, 495, 503, 173, 489, 496, 504, WHILE...
BHT-BASIC Programmer’s Manual First Edition, May 1993 Fifth Edition, October 2000 DENSO CORPORATION Industrial Systems Product Division The purpose of this manual is to provide accurate information in the development of application programs in BHT-BASIC. Please feel free to send your comments regarding any errors or omissions you may have found, or any suggestions you may have for generally improving the manual.