QSI QTERM-R55 User Manual Download Page 20

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

i

s 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 

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 (

1

), the corre-

sponding label in the list is chosen: for example, if 

1

 evaluates to 3, the third label (

three

) is 

selected and a 

gosub

 to this label is performed.

gosub

 is always performed, regardless of the value of 

the expression. More specifically, if 

1

 gives any-

thing less or equal to 1, then the first label (

sorry

) is cho-

sen. If 

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 

Summary of Contents for QTERM-R55

Page 1: ...M R55 USER S MANUAL 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 info qsicorp com Web www qsicorp com M01 012 00 Re...

Page 2: ...31725E0 Printed in USA Copyright QSI Corporation 1999 2009 QTERM QTERM R55 and QABASIC are trademarks of QSI Corporation Manual Updated 15 October 2009...

Page 3: ...nable 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 u...

Page 4: ......

Page 5: ...inted 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...

Page 6: ...ii QTERM R55 User s Manual QSI Corporation Fax 801 466 8792 Web www qsicorp com Phone 801 466 8770...

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

Page 8: ...acter 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 Opt...

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

Page 10: ...vi QTERM User s Manual QSI Corporation Fax 801 466 8792 Web www qsicorp com Phone 801 466 8770...

Page 11: ...ting 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 th...

Page 12: ...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 th...

Page 13: ...round 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...

Page 14: ...4 QTERM R55 User s Manual QSI Corporation Fax 801 466 8792 Web www qsicorp com Phone 801 466 8770...

Page 15: ...lic 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 e...

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

Page 17: ...2 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 f...

Page 18: ...stment 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 0 Leading zeros will pad the field A de...

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

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

Page 21: ...maxnum read names a next a label loop input Please enter a number num num int num if num 1 and num maxnum then print num names num goto loop endif print Sorry can t convert num label names data 9 one...

Page 22: ...or at 2 3 a 12345 a 4 send COM1 a send COM1 a a recv COM1 a recv COM1 print COM1 a a led 3 on led 4 off backlight on bell pause 10 This program produces the following output phrases in parentheses des...

Page 23: ...ds The syntax is peek keyword where keyword is one of the following columns rows numkeys cursorX cursorY COM1 COM2 ostick The numeric return value contains the requested informa tion 2 8 4 Serial Comm...

Page 24: ...is delayed in sec onds 2 8 12 Defining the Keyboard Input from the keyboard can be done in two ways The first method is to check periodically if there has been a key pressed by using the iskeypressed...

Page 25: ...utoscroll autowrap and autoscroll are screen display com mands that allow the qaBASIC program to control how the display responds when printing and reaching the end of a line or the bottom of the scre...

Page 26: ...command can only be used to write to a file if it has been opened for appending and the current file pointer loca tion is at the end of the file Note that the print and input commands automatically po...

Page 27: ...ctors used on the QTERM R55 For reference Table 3 1 shows the pin assignments used by the COM ports on PC style computers for both DB25 and DB9 connectors 3 2 QTERM R55 Panel Mount Terminal The panel...

Page 28: ...esigned so they can be attached before inserting the terminal into the panel Once the brackets have been installed the terminal is inserted into the panel and the brackets are slid outward Then the sc...

Page 29: ...nes on the DB9 connector 3 4 2 EIA 422 Interface With proper cables and grounding the EIA 422 interface can communicate up to a distance of about 1 000 meters The EIA 422 version of the QTERM R55 uses...

Page 30: ...tion 5VDC Out LowBAT 5VDC Out Ground Function BATSLP 2mm 1 2 3 4 5 Ground 5VDC Out 5 6 Ground Function 2mm 1 Rx 232 CTS 4 3 Tx 2 RTS 485 RTx RTx N C 8 32VDC In Ground Function Tx Tx Rx Rx 422 Ground R...

Page 31: ...e has expired 3 If broadcast queries which require a response from multiple slaves must be sup ported the slaves should respond sequen tially or otherwise resolve the response traffic to avoid content...

Page 32: ...mental and Power Specifications Parameter Limits Standard Backlit Display usable temperature range 10 to 60 C Wide temperature Display usable temperature range 20 to 70 C Storage temperature all compo...

Page 33: ...CHART NUL blank SOH start of header STX start of text ETX end of text EOT end of transmission ENQ enquiry ACK acknowledge BEL bell BS backspace HT horizontal tab LF line feed VT vertical tab FF form f...

Page 34: ...24 QTERM R55 User s Manual QSI Corporation Fax 801 466 8792 Web www qsicorp com Phone 801 466 8770...

Page 35: ...56 possible character values Where a dot pattern is shown printing the corresponding code will cause the QTERM R55 to display the dot pattern at the current cursor location Numbers in circles refer to...

Page 36: ...466 8770 Least Significant Digit hex HT CR F E D C B A 9 8 6 7 5 LF LF LF BS Most Significant Digit hex 3 4 2 1 0 3 0 1 2 4 5 6 A 7 8 9 B C D F E 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

Page 37: ...e y power x string See Print Can be used in place of at Allows multiple commands to be placed on one line Placed after a print statement to prevent a carriage return and linefeed from being appended t...

Page 38: ...l be run if the condition is false end Marks the end of program execution endif Marks the end of an if statement eof Used to determine if the end of a file has been reached error Used in an on error s...

Page 39: ...not Returns the inverse of whatever is after it off Used in other commands to turn something off on Used in other commands to turn something on on x gosub Performs a gosub to the label in the variable...

Page 40: ...e serial port shift Used in a keydef statement to define a shifted key string shiftstate Sets the current state of the shift key shutdown Allows battery powered terminals to be turned off by software...

Page 41: ...If a file with a bin extension is entered the download type is automatically set to Firmware Upgrade If a file with a qbs or bas extension is selected the download type is automatically set to Applic...

Page 42: ...this intermediate file if the terminal reports that an application has errors By default the inter mediate file is R55 tmp qbs and is stored in the directory which contains the application file To cha...

Reviews: