QSI QTERM-R55 User manual

QTERM-R55 USER'SMANUAL
REVISION 6
QSI CORPORATION
2212 South West Temple #50
Salt Lake City, Utah 84115-2648
USA
Phone 801-466-8770
Fax 801-466-8792
Email [email protected]
Web www.qsicorp.com
M01-012-00 Rev 6

31725E0 - Printed in USA
©Copyright QSI Corporation 1999-2009
QTERM, QTERM-R55 and QABASIC are trademarks of QSI Corporation.
Manual Updated 15 October 2009

FCC COMPLIANCE STATEMENT
This device complies with part 15 of the FCC Rules. Operation is subject to the following two conditions: (1) This device
may not cause harmful interference, and (2) this device must accept any interference received, including interference that
may cause undesired operation.
This equipment has been tested and found to comply with the limits for a Class A digital device, pursuant to part 15 of the
FCC Rules. These limits are designed to provide reasonable protection against harmful interference when the equipment is
operated in a commercial environment. This equipment generates, uses, and can radiate radio frequency energy and, if not
installed and used in accordance with the instruction manual, may cause harmful interference to radio communications.
Operation of this equipment in a residential area is likely to cause harmful interference in which case the user will be required
to correct the interference at his own expense.
Any modification to this device (including any changes to the recommended antenna configuration) that are not expressly
approved by QSI could void the user's authority to operate this device.


QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
FOREWORD
The QSI Corporation QTERM-R55 is a BASIC programmable data-entry terminal for industrial applications. The QTERM-
R55 is available with several options; this manual discusses all versions and their operation.
The QTERM-R55 is a CE certified product. It has been assessed against the requirements of EN 50082-1: 1992, EN55022:
1987, and EN 60950 (including Amendments Numbers 1, 2 and 3). Based on conformity with these requirements, the
QTERM-R55 is deemed in compliance with all applicable CE directives.
The sections of this manual are as follows:
Chapter 1. Basic Operation. This chapter helps you to quickly get acquainted with the QTERM-R55.
Chapter 2. qaBASIC. This chapter explains how to write a program in qaBASIC. It contains examples of how to use
each of the commands, then an explanation of the command.
Chapter 3. QTERM-R55 Hardware. This chapter contains the specifications for the QTERM-R55 terminal. Included
are dimensional drawings, interface specifications, connector pin assignments and environmental specifica-
tions.
Appendix A. ASCII Chart. This is a true 7-bit ASCII chart, along with mnemonic definitions.
Appendix B. QTERM-R55 Character Chart. This is a 256-character chart showing how the QTERM-R55 displays
ASCII characters. The lower half is similar to, but not the same as, the true ASCII chart in Appendix A.
Appendix C. qaBASIC Command Summary. This is an abbreviated summary of the qaBASIC commands.
Appendix D. Using the R55 Downloader. This chapter describes how to use the R55 Downloader program.

ii QTERM-R55 User's Manual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
1
CHAPTER 1. BASIC OPERATION 1
1.1 Power-On Setup 1
1.2 Connect the Communications Lines 2
1.3 Apply Power 3
1.4 Running the R55 Downloader 3
5
CHAPTER 2. QABASIC 5
2.1 Syntax 5
2.1.1 Case 5
2.1.1.1 Variables 5
2.1.1.2 String Variables 5
2.1.1.3 Numerical Variables 5
2.1.1.4 Multiple Commands on One Line 5
2.2 Introduction to qaBASIC 5
2.2.1 REM 6
2.2.2 Input 6
2.2.3 Print 6
2.3 Arithmetic 6
2.3.1 Operations 6
2.3.2 Functions 6
2.3.2.1 Trigonometric Functions 6
2.3.2.2 Exponentiation 6
2.3.2.3 Integer and Fractional Parts 7
2.3.2.4 Remainder 7
2.3.2.5 Minimum and Maximum 7
2.3.2.6 Square Root 7
2.4 String Operations 7
2.4.1 Length of a String 7
2.4.2 Extracting Parts of a String 7
2.4.3 Strings to Numbers (and Numbers to Strings) 7
2.4.4 Finding Strings in Strings 8
2.4.5 Changing the Case of Strings 8
2.4.6 Removing Spaces 8
2.4.7 The ASCII Character Set Functions 9
2.4.8 Escape Sequences 9
2.5 Conditions and Flow Control 9
2.5.1 The if Statement 10
2.5.2 Conditions 10
2.5.3 Marking Locations in a Program 10
2.5.4 Jumping Around in a Program 10
2.5.5 on gosub, on goto 10
2.5.6 End of Program 11
2.6 Loops 11
2.7 Data and Arrays 11
2.7.1 Reading Data 11
2.7.2 Arrays 11
2.8 Interaction with System Hardware 12
2.8.1 Date and Time 12
2.8.2 Cursor Appearance 13
2.8.3 Peek 13
2.8.4 Serial Communication 13
2.8.5 Keypad LEDs 13

