Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 8 of 26

Videx BASIC for DuraTrax, LaserLite, LaserLite Pro, and LaserLite Mx Data Collectors, pages 71 to 80

Pages 71 to 80 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 71

CHR$ Function • Action Returns a one-character string whose ASCII code is the argument. • Syntax result$ = CHR$ ( code% ) • Parameters Argument code%

Description ASCII code (0–255) of character.

• Remarks CHR$ is commonly used to send a special character to the display. The tables on the following two pages list most of the display characters and their ASCII code. There are other characters the LCD can display; feel free to experiment. If you enter a character that the LCD cannot interpret, it is displayed as a blank. See also OPTION statement (options 512–575) and ASC. The ASC function complements CHR$. • Returns The character that the ASCII code represents.

Chapter 4 Statement & Function Reference

63

Page 72

• Example This routine shows how CHR$ can be used to include a double quote (") in a string. REM CHR$() Function REM This routine uses CHR$ to include a double quote (") REM in a string. Dim quote$ CLS quote$ = CHR$ (34) PRINT "This is a :" PRINT quote$; "Quoted String"; quote$; SLEEP 0

Output: This is a :"Quoted String"

Table of Display Characters and Corresponding ASCII Codes Character

ASCII

Line feed Carriage return Space ! " # $ % & ’ ( ) * +

10 13 32 33 34 35 36 37 38 39 40 41 42 43

Character , . / 0 1 2 3 4 5 6 7 8 9

ASCII

Character

44 45 46 47 48 49 50 51 52 53 54 55 56 57

: ; < = > ? @ A B C D E F G

ASCII 58 59 60 61 62 63 64 65 66 67 68 69 70 71

Table of Display Characters and Corresponding ASCII Codes continued on next page

64

Chapter 4 Statement & Function Reference

Page 73

Character

ASCII

H

72

I

73

J

74

K

75

L

76

M

77

N

78

O

79

P

80

