The text of a manual · part 17 of 26
Videx BASIC for DuraTrax, LaserLite, LaserLite Pro, and LaserLite Mx Data Collectors, pages 161 to 170
Pages 161 to 170 of 252
The original document is the PDF (765 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Videx DuraTrax, Videx LaserLite, Videx LaserLite Mx and Videx LaserLite Pro
Page 161
Use options 512–519 to create character 0. Use options 520–527 to create character 1. Use options 528–535 to create character 2. Use options 536–543 to create character 3. Use options 544–551 to create character 4. Use options 552–559 to create character 5. Use options 560–567 to create character 6. Use options 568–575 to create character 7. (Note: Application Builder uses character 7.) In this example, we will create a character for character 1, using options 520–527. The first step is to design your character on a grid similar to the one shown in the following diagram. Once you design the character, you then define each option line used. To define each option line, add the values (listed at the top) for the black pixels. For example, line 520 in the diagram below, has a black pixel at the 4 value; this line is defined as: Option (520) = 4. Line 521 has a black pixel at the 8 and the 2 values. Add the values together and this line is defined as: Option (521) = 10. The character lines in this diagram would be defined as: 16 8 520 521 522 523 524
4
2
1 Option (520) = 4 Option (521) = 10 Option (522) = 10 Option (523) = 21 Option (524) = 17 Option (525) = 10 Option (526) = 10 Option (527) = 4
525 526 527
The programmable display character options do not take effect until the screen is turned off and back on, i.e. Option (256) = 0 Option (256) = 1
Chapter 4 Statement & Function Reference
153
Page 162
• Example REM OPTION Statement 'Repeats the good read sound and flashes the LED 6 times. PRINT "GOOD READ" PRINT "SEQUENCE"; FOR i = 1 TO 6 OPTION( 258) = 1 'turn on the LED SOUND 1446, 250 'good beep OPTION( 258) = 0 'turn off the LED GOSUB killTime NEXT i END killTime: 'just a short delay for demo purposes only FOR r = 1 TO 200 NEXT r RETURN
154
Chapter 4 Statement & Function Reference
Page 163
PATTERN Function • Action Determines whether the second string matches the TimeWand II-style pattern in the first string. • Syntax matchPat% = PATTERN ( stringexpression1$, stringexpression2$ ) • Parameters Argument stringexpression1$ stringexpression2$
Description String to match (TimeWand II-style pattern). String being compared.
• Remarks When specifying a TimeWand II-style pattern, five characters are used as wild cards to create the pattern. These characters are: # @ & = >
A number [0-9] must be in this position. A letter [a..z, A..Z] must be in this position. Any character can be in this position. The rest of the string can be any characters or no character. The rest of the string must be numbers [0..9] or no character.
These are the actual characters your bar codes may contain: A..Z
0..9 space
+
-
/
%
.
Chapter 4 Statement & Function Reference
$
155
Page 164
Following are examples of TimeWand II-style patterns: Pattern E= E> E0003 #> AAA= AA#A AA@A AA&A
Acceptable Entries Any entry that starts with the letter E. Any entry that starts with the letter E and is followed only by numeric digits. Entry must match E0003 exactly. At least one digit followed by any number of digits. Any entry that begins with AAA. A four character long entry, with A in the first, second, and fourth positions; and a number in the third position. Same as previous entry, but with a letter in the third position. Same as previous entry, but with any character in the third position.
• Returns If stringexpression2$ matches the TimeWand II-style pattern in stringexpression1$, PATTERN returns a -1; otherwise, it returns 0. • Example REM PATTERN() Function 'checks two strings against pattern data1$ = "555-AB-1234" 'great tool for restricting input data2$ = "555-55-1234" matchPat$ = "###-##-####" PRINT matchPat$ PRINT data1$; c% = PATTERN(matchPat$,data1$) GOSUB show_result PRINT matchPat$ PRINT data2$; c% = PATTERN(matchPat$,data2$) GOSUB show_result END show_result: SLEEP 2 'pause display for 2 seconds or until keypress CLS PRINT "PATTERN IS.." IF c% = 0 THEN PRINT "DIFFERENT"; ELSE PRINT "THE SAME"; ENDIF SLEEP 0 'pause display until keypress CLS RETURN
156
Chapter 4 Statement & Function Reference
Page 165
PRINT Statement • Action Outputs data to the screen or to a file. • Syntax The term expression includes both expression% and expression$. ( PRINT | ? ) [ # filenumber%, ] [expression] {( , | ; ) [expression]} • Parameters Arguments filenumber% expression
Description The file number used in the OPEN statement. The string or integer expression to be printed.
• Remarks The PRINT statement normally prints a carriage-return/line-feed pair at the end of the line. You can suppress this behavior by ending the PRINT statement with a comma or semicolon. A comma moves the current pen location to the next tab stop. A semicolon leaves the pen at its current location. An error occurs if the statement contains two expressions in a row without a separator (however, it is acceptable to have two separators in a row). If a file number is specified, the data is printed to the previously OPENed data file rather than to the screen. In that case, the error condition may be set. You should always check the error condition when writing to the data file to minimize data loss. The error condition should also be checked after any PRINT statement that uses a concatenation symbol (+) to combine strings. See also LOCATE and OPEN.
Chapter 4 Statement & Function Reference
157
Page 166
The PRINT statement is used to print to a file in RAM. See the CARDCMD statement to write to files on the LaserLite Mx memory card. The data collector’s LCD can display the following characters: !
"
#
$
%
&
'
(
)
*
+
,
-
.
/
@
:
;
<
>
=
?
{
}
|
0
1
2
3
4
5
6
7
8
9
A a
ä
B b
C c
D d
E e
F f
G g
H h
I
I
J j
K k
L l
M m
N n
ñ
O o
ö
P p
Q q
R r
S s
T t
U u
ü
V v
W w
X x
Y y
Z z
Ω
µ
∑
π
¢
°
£
• Example REM PRINT Statement '* Prints to a file and to the screen. myFile$ = "data.txt" PRINT "Now printing..." PRINT "Please wait"; OPEN myFile$ FOR APPEND AS #0 'this is output file FOR i% = 1 TO 1000 'send the data$ contents 1000 times LOCATE 1,0 data$ = "Line number " + ;i PRINT data$; 'data$ goes to second line of display PRINT #0, data$ 'data$ is appended to a file NEXT i% CLOSE #0 CLS PRINT "Done" SLEEP 3 'pause display for 3 seconds
158
Chapter 4 Statement & Function Reference
Page 167
REM Statement • Action Allows explanatory remarks to be inserted in a program. • Syntax ( REM | ' ) { anything } • Parameters Argument anything
Description This can be any combination of letters, numbers, symbols, etc.
• Remarks The compiler ignores everything from REM to the end of the line. REM can appear at the end of any line, including a line that has other BASIC statements. You may branch from a GOTO or GOSUB statement to a REM statement. Execution continues with the first executable statement after the REM statement. • Example 'REM Statement note that you may use REM or ' to remark a line DIM myArray(23) FOR I = 0 TO 22 : myArray(I) = 0 : NEXT I REM Initialize array FOR I = 0 TO 22 : myArray(I) = 0 : NEXT I 'Initialize array
Chapter 4 Statement & Function Reference
159
Page 168
RIGHT$ Function • Action Returns a string that is composed of the rightmost characters in the string argument. • Syntax data$ = RIGHT$ ( stringexpression$, n% ) • Parameters Argument stringexpression$ n%
Description Any string variable, string constant, or string expression. A numeric expression (range 0–32767) indicating how many characters are to be returned.
• Remarks See also LEFT$, LEN, and MID$. • Returns If n% is greater than the number of characters in stringexpression$, the entire string is returned. To find the number of characters in stringexpression%, use the LEN function. If the integer argument is zero, a null string (length zero) is returned. • Example See the LEFT$ example.
160
Chapter 4 Statement & Function Reference
Page 169
RTRIM$ Function • Action Returns a copy of a string with trailing (right-hand) spaces removed. • Syntax data$ = RTRIM$ ( stringexpression$ ) • Parameters Argument stringexpression$
Description Any string expression.
• Remarks See also LTRIM$. • Returns Copy of string with no trailing spaces. • Example See the LTRIM$ example.
Chapter 4 Statement & Function Reference
161
Page 170
SEEK Function • Action Returns the current file position. • Syntax cfp% = SEEK ( filenumber% ) • Parameters Argument filenumber%
Description The file number used in the OPEN statement.
• Remarks See also EOF, OPEN, SEEK statement, and SEEKH. The SEEK function is used to work with a file in RAM. See the CARDCMD statement to work with files on the LaserLite Mx memory card. • Returns The byte position in the file where the next operation is to take place. The first byte in a file is 0. For sequential (data) files, returns the current file position (from the beginning of the file) MOD 32768.
162
Chapter 4 Statement & Function Reference