iv QTERM- User's Manual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
2.8.6 Display Contrast 14
2.8.7 Display Backlight 14
2.8.8 Key Click 14
2.8.9 Keypad Backlight 14
2.8.10 Speaker 14
2.8.11 Pause Execution 14
2.8.12 Defining the Keyboard 14
2.8.13 Shift State 15
2.9 Printing and Controlling the Screen 15
2.9.1 Printing Output 15
2.9.2 Autowrap and Autoscroll 15
2.10 Nonvolatile Storage of Data 15
2.11 Error Handling 16
17
CHAPTER 3. QTERM-R55 HARDWARE 17
3.1 QTERM-R55 Handheld Terminal 17
3.2 QTERM-R55 Panel-Mount Terminal 17
3.3 QTERM-R55 Large Character Panel-Mount Terminal 18
3.4 Interfaces 19
3.4.1 EIA-232 Interface 19
3.4.2 EIA-422 Interface 19
3.4.3 EIA-485 Interface 20
3.5 LCD Display 21
3.6 Keypad 21
3.7 Other Options 21
3.7.1 Speaker Option 21
3.7.2 Real-Time Clock Option 21
3.7.3 Switching Regulator 21
3.8 QTERM Specifications 22
3.8.1 Environmental Characteristics 22
3.8.2 Electrical Characteristics 22
23
APPENDIX A. ASCII CHART 23
APPENDIX B. 23
25
APPENDIX C. QTERM-R55 CHARACTER CHART 25
27
APPENDIX D. QABASIC COMMAND SUMMARY 27
31
APPENDIX E. USING THE R55 DOWNLOADER 31
E.1. Purpose 31
E.2. Setup 31
E.3. Basic Operation 31
E.3.1. Using the R55 Downloader 31
E.3.2. Selecting the file to download 31
E.3.3. Selecting the serial port 31
E.3.4. Setting the communication parameters 31
E.3.5. Downloading the application 31

QTERM- User's Manual v
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
E.3.6. Cancel 31
E.4. Advanced Features 32
E.4.1. Port State 32
E.4.2. Send to R55 32
E.4.3. Clear Box 32
E.4.4. Preprocessor Settings 32
E.5. Preprocessor Directives 32
E.5.1. Overview 32
E.5.2. Include 32
E.5.3. Define 32