Q R S T U V W X Y Z [ ¥ ] ^ _ ` a

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97

Character b c d e f g h i j k l m n o p q r s t u v w x y z {

ASCII 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123

Character

ASCII

| } → ← α ä β ε µ σ ρ ¢ £ ñ ö θ ∞ Ω ü Σ π X ÷ █

124 125 126 127 224 225 226 227 228 229 230 236 237 238 239 242 243 244 245 246 247 248 253 255

Table of Display Characters and Corresponding ASCII Codes (Note: ASCII codes 0–7 provide access to eight user-definable characters (1–8). ASCII codes 16–32, 128–160, and 254 are blank spaces. ASCII codes 161–223 and 250–252 are Japanese characters. For a complete list of the display characters, contact the Videx Technical Support Department.)

Chapter 4 Statement & Function Reference

65

Page 74

CLOSE Statement • Action Closes the numbered file. • Syntax CLOSE [ [ # ] filenumber% { , [ # ] filenumber% } ] • Parameters Argument filenumber%

Description The file number used in the OPEN statement.

• Remarks A CLOSE statement with no arguments closes all open files. All files can also be closed with an END statement. See also OPEN, SEEK, and PRINT. • Example REM CLOSE Statement DIM myFile$, i% CLS myFile$ = "data.txt" OPEN myFile$ FOR APPEND as #0 FOR i% = 1 to 10 'write 10 lines with two tab 'delimited fields to the file PRINT #0, "LINE "; STR$(i%), "VIDEX DURATRAX" NEXT i% CLOSE #0 PRINT "Saved data to:" PRINT myFile$; SLEEP 0

66

Chapter 4 Statement & Function Reference

Page 75

CLS Statement • Action Clears the display. • Syntax CLS • Parameters None • Remarks After clearing the display, the cursor is placed in the top left corner (location 0,0). It is not necessary to begin your program with a CLS statement, as the screen clears and the cursor is set to 0,0 when the program is executed. See also LOCATE. • Example REM CLS Statement NL$ = CHR$(13) + CHR$(10) CLS PRINT "CLS"; NL$; "Clears screen"; SLEEP 0 CLS SLEEP 0 PRINT "See!" SLEEP 0

Output: CLS Clears screen See!

Chapter 4 Statement & Function Reference

67

Page 76

COMMCLOSE Statement • Action Closes the currently open serial port. (Videx BASIC) • Syntax COMMCLOSE • Parameters None • Remarks In the current operating system release, the serial port is always open at 9600 baud. The COMMOPEN and the COMMCLOSE statements are ignored by the current operating system. See also COMMOPEN, COMMPRINT, and COMMINPUT. • Example REM COMMCLOSE Statement DIM someData$ someData$ = "This is some data" CLS PRINT "Press scan button" PRINT "when ready."; SLEEP 0 COMMOPEN 1,96,8,N,1 COMMPRINT someData$ COMMCLOSE CLS PRINT "Sent data out" PRINT "the serial port!"; SLEEP 0

See also the COMMINPUT example.

68

Chapter 4 Statement & Function Reference

Page 77

COMMINPUT Statement • Action Gets a string from the currently open serial port and places the result in the named stringvariable$. (Videx BASIC) • Syntax COMMINPUT stringvariable$ [, timeout1% [, timeout2% ] ] • Parameters Argument stringvariable$ timeout1% timeout2%

Description This is where the string is placed that was taken from the currently open serial port. The length of time to wait in milliseconds (ms) after the previous character is received before returning. The length of time to wait (ms) for the first character before returning.

• Remarks COMMINPUT returns when either stringvariable$ is full or a timeout is reached. The first timeout (timeout1%) is an intercharacter timeout (in ms). If a character is not received in the specified number of ms after the previous character was received, then COMMINPUT concludes that there are no more characters of input and returns immediately. The default for this value is zero. The second timeout (timeout2%) is a first-character timeout (in ms). If the first character is not received in the specified number of ms after COMMINPUT is executed, then COMMINPUT concludes that there are no characters of input and returns immediately. The default for this value is the intercharacter timeout (timeout1%).

Chapter 4 Statement & Function Reference

69

Page 78

In most cases an array element can be used anywhere a variable can. COMMINPUT is one exception. The first argument cannot be an array element. See also COMMCLOSE, COMMOPEN, and COMMPRINT. • Example REM COMMINPUT Statement DIM accumData$ * 40,nowData$ CLS PRINT "Press scan button" PRINT "when ready."; SLEEP 0 CLS PRINT " TERMINAL " PRINT " EMULATION "; COMMOPEN 1,96,8,N,1 COMMPRINT "Waiting for you" SLEEP 0 CLS accumData$ = "" DO nowData$ = "" COMMINPUT nowData$,5,10 IF nowData$ <> "" THEN IF ASC(nowData$) = 27 THEN EXIT DO ELSE PRINT nowData$; accumData$ = accumData$ + nowData$ IF LEN(accumData$) = 16 THEN LOCATE 1,0 ELSEIF LEN(accumData$) > 32 THEN CLS accumData$ = "" ENDIF ENDIF ENDIF LOOP COMMCLOSE CLS

70

Chapter 4 Statement & Function Reference

Page 79

COMMOPEN Statement • Action Opens a serial port with the specified settings. (Videx BASIC) • Syntax COMMOPEN port%, baud%, databits%, parity$, stopbit% • Parameters Argument port% baud% databits% parity$ stopbit%

Description The serial port to open (use 1 for port 1). Sets the baud rate (use 96 for 9600 baud). Sets the databits (use 8 for 8 databits). Sets the parity (use N for none). Sets the stop bit (use 1).

• Remarks Errors can be tested with the ERR function. In the current operating system release, the serial port is always open at 9600 baud. The COMMOPEN and COMMCLOSE statements are ignored by the current operating system. See also COMMINPUT, COMMPRINT, and COMMCLOSE. • Example See the COMMINPUT example. All of the arguments must be exactly as shown in the example (COMMOPEN 1, 96, 8, N, 1). That is, port 1, baud 9600, 8 data bits, no parity, and 1 stop bit. The arguments are actually ignored, but the recommended arguments should be used to allow for future expansion.

Chapter 4 Statement & Function Reference

71

Page 80

COMMPRINT Statement • Action Sends characters out the serial port. • Syntax The term expression includes both expression% and expression$. COMMPRINT [expression] { ( , | ; ) [expression] } • Parameters Argument expression

Description The characters (integer (expression%) or string (expression$)) to be printed.

• Remarks The COMMPRINT statement normally sends a carriage-return/linefeed pair at the end of the line. You can suppress this behavior by ending the COMMPRINT statement with a comma or semicolon. A comma sends a tab character. A semicolon separates arguments without sending anything out the port. An error will occur if the statement contains two expressions in a row without a separator (however, it is acceptable to have two separators in a row). See also COMMINPUT, COMMOPEN, and COMMCLOSE. • Example See the COMMINPUT example.

72

Chapter 4 Statement & Function Reference