BHT-BASIC Programmer's Manual
Total Page:16
File Type:pdf, Size:1020Kb
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 trade- marks of their respective holders. BHT, CU, BHT-protocol, BHT-Ir protocol, and BHT-BASIC are trademarks of DENSO CORPO- RATION. 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/BHT- 5000/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®. For the details about Windows™, refer to the Microsoft Windows documentations. i 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 devel- oping procedure. Chapter 3. Program Structure Summarizes the basic structure of programs and programming techniques, e.g., program chaining and included files. Chapter 4. Basic Program Elements Describes the format of a program line, usable characters, and labels. Chapter 5. Data Types Covers data which the programs can handle, by classifying them into data types--constants and variables. Chapter 6. Expressions and Operators Surveys the expressions and operators to be used for calculation and for handling concate- nated character strings. The operators connect, manipulate, and compare the expressions. Chapter 7. I/O Facilities Defines I/O facilities and describes output to the LCD, input from the keyboard, and control for the timer, beeper, and other I/Os by the statements and functions. Chapter 8. Files Describes data files and device files. Chapter 9. Event Polling and Error/Event Trapping Describes the event polling and two types of traps: error traps and event (of keystroke) traps supported by BHT-BASIC. Chapter 10. Sleep Function Describes the sleep function. Chapter 11. Resume Function Describes the resume function. Chapter 12. Power-related Features Describes low battery warning, the prohibited simultaneous operation of the beeper/illumina- tion LED (or laser source)/LCD backlight, the wakeup, and remote wakeup. ii 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. Spread Spectrum Communications (available with the BHT-7500S) Summarizes the spread spectrum communication system that may be configured with the BHT-7500S. This chapter also explains wireless-related statements and the function library SS.FN3 to be used in wireless communications programming. Chapter 18. TCP/IP Surveys the socket application program interface (API) and FTP client. This chapter also describes the two function libraries--SOCKET.FN3 and FTP.FN3, which are built in the BHT- 7500S for providing BHT-BASIC programs with access to a subset of the TCP/IP family of pro- tocols over wireless communications devices. Appendix A: Error Codes and Error Messages B: Reserved Words C: Character Sets D: I/O Ports E: Key Number Assignment on the Keyboard F: Memory Area G: Handling Space Characters in Downloading H: Programming Notes I: Program Samples J: Quick Reference for Statements and Functions K: Unsupported Statements and Functions iii I 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. Example: [commonvariable] 4. Items enclosed in braces { } and separated by vertical bars | represent alternative items. You should choose either item. Example: CURSOR {ON|OFF} 5. An ellipsis . indicates that you can code the previous item described in one line two or more times in succession. Example: READ variable[,variable...] 6. Hexadecimal values are followed by h. In many cases, hexadecimal values are enclosed with parentheses and preceded by decimal values. Example: 65 (41h) and 255 (FFh) In program description, hexadecimal values are preceded by &H. Example: &H41 and &HFF 7. Programs make no distinction between uppercase and lowercase letters, except for character string data. The uppercase-lowercase distinction used in this manual is intended to increase the legibility of the statements. For example, reserved words are expressed in uppercase; label names and variable names in lowercase. In practical programming, it is not nec- essary to observe the distinction rules used in this manual. The examples below are regarded as the same. Example 1: &HFFFF, &hffff, and &hFFFF Example 2: A AND B, a and b, and a AND b Example 3: PRINT STR$(12), Print Str$(12), and print str$(12) iv I Icons Used in This Book Statements and functions unique to BHT-BASIC. I Syntax for the Statement Reference and Function Reference The syntax in programming is expressed as shown in the example below. For the INPUT statement Syntax: INPUT [;]["prompt"{,|;}]variable According to the above syntax, all of the following samples are correct: INPUT;keydata INPUT keydata INPUT "input =",keydata INPUT;"input =";keydata v I 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. Listed below are the versions and memories in which Easy Pack is to be stored. For details about each ver- sion of Easy Pack, refer to the respective manual shown below. Version of Easy BHT Series Memory Refer to: Pack BHT-3000 Easy Pack 4.1 ROM "BHT-3000 User’s Manual" BHT-4000 Easy Pack 4.2 User area of RAM "BHT-4000 User’s Manual" BHT-5000 Easy Pack Pro User area of RAM "Easy Pack Pro User’s Manual" BHT-6000 or flash ROM BHT-6500 BHT and CU This manual expresses the BHT-3000/BHT-4000/BHT-5000/BHT-6000/BHT-6500/BHT- 7000/BHT-7500 as BHT. To designate each of them, it expresses the series or model as listed below. Series Model RAM Capacity Flash ROM Capacity BHT-3000 BHT-3041 128KB — BHT-3045 512KB — BHT-4000 BHT-4082 256KB — BHT-4086 768KB — BHT-4089 2048KB — BHT-5000 BHT-5071 128KB 512KB BHT-5075 512KB 512KB BHT-5077 1024KB 512KB BHT-5079 2048KB 512KB BHT-6000 BHT-6045 512KB 512KB BHT-6047 512KB 1024KB BHT-6049 512KB 2048KB BHT-6500 BHT-6505 512KB 512KB BHT-6509 2048KB 512KB BHT-7000 BHT-7064 512KB 2048KB BHT-7500 BHT-7508 1024KB 8192KB BHT-7508S 512KB 8192KB In the same way as above, the CU-3000/CU-4000/CU-5000/CU-6000/CU-7000 are expressed as CU. vi I 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 RAM I Related Publications For BHT-3000 BHT-3000 User’s Manual For BHT-4000 BHT-4000 User’s Manual For BHT-5000 BHT-5000 User’s Manual Multilink Transfer Utility Guide For BHT-6000 BHT-6000 User’s Manual For BHT-6500 BHT-6500 User’s Manual For BHT-7000 BHT-7000 User’s Manual For BHT-7500 BHT-7500 User’s Manual For all of the BHTs Transfer Utility Guide For BHT-6000/BHT-6500/BHT-7000/BHT-7500 Ir-Transfer Utility C Guide Ir-Transfer Utility E Guide For BHT-4000R/BHT-5000R BHT-BASIC Programmer’s Manual For Radio Communications I Screen Indication The lettering in the screens of the BHT and host computer in this manual is a little differ- ent from that in the actual screens. File names used are only for description purpose, so they will not appear if you have not downloaded files having those names to the BHT. vii 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.....................................................................................................