vi QTERM- User's Manual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
CHAPTER 1.
BASIC OPERATION
There are only four steps required to communicate with the
QTERM-R55:
•use Power-On Setup to set the display contrast, baud
rate and data format
•connect to your host transmit, receive and ground lines
•apply power
•download application to the QTERM-R55
1.1 Power-On Setup
The Power-On Setup menu is used to configure the
QTERM-R55’s display contrast, baud rate and data format.
This feature is also used to download new terminal firm-
ware and to download the BASIC program file to the termi-
nal. Normally, when power is applied to the unit, it will
perform a few self-diagnostics and then check for a missing
or bad program file. If the application file is bad or not
present, the terminal will enter a download mode. If the
program is present and uncorrupted, it is compiled and exe-
cuted. An existing program file may be replaced with
another one through the Power-On Setup routines. Alterna-
tively, when a program ends normally (or due to an error),
the QTERM-R55 will enter download mode.
To enter the Power-On Setup menu, follow these steps:
•Connect the power supply to the QTERM-R55.
•Hold down any three keys and apply power to the
QTERM-R55 (you do not need to connect the transmit
and receive lines). When the words POWER ON
SETUP (POS) appear on the screen, release the keys.
•After a brief pause, a menu will appear. The asterisk
indicates the currently selected menu item.
•The keys used for navigating the Power-On Setup
menus are located in the upper right corner of the key-
pad (Figure 1-1 shows key locations for the 40-key
keypad; the keys for the 24-key keypad are in similar
locations with respect to the upper right corner of the
keypad). The up arrow is hereafter referenced as the
POS Up key. The other marked keys are similarly
designated as POS Down, POS Left, POS Right and
POS Enter.
Figure 1-1. Key Names.
ENTER
40-key
Keypad
24-key
Keypad
Left Column of KeysLED Labels
POWER
ENTER

2QTERM-R55User'sManual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
•Use the POS Up, POS Down, POS Left and POS
Right keys to highlight the menu item for the parame-
ter which you would like to change. Press the POS
Enter key to select that item.
•The System menu allows adjustment of the display
contrast and keyboard settings. When Contrast is
selected the word CONTRAST will appear on the
screen. The desired contrast is increased or decreased
by pressing the POS Up or POS Down keys repeat-
edly. Press the POS Enter key to return to the POS
menu.
•Keyboard settings such as Key Click, Key Repeat,
Repeat Delay and Repeat Rate are accessed from the
Keypad menu under the System menu. The Key Click
and Key Repeat are toggled on and off by pressing the
POS Enter key when Click or Rpt are selected. The
Repeat Delay and Repeat Period may be incremented
or decremented in 10 ms increments by pressing the
POS Up or POS Down after Rpt Dly or Rpt Prd has
been selected. When the desired value is displayed,
press the POS Enter key to accept the value.
•Selecting Back from any menu returns to the previ-
ously displayed menu.
•The COM Setup menu is used to set the serial port
baud rate and data format for the Primary Port or the
Secondary Port (if the QTERM-R55 was purchased
with the auxiliary serial port option). The baud rate is
adjusted up and down with the POS Up and POS
Down keys; press POS Enter when the desired baud
rate is displayed. Select data format to adjust the num-
ber of data bits, parity and number of stop bits for the
serial port. Selecting Back/Save from the menu saves
these parameters and returns to the main POS menu.
•The Clock menu is used to set the Real Time Clock. If
the QTERM-R55 was not purchased with the Real
Time Clock option, Clock will not be displayed on the
main POS menu.
•The Defaults menu restores all settings, including
contrast, baud rate and data format, to their default
values. No submenu exists for this item.
•The Download menu allows new terminal firmware
and BASIC programs to be downloaded to the termi-
nal. Select Firmware to upgrade the terminal firm-
ware. The terminal will enter its bootloader routine
and await receipt of the new firmware via the primary
serial port. Selecting Application will enter a BASIC
program download routine. The terminal is now ready
to receive your BASIC program via the primary serial
port. Back will return to the main POS menu without
receiving any files.
•If the QTERM-R55 is configured with the 1.0 Mbyte
flash memory option, the additional memory may be
reserved for application storage (i.e. the qaBASIC pro-
gram is stored in this space) or user file space. Choos-
ing Application will display a menu to select how
much memory is assigned to each of these tasks.
Assign the memory by pressing POS Left and POS
Right, then accept the settings by pressing POS
Enter. The terminal will now enter the BASIC pro-
gram download routine. The default partition (128
kbytes for application space and 640 kbytes for the file
system) is usually appropriate unless your application
is very large.
1.2 Connect the Communications Lines
The EIA-232 device has one transmit and one receive line,
while the EIA-422 device has two transmit and two receive
lines. The EIA-485 device has two bidirectional (transmit/
receive) lines.
Table 3-2 in Chapter 3 shows the connector pin assign-
ments for all versions. The receive and transmit directions
shown in the table are relative to the QTERM-R55. Refer to
this table to connect your host communications lines to the
correct pins. Figure 1-2 shows the pin numbering of the 6-
Figure 1-2. QTERM Connector Pin Assignments.

