The text of a manual · part 25 of 26
Videx BASIC for DuraTrax, LaserLite, LaserLite Pro, and LaserLite Mx Data Collectors, pages 241 to 250
Pages 241 to 250 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 241
'* '* process_cardcmd_error '* description: Look for an error with CARDCMD and report '* it. '* process_cardcmd_error: crderr% = ERR IF crderr% = 0 THEN 'no error ELSEIF crderr% = -1 THEN 'Time-out error, perhaps someone pulled out the card or the 'memory card was busy when CARDCMD tried to issue a command. 'Remember, pulling out the card freezes the memory card 'processor. It must be reset for it to restart. That's why 'it's best to go to sleep and let the system bring it back 'up when it wakes up. cls locate 0,0 print "No response from" print " memory card! "; gosub card_error_tone sleep 1 ELSEIF crderr% = -2 THEN goto evt_nomodule ELSEIF crderr% = -3 THEN goto evt_nocard ELSE cls locate 0,0 print " Cardcmd error " print " # ";str$(crderr%) ; gosub card_error_tone gosub kill_time running = false% ENDIF return '* '* '* '* '* '* won't_work description: With some errors it is best to put the unit to sleep, encourage the user to fix the problem, then restart the application.
won't_work: cls print " Press a key to" print " restart "; 'gosub kill_time sleep 10000 end goto beginning return
Appendix C Sample BASIC Programs
233
Page 242
'* '* '* '* '* '* '* '* evt_nomodule description: This event is set when the system starts and the monitor determines that there is no response from a memory card module. Since this application is designed to run with a memory card module, it should not be allowed to run when this event is encountered.
evt_nomodule: cls locate 0,0 print " No card module" print " detected "; gosub card_error_tone 'A -2 error is set by the system at start up 'if it determines there is no memory card module present. 'n_times% = 3 'gosub kill_time sleep 5000 end return '* '* '* '* '* '* '* '* '* evt_nocard description: This event is set when the system starts and the monitor determines that there is no memory card inserted. Since this application is designed to run with a memory card, it should not be allowed to run when this event is encountered. It calls a sleep routine to allow the user to insert a card and restart the application.
evt_nocard: cls locate 0,0 print " No card " print " inserted! "; gosub card_error_tone 'gosub kill_time sleep 2000 'After waking up from sleep, the system determined that 'there was no card inserted and set a global flag to 'indicate no card. The system must wake up from sleep with a 'memory card inserted to clear this flag. cls locate 0,0 print "Insert card then" print " press a key"; sleep 2000 sleep 10 return
234
Appendix C Sample BASIC Programs
Page 243
'* '* '* '* '* '* '* '* '* '* '* evt_badcard description: This event occurs when the system cannot recognize the card or the card won't boot. If the card isn't formatted, then the system sets a global flag to indicate card not recognized. A partially formatted card may not give the system any problem until the application attempts to send it a command. Then this routine may be called because of an error 05 indicating that the card software system did not boot.
evt_badcard: gosub card_error_tone IF error5% THEN n_times% = 1 cls locate 0,0 print " Card system " print " error! "; 'gosub kill_time sleep 2000 cls locate 0,0 print " Exiting to OS " print " "; 'gosub kill_time sleep 2000 running% = false% ELSE cls locate 0,0 print " Card not " print " recognized "; 'sleep 1 'gosub kill_time sleep 2000 cls locate 0,0 print " Reformat card " print " then retry "; 'sleep 1 'gosub kill_time sleep 2000 cls locate 0,0 print " running " print " application "; 'gosub kill_time sleep 3000 'sleep 1 running% = false% ENDIF return
Appendix C Sample BASIC Programs
235
Page 244
'* '* '* '* '* '* '* '* '* '* evt_card_interrupted description: Since the sleep routine saves the latest status from the memory card software system, it can then update the card on the next cardcmd issued after waking from sleep. If there is no valid status available, it indicates that an event (like a power failure) interrupted the process. In either case, the application is automatically restarted. This routine notifies user.
evt_card_interrupted: cls locate 0,0 print " Card update " print " interrupted "; n_times% = 1 gosub kill_time cls locate 0,0 print " Application " print " restarted "; n_times% = 2 goto beginning return '* '* '* '* '* '* '* evt_cardID description: Since the last time the OS ran, the card ID has changed. The OS automatically restarts the application and sets this event. This routine notifies user.
evt_cardID: cls locate 0,0 print "Card ID changed " print " "; n_times% = 1 gosub kill_time cls locate 0,0 print " Application " print " restarted "; n_times% = 1 gosub kill_time cls return
236
Appendix C Sample BASIC Programs
Page 245
Index A A (add record to memory card file) CARDCMD statement command, 34, 39 ABS function, 26 absolute value function, 26 add new record to memory card file, 34, 39 add record to memory card file (A) CARDCMD statement command, 34, 39 allocating storage space, 78–79 alphabetic characters, 3 ampersand (&) hexadecimal notation, 37, 38, 40 arithmetic operation, 19 arithmetic operators, 15 array, 12, 13, 78–79 dimension, 13 elements, 13 memory required, 13 record, 13 variable, 10, 12, 13 variable type, 13 ASC function, 27 ASCII code, 22, 27, 63–65 ASCII strings, 37 assign variable, 120–21 available RAM, 84–85
B backspace, 38 BASIC character set, 3 BASIC reserved words, 11, 193 BASIC statement, 5 battery voltage, 84–85 BEEP statement, 28 beeper, 28 BIN function, 29–31 bitwise comparisons, 21 bitwise complement, 20 bitwise conjunction, 20 bitwise disjunction, 20 bitwise operators, 15, 20, 21 AND, 20, 21 NOT, 20, 21 OR, 20, 21 boot file (B), 36, 52, 54 branch to specified line, 97–98 branch to subroutine, 139–40 branching, conditional, 102–4
C C (list card info) CARDCMD statement command, 34, 40–43 calculate CRC (Q) CARDCMD statement command, 35, 54 calculate CRC of memory card file, 35, 54 card ID, 51, 52 CARDCMD statement, 32–57 commands A (add record to memory card file) command, 34, 39 C (list card info) command, 34, 40–43 D (delete memory card file) command, 34, 44 F (search for record with key field) command, 35, 45, 46 H (delete record from memory card file) command, 35, 45, 46 K &1092 (remove deleted files) command, 35, 47 M (move pointer) command, 35, 48–50, 55 N (format card) command, 35, 51, 52 O (open memory card file) command, 35, 52–53 Q (calculate CRC) command, 35, 54 S (search for record) command, 35, 55 V (version number) command, 35, 56 Y (repeat) command, 35, 57
Index
237
Page 246
Z (sleep) command, 35, 57 global errors, 34 CARDSTATUS function, 33, 58–62 carriage return, 37, 38 case sensitive, 11 character set, 3 alphabetic character, 3 numeric character, 3 special character, 3 characters programmable display, 152 CHR$ function, 63–65 close cross-reference file, 66 close data file, 66 CLOSE statement, 66 CLS statement, 67 Codabar, 143 transmit start and stop character, 151 Code 128, 144 Code 3 of 9, 143 require checksum, 144 transmit checksum, 145 Code I 2of5 require checksum, 145 transmit checksum, 146 COMMCLOSE statement, 68 COMMINPUT statement, 69–70 COMMOPEN statement, 71 COMMPRINT statement, 72 comparison operators, 15, 19 equality, 19 greater than, 19 greater than or equal to, 19 inequality, 19 less than, 19 less than or equal to, 19 compiler program, 191, 192 DOS, 191, 192 Macintosh, 191, 192 Videx BASIC, 191, 192 Vxbasic.exe, 191, 192 Vxbasicw.exe, 191 Windows, 191 concatenation, 22 CONST statement, 73–75 constant name, 73 constant value, 10, 73–75
238
Index constants, 9, 74 literal, 9 symbolic, 10 convert hexadecimal digits, 29 convert integer to hexadecimal, 99–101 CRC checked, 37 cross-reference file, 36 close file, 66 field, 129 file type, 36 number of records, 123 open file, 141 search file, 132
D D (delete memory card file) CARDCMD statement command, 34, 44 data collector events, 109–13 data file, 36, 50 close file, 66 end of file, 86 file type, 36 length of file, 123, 126, 128 move pointer, 50 open file, 141 print, 157 read file, 107 return current file position, 162–63, 165 set position, 164 data types, 7 elementary, 7 numeric data, 7 string data, 7 DATE$ function, 76–77 declaration statement, 78–79 delete memory card file, 34, 44 delete memory card file (D) CARDCMD statement command, 34, 44 delete record from memory card file, 35, 45, 46 delete record from memory card file (H) CARDCMD statement command, 35, 45, 46 determine card ID, 51, 52
Page 247
determine memory card ID, 35 DIM statement, 13, 78–79 dimension array, 13 display, 67 display characters (programmable), 152 DMS (Data Management System), 38, 52, 56 DO...LOOP statement, 80–82 DuraTrax available RAM, 84–85 battery voltage, 84–85 ID, 84–85 system version, 84–85
E EAN, 148–50 allow supplement, 149 ignore supplement, 149 require supplement, 149 supplement, 150 transmit check character, 148 elementary data types, 7 numeric, 7 numeric data, 7 integer, 7 string data, 7 enable inkspread correction, 151 END statement, 83 end-of-file condition, 86–87 ENVIRON$ function, 84–85 environment options, 142, 143–54 return status, 142 set, 143–54 environment, hardware information, 84–85 EOF function, 86–87 ERR function, 88 escape character, 38 executable statement, 5 execute loop, 189–90 EXIT DO statement, 90 EXIT FOR statement, 89 exit loop, 89–90 EXIT statement, 89–90 EXIT WHILE statement, 89 expression, 15 numeric constant, 15 string constant, 15 variable, 15
F F (search for record with key field) CARDCMD statement command, 35, 45, 46 file management report, 34, 40–43 file types, 36 first-character timeout, 69 FOR...NEXT statement, 91–93 FOR statement, 91–93 FOR…NEXT loop, 91–93 nested loops, 93 NEXT statement, 91–93 format card (N) CARDCMD statement command, 35, 51, 52 format memory card, 35, 51
G GOSUB...RETURN statement, 94–96 GOSUB statement, 94–96 RETURN statement, 94–96 GOTO statement, 97–98
H H (delete record from memory card file) CARDCMD statement command, 35, 45, 46 hardware environment information, 84–85 hash table, 195 HEX$ function, 99–101 hexadecimal, 37, 40, 99–101
I iButtons. See Touch Memory buttons ID, 84–85 identification file (D), 52 identifier, 84–85 IF statement, 104 IF...ELSEIF..ELSE..ENDIF statement, 102–4
Index
239
Page 248
IF...THEN statement, 102–4 inclusive “or”, 20 indexed file (I/H), 38, 45, 52, 55, 196 INKEY$ function, 105–6 INPUT$ function, 107–8 INPUTEVT statement, 109–13 INSTR function, 114–15 integer, 7 integer numbers, 8 integer numeric constants, 9 integers, 8 negative, 8 intercharacter timeout, 69 Interleaved 2 of 5, 143
K K &1092 (remove deleted files) CARDCMD statement command, 35, 47 key scan, 105 scroll down, 105 scroll up, 105 key character, 37 keyboard character, 105–6 keypad entry, 109
L label, 4 LaserLite available RAM, 84–85 battery voltage, 84–85 ID, 84–85 system version, 84–85 LaserLite Mx, 195, 196 available RAM, 84–85 battery voltage, 84–85 ID, 84–85 memory card calculate CRC of file, 54 capabilities, 36 delete record from file, 45, 46 determine card ID, 51 file types boot file (B), 36 identification file (D), 36
240
Index indexed file (I/H), 36 sequential file (S), 36 format card, 51 move pointer, 48–50 open file, 52–53 read program version, 56 remove deleted files, 47 repeat command, 57 search for record, 55 search for record with key field, 45 sleep command, 57 system version, 84–85 LaserLite Pro available RAM, 84–85 battery voltage, 84–85 ID, 84–85 system version, 84–85 LCASE$ function, 116 LEFT$ function, 117–18 LEN function, 119 LET statement, 120–21 line identifiers, 4 line label, 4 list card info (C) CARDCMD statement command, 34, 40–43 list memory card file management report, 34, 40–43 list memory card status information, 34, 40–43 literal constants, 9 numeric, 9 string, 9 LOCATE statement, 122 LOF function, 123–25 LOF statement, 126–27 LOFH function, 128 LOOK$ function, 129–31 LOOKUP function, 132–33 loop, 89, 91–93, 189–90 loops, 93 nested, 93 lowercase, 116 LTRIM$ function, 134–35
Page 249
M M (move pointer) CARDCMD statement command, 35, 48–50, 55 memory, 14, 84–85 memory card add new record to file, 34, 35, 39 boot file (B), 36 calculate CRC of file, 54 delete file, 34, 35, 44 delete record from file, 35, 45, 46 determine card ID, 35, 51, 52 file management report, 34, 35, 40– 43 file types, 36 format card, 35, 51 identification file (D), 36, 52 indexed file, 45, 53 indexed file (I/H), 36, 45, 52, 55 move pointer, 48–50 move pointer in file, 35 open file, 35, 52–53, 52–53 perform search in file, 35 program version, 56 read program version, 35 remove deleted files, 35, 47 repeat last status byte or data, 35 search for record, 55 search for record in file, 35 sequential file (S), 36 sleep command, 57 status information, 34, 35, 40–43 MID$ function, 136–37 MID$ statement, 138 MOD modulus operator, 18 modulo arithmetic, 18 modulus, 52, 53, 195 move pointer (M) CARDCMD statement command, 35, 48–50, 55 move pointer in memory card file, 35, 48–50, 55
N N (format card) CARDCMD statement command, 35, 51, 52 name variable, 78–79 negative integers, 8 nested loops, 93 nonexecutable statement, 5 null character, 7 numeric characters, 3 numeric constants, 9 integer, 9 numeric data, 7 integer, 7 numeric variable, 10
O O (open memory card file) CARDCMD statement command, 35, 52–53 ON…GOSUB statement, 139–40 ON…GOTO statement, 139–40 open file, 141–42 open memory card file, 35, 52 open memory card file (O) CARDCMD statement command, 35, 52–53 open memory card ID file, 52–53 OPEN statement, 141–42 operating system version, 84–85 operations order of, 16 operators, 15 arithmetic, 15 functional, 15 logical, 15 relational, 15 string, 15 OPTION function, 142 OPTION statement, 143–54 options, 142, 143–54 Codabar, 143 transmit start and stop character, 151 Code 128, 144 Code 3 of 9, 143 require checksum, 144 transmit checksum, 145 Code I 2of5 require checksum, 145 transmit checksum, 146 EAN, 148–50 allow supplement, 149
Index
241
Page 250
ignore supplement, 149 require supplement, 149 supplement, 150 transmit check character, 148 enable inkspread correction, 151 expand UPC-E to UPC-A, 146 Interleaved 2 of 5, 143 longest bar code accepted, 152 minimum quiet zone, 151 report UPC as EAN, 148 return status, 142 set, 143–54 shortest bar code accepted, 152 UPC, 146–50 allow supplement, 149 ignore supplement, 149 require supplement, 149 supplement, 150 transmit check character, 146 transmit country code, 147 transmit number system character, 147 UPC/EAN, 143 order of operations, 16
P PATTERN function, 155–56 pause program, 169–70 perform a loop, 91–93 perform search in memory card file, 35, 55 print data, 157–58 PRINT statement, 157–58 program line, 4 program remarks, 159 program version, 35 programmable display characters, 152
Q Q (calculate CRC) CARDCMD statement command, 35, 54
R read button, 180–84
242
Index read memory card program version, 35, 56 REM statement, 5, 159 remove deleted files (K &1092) CARDCMD statement command, 35, 47 remove deleted files from memory card, 35, 47 repeat (Y) CARDCMD statement command, 35, 57 repeat a block of statements, 80–82 repeat last status byte or data, 35, 57 reserved words, 11 return a substring, 136–37 return current file position, 162–63, 165–66 return current time, 175–77 return data from cross-reference file, 129–31 return error condition, 88 return length of a file, 128 return length of file, 123–25 return numeric value, 187–88 return status of environment option, 142 return string in uppercase, 186 return string of characters, 107–8 return string without leading spaces, 134–35 return token from data file, 178–79 RIGHT$ function, 160 RTRIM$ function, 161
S S (search for record) CARDCMD statement command, 35, 55 scan key, 105 scanpad entry, 109 scroll down key, 105 scroll up key, 105 search cross-reference file, 132–33 search for record (S) CARDCMD statement command, 35, 55 search for record in memory card file, 35, 45