QTERM-R55 User's Manual 3
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
pin modular connector (both jack and plug). The panel
mount interface plug also uses this pinout.
(If you are using an IBM-style PC, you cannot connect an
EIA-422 or EIA-485 QTERM-R55 directly to the com-
puter's COM port; you must provide an interface device.)
1.3 Apply Power
Table 3-2 in Chapter 3 shows the pin assignments for the
power and ground lines. Connect your DC power supply to
the appropriate two pins.
WARNING: Power supplied to the
QTERM-R55 must be from a SELV
power source, and should have a current
limit on its output of 5 Amperes. The
supply to the QTERM-R55 must provide
a minimum of 8 volts DC and be limited to a maximum of
32 volts DC. Limiting may be inherent to the supply or may
be provided by supplementary overcurrent devices.
If the QTERM-R55 does not respond, or exhibits abnormal
behavior on power up, disconnect power and contact QSI
for technical support.
1.4 Running the R55 Downloader
See Appendix D. for information about the R55 Down-
loader for Windows™.

4QTERM-R55User'sManual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
CHAPTER 2.
QABASIC
The QTERM-R55 is a user programmable operator inter-
face terminal for industrial applications. The terminal is
programmed using qaBASIC, a dialect of the common and
simple BASIC programming language. The BASIC pro-
gram can be written using any computer text editor and
then downloaded into the terminal and stored in non-vola-
tile memory. This program is executed after power is
applied to the system. The program may be updated
through the Power-On Setup menu; see section 1.1.
qaBASIC is a modified version of YABASIC, a BASIC
compiler and runtime execution engine written by Marc
Oliver Ulm. Much of this chapter was derived from the
documentation that is included with the YABASIC distri-
bution. YABASIC is distributed under the terms of the
GNU Public License which allows modification and redis-
tribution of the software provided that the same license
applies to the modified version. Source code for the
YABASIC modification may be obtained from QSI upon
request. Contact QSI for details. Refer to the LICENSE file
included on the distribution disk for more information on
the GNU Public License.
The QTERM-R55 also uses uC/OS, the Real Time Kernel,
by Jean Labrosse.
2.1 Syntax
2.1.1 Case
Commands can be entered in any case.
input is the same as INPUT and even as InPUt. This
applies to every command in qaBASIC.
2.1.1.1 Variables
Variable names are case sensitive (i.e. types of variables:
a$ and A$ are different) and can be of any length. There
are two sorts of variables:
2.1.1.2 String Variables
String variables always have a dollar sign ($) as the last
character of their names, e.g., a$, b12$ or VeryLong-
Name$ and may contain strings of any length. String vari-
ables can contain any characters except the NULL
character (ASCII 0).
2.1.1.3 Numerical Variables
a, c3po or ThisIsAnEvenLongerName are examples
of numerical variables and can contain real numbers like -
1.3, 2, 15.3e44 or 0.
Variables (with the exception of arrays) need not be
declared; their initial values are "" (for string variables) and
0.0 (for numerical variables).
2.1.1.4 Multiple Commands on One Line
More than one command can appear on one line. The com-
mands must be separated with colons.
2.2 Introduction to qaBASIC
Example 1:
REM this is the first R55 BASIC program
input "Enter two numbers:" a,b
print a,"+",b,"=",a+b
print "Please enter your Name:";
INPUT a$
print "Hello ",a$," !"
This program produces the following output (user input is
displayed using this typeface):
Enter two numbers: 2 3
2+3=5
Please enter your Name: Bill
Hello Bill !

6QTERM-R55User'sManual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
2.2.1 REM
The REM statement introduces comments. Everything after
REM up to the end of the line is ignored. The ’(apostrophe)
is an abbreviated replacement for REM.
2.2.2 Input
This statement reads one or more variables from the user.
The syntax for this command is
input [prompt] var1[,var2,...]
The optional [prompt] string after the input statement
("Enter two numbers:") is printed on the terminal
prior to reading any input. If the prompt string is omitted,
the terminal uses the “?” character to prompt the user. Note
that there is no semicolon or comma after this prompt
string. If multiple variables are requested, they are listed
after the prompt string, separated by commas.
The default input source is the keypad. This command may
also be used to read input from a serial port or the non-vol-
atile file store. See Serial Communication (section 2.8.4)
and Nonvolatile Storage of Data (section 2.10) for details.
2.2.3 Print
The print statement writes all its arguments to the dis-
play. After writing its last argument, print advances the
cursor to the next line (as in print "Hello ",a$,"
!"). To do this, the QTERM-R55 inserts a carriage return
character (0x0D) and a linefeed character (0x0A) after the
string. To avoid this behavior, place a semicolon after the
last argument (as in print "Please enter your
Name:";).
Note that print can be abbreviated with a single question
mark (?). If you want to print (or input) at a specific loca-
tion, refer to Printing and Controlling the Screen (section
2.9).
The default output destination is the display. This com-
mand may also be used to send output to a serial port or the
non-volatile file store. See Serial Communication (section
2.8.4) and Nonvolatile Storage of Data (section 2.10) for
details.
2.3 Arithmetic
Example 2:
print 1+2,2*3,4/2,2^3
print sin(1.0),cos(pi),tan(3)
print asin(0.5),acos(0.7)
print atan(2),atan(1,2)
print exp(1),log(2),log(euler)
print int(2.34),frac(2.34)
mod(11,4)
print min(2,3),max(2,3)
print sqrt(2)
This program produces the following output:
3 6 2 83
0.841471 -1 -0.142547
0.523599 0.795399
1.10715 0.463648
2.71828 0.693147 1
2 0.34
3
2 3
1.41421
2.3.1 Operations
qaBASIC has five arithmetic operators: +(addition), -
(subtraction), *(multiplication), / (division) and ^
(power); they all behave as expected, as in Example 2.
Note that the power operator (^) handles fractional powers:
8^(1/3) returns 2as a result.
2.3.2 Functions
This section demonstrates and explains the arithmetic func-
tions of qaBASIC.
2.3.2.1 Trigonometric Functions
Example 2 illustrates the six supported trigonometric func-
tions.
qaBASIC can calculate sine, cosine, tangent and their
inverses. All these functions expect their argument in radi-
ans; to facilitate the transformation from degrees to radians
(radian=degree*pi/180), there is a predefined vari-
able named pi (or PI) which has an initial value of
3.14159.
The atan() function has two forms. Called with a single
argument (e.g. atan(2)) atan()returns a value between
-pi/2 ... +pi/2. Called with two arguments (e.g. atan(2,-
1)) atan() returns a value between -pi and +pi. (This can
be useful when transforming from cartesian to polar coordi-
nates).
2.3.2.2 Exponentiation
The exp() functions comes with its inverse: the log()
function. log() and exp() operate with the base e

QTERM-R55 User's Manual 7
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
(2.71828) which comes as a predefined variable named
euler. The exponentiation functions are illustrated by the
second qaBASIC example.
2.3.2.3 Integer and Fractional Parts
The functions int() and frac() split their argument at
the decimal point (see Example 2). int drops the fractional
portion of the argument and returns an integer. frac
returns just the fractional portion of the argument.
2.3.2.4 Remainder
To get the remainder of a division use the mod() function.
As Example 2 shows, mod(11,4) produces 3, because
11/4 = 2 with a remainder of 3.
NOTE: Arithmetic operations using large numbers may
cause fractional inconsistencies in your answer. For exam-
ple, 12000000 / 300000 may yield 40.00000001. This is
inherent in floating point arithmetic.
2.3.2.5 Minimum and Maximum
The functions min() and max() return the lower and
higher value of their two arguments respectively (see
Example 2).
2.3.2.6 Square Root
The square root is calculated by the sqrt() function (see
Example 2).
2.4 String Operations
BASIC has always been simple and strong in string pro-
cessing. qaBASIC also maintains this feature.
Example 3:
a$="123456"
print len(a$)
print left$(a$,2),"-";
print mid$(a$,2,3),"-";
print right$(a$,3)
left$(a$,2)="abcd":print a$
print str$(12)
print str$(12.123455,"%08.5f")
print 2+val("23")
print val("e2")
instr("Hallo","al")
lower$("aBcD12fG")
ltrim$(" foo ")
print asc("e")
This program produces the following output:
6
12-234-456
ab3456
12
12.12346
25
0
2
abcd12fg
"foo "
101
2.4.1 Length of a String
The len() function returns the length of the string (see
Example 3).
2.4.2 Extracting Parts of a String
There are three functions which return parts of a string:
left$(<string>,<length>)
right$(<string>,<length>)
mid$(<string>,<position>,<length>)
left$() returns the leftmost <length> characters of
<string>. right$() returns the rightmost <length> char-
acters of <string>, and mid$() cuts in the middle, return-
ing <length> number of characters starting at <position>
characters from the left end of <string>. The first character
of a string is at position 1.
Furthermore, left$() and its associated functions can
even be used to selectively change parts of a string by
assigning a string to the function. Example 3 shows that
only the two leftmost characters are changed (even though
the string "abcd" contains four characters). The same can
be done with mid$() or right$().
2.4.3 Strings to Numbers (and Numbers to Strings)
The str$( ) converts its numeric argument to a string (see
conversion of 12 in Example 3).
Formatting of the number is optionally specified by a sec-
ond argument ("08.5f" in Example 3). The second argu-
ment is essentially a format string as used by the printf()
function in the C programming language. A subset of this
function is supported by the QTERM-R55.
Format: str$ (value, "%Flagfieldwidth.
PrecisionArgument")

8QTERM-R55User'sManual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
More examples are listed in Table 2-0.
Further information can be found in any textbook on the C
programming language.
The val()function converts its string argument to a num-
ber (see conversion of "23" in the Example 3). Note that
"e2" is converted to 0because this string is not a valid
number.
2.4.4 Finding Strings in Strings
The instr()function returns the position of its second
string argument within the first. instr()returns zero if
the string cannot be found.
instr("Hallo","al") in Example 3 returns 2
because "al" appears at position 2 within "Hallo".
instr("Hallo","Al") returns 0, because "Al" is not
contained in "Hallo" (the case doesn't match).
2.4.5 Changing the Case of Strings
lower$() and its counterpart upper$() convert their
string argument to all lower or all upper case characters
respectively.
lower$("aBcD12fG") returns "abcd12fg" as
shown in Example 3.
2.4.6 Removing Spaces
ltrim$() and rtrim$() are two functions to remove
leading or trailing spaces from a string. trim$() removes
both leading and trailing spaces.
ltrim$(" foo ") returns "foo " (see Example 3)
and rtrim$(" foo ") returns " foo". trim$(“
foo “) returns “foo”.
Value Value is the variable to be con-
verted
Flag OPTIONAL – One or more flags
can be used to modify the result of
the output, as follows
–Left adjustment of the output in
the specified field width
+Number will be printed with a
sign
space If the first character does not con-
tain a sign, a space will be added
0Leading zeros will pad the field
#A decimal point will always be
added. For gand Gformats (see
below), trailing zeros will be
removed
Fieldwidth REQUIRED – A number that
specifies the minimum width of
the field. The output will be
printed in a field at least this wide,
wider if necessary. The fewer
characters than specified. Padding
on the right will occur if left
alignment (– ) was used.
. (period) OPTIONAL (required if precision
is used) – Separates the Field-
width from the Precision.
Precision OPTIONAL – Maximum number
of characters to be printed after
the decimal point for e, E, and f
output. For gand G, it represents
the number of significant digits.
Argument
f f Floating point ouput:
(–)xxx.yyy
The number of ydigits is
specified
by the Precision
6 is the default precision, 0
will suppress the decimal
point unless the # flag is used
e, EFloating point ouput:
(–)xx.yyyye
zz or(–)xx.yyyyE zz
The number of y digits is
specified by
the Precision
6 is the default precision, 0
will suppress the decimal
point
g, GFloating point ouput:
%e or %E are used if the
exponent is less than -4 or
greater than or equal to the
Precision, otherwise use
%f. Trailing zeros and deci-
mals are not printed.
Table 2-0. More Examples Using the str$ Function.
Print Statements Output
Produced
print "="
str$(12.12345,"%08.3f");
print "="
=0012.123=
print "=",
str$(12.12345,"%8.2f");
print "="
= 12.12=
print "=",
str$(12.12345,"%-6.2f");
print "="
=12.12 =

QTERM-R55 User's Manual 9
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
2.4.7 The ASCII Character Set Functions
qaBASIC offers two functions to work with the ASCII
character set.
asc() converts a specific character to its ASCII value.
print asc("e") returns 101 as a result (see Example
3), because the character "e" has position 101 within the
ASCII character set. Appendix A contains a complete 7-bit
ASCII chart.
Likewise the function chr$() returns the ASCII character
for a given position within the character set, e.g.
chr$(98) returns "b".
2.4.8 Escape Sequences
The most important non-printable characters can be con-
structed using escape sequences with the \character: The
sequence \n might be used instead of chr$(10) for the
newline character.
Table 2-1 lists all escape sequences of qaBASIC (these are
similar to the sequences used by the C-language).
These escape sequences are replaced within every pair of
double quotes (""), i.e. within literal strings. User input
read with the input statement is not affected in any way.
2.5 Conditions and Flow Control
Example 4:
input "Please enter a number" a
if (a>10) then
print "Hello ";
print "Your number is bigger than 10"
else
print "Byebye ";
print "Your number is less or equal 10"
endif
This program produces the following output:
Please enter a number 2
Byebye Your number is less or equal 10
Alternatively:
Please enter a number 11
Hello Your number is bigger than 10
Example 5:
input "Please enter a number" a
if a>10 and a<20 then
rem parentheses are optional
print "bigger than 10 ";
print "but less than 20"
fi
This program produces the following output:
Please enter a number 11
bigger than 10 but less than 20
Alternatively:
Please enter a number 10
Example 6:
label loop
? "Enter a string containing \"R55\""
input a$
if (instr(upper$(a$),"R55")<>0) then
gosub thanx
else
print "No, please try again !"
endif
goto loop
label thanx
print "Thanks a lot !"
return
This program produces the following output:
Enter a string containing "R55"
?thequickbrownfox
No, please try again !
Enter a string containing "R55"
?jumpedR55overthelazydog
Thanks a lot !
Table 2-1. Escape Sequences for qaBASIC.
Escape
Sequence Resulting
Character ASCII
Value
\n newline 10
\t tabulator 9
\b vertical tabulator 11
\v backspace 8
\r carriage return 13
\f form feed 12
\a alert 7
\\ backslash 92
\‘ single quote 39
\” double quote 34

10 QTERM-R55 User's Manual
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
2.5.1 The if Statement
The if-then statement is necessary for making deci-
sions. The syntax is as follows:
if [(]<condition>[)] then
<instructions>
[else
<alternative instructions>]
endif
As shown, the parentheses around <condition> are
optional. The else <alternative instructions> is also
optional. Note that endif can be written as fi.
<condition> is described below in Conditions (section
2.5.2). <instructions> and <alternative instructions> can be
be any series of BASIC statements. If <condition> evalu-
ates to TRUE, then <instructions> is executed. If <condi-
tion> evaluates to FALSE, <alternative instructions> (if
included) is executed.
2.5.2 Conditions
Numbers or arithmetic expressions can be compared with
the usual relational operators: =(equal), <> (not equal), <
(less than), <= (less or equal), >(greater than) and >=
(greater or equal).
Strings can be compared with the same set of operators,
where characters are ordered according to the ASCII char-
acter set. For example,("a"<"b") is true because "a"
precedes "b" within the ASCII character set. Likewise
("a"="b") is false.
More than one comparison can be combined with parenthe-
ses () and these keywords: or, and, not. not has higher
precedence than and, which in turn has higher precedence
than or (in the same way as *precedes +within arithmetic
expressions). This means that
not a>b or a==c and b>0
is the same as
((not a>b) or (a==c)) and (b>0)
Finally, the enclosing parentheses can be omitted, i.e. if
a<10 then ... is a valid statement.
2.5.3 Marking Locations in a Program
The first line in the Example 6 program (label loop) is
a label.
qaBASIC does not require line numbers, thus labels are
necessary to mark a specific location within your program
(however, see the following paragraph). You can compose
labels out of letters and digits. The keyword label is
required, and the label itself should be unique within your
program.
qaBASIC allows for line numbering. This feature makes
qaBASIC more compatible with traditional versions of
BASIC. Line numbers are just special types of labels with
the following properties:
•Line numbers can appear only at the beginning of a
line.
•Not every line needs a number and line numbers need
not be consecutive.
2.5.4 Jumping Around in a Program
A label by itself causes no special action. Only in conjunc-
tion with the goto statement (or gosub or restore)
does a label have any function. If qaBASIC encounters a
goto statement (in the Example 6 goto loop), then it
searches for the matching label (label loop) and pro-
ceeds to execute at the position of the label.
Note that you can even leave (and enter) a for-next loop
(see section 2.6) with goto.
Closely related to the goto command is the gosub com-
mand. If qaBASIC encounters a gosub statement, it
searches for the matching label (label thanx in Exam-
ple 6), and proceeds with execution at the position of the
label until it finds a return statement. return makes
qaBASIC return to the position of the original gosub and
proceed from there.
Note that both goto and gosub can be used as on goto
and on gosub (see on gosub, on goto (section 2.5.5).
2.5.5 on gosub, on goto
The on gosub statement is followed by a list of labels
(sorry,one,two,...) in Example 9 (below). Depend-
ing on the value of the expression (number+1), the corre-
sponding label in the list is chosen: for example, if
number+1 evaluates to 3, the third label (three) is
selected and a gosub to this label is performed.
A gosub is always performed, regardless of the value of
the expression. More specifically, if number+1 gives any-
thing less or equal to 1, then the first label (sorry) is cho-
sen. If number+1 evaluates to anything greater or equal to
the number of elements in the list (which is 7 in Example
9), then the last label (sorry) is chosen. Therefore, the
Table of contents
Popular Touch Terminal manuals by other brands

Wincor Nixdorf
Wincor Nixdorf BEETLE /M-II plus user guide

Tektronix
Tektronix 4010 Maintenance manual

Shenzhen Tozed Technologies
Shenzhen Tozed Technologies G8504 user manual

Protech Systems
Protech Systems POS-6511 Quick reference guide

UTC RETAIL
UTC RETAIL 2170 user guide

Denso
Denso BHT-200 Supported equipment manual

Bilanciai
Bilanciai D450 user manual

National Instruments
National Instruments SCXI-1328 installation guide

CopperOptics
CopperOptics PairGain PG-Flex Plus PCS-818 manual

Elo Touch Solutions
Elo Touch Solutions PayPoint Plus Developer's guide

EBN Technology
EBN Technology TM-550 Service manual

Contec
Contec DIO-24DY-USB user guide