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 23 of 26

Videx BASIC for DuraTrax, LaserLite, LaserLite Pro, and LaserLite Mx Data Collectors, pages 221 to 230

Pages 221 to 230 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 221

sleep 1000 endif return '* '* '* '* '* '* '* fn_exit description: Respond to an exit event. Exit events are generated when an unlock command is sent during an INPUTEVT statement. The typical response is to end the BASIC program, returning to the command line.

fn_exit: running% = false% return

Appendix C Sample BASIC Programs

213

Page 222

'* '* fn_up '* description: Respond to a scroll-up event. These events '* are generated when the scroll-up key is pressed. '* fn_up: sound 1397, 10

'click so user knows we got the key if (mode% = mode_bottom%) OR (mode% = mode_down%) then 'if we have been scrolling down or we're at the 'bottom already, then fetch the last record. cardcmd M gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error mode% = mode_norm% else cardcmd M, 1, R 'otherwise move back one record gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error endif if cardresult% = 37 then display$ = " -TOP OF DATA-" mode% = mode_top%

'top of file elseif cardresult% = 23 then display$ = "-DATA FILE EMPTY" mode% = mode_top%

'no data else display$ = cardreturn$ mode% = mode_up% endif

'otherwise get the record

'prepare for shift left and right full_display$ = display$ shift% = 0 return

214

Appendix C Sample BASIC Programs

Page 223

'* '* '* '* '* '* fn_down description: Respond to a scroll-down event. These events are generated when the scroll-down key is pressed.

fn_down: sound 1397, 10

'click so the user knows we got the key if (mode% = mode_top%) then

'we are at top of file 'so don't move pointer cardcmd M gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error 'get the next line (if not at the top of the file) else cardcmd M, 1, F gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error endif if cardresult% = 36 then gosub scroll_info 'if at end of file, display system info mode = mode_bottom% elseif cardresult% = 23 then gosub scroll_info mode = mode_bottom% else display$ = cardreturn$ mode% = mode_dn% endif full_display$ = display$ 'initialize for scroll right & left shift% = 0 return

Appendix C Sample BASIC Programs

215

Page 224

'* '* fn_left '* description: Scroll left key was pressed (LaserLite '* Pro/MX). Scroll to the left to display a long entry. '* fn_left: sound 1397, 10 'click so the user knows we got the key 'check if we have scrolled all the way off of 'the display otherwise, increment position if shift% < len (full_display$) then shift% = shift% + 1 endif 'build display one character at a time display$ = "" for foo% = 1 to 16 if len (full_display$) >= (foo% + shift%) then display$ = display$ + mid$(full_display$, foo% + shift%, 1) endif next foo% return '* '* fn_right '* description: Scroll right key was pressed (LaserLite '* Pro/MX). Scroll to the right to display a long entry. '* fn_right: sound 1397, 10 'click so the user knows we got the key 'check if we have scrolled all the way back 'to the beginning of the display otherwise 'decrement position if shift% > 0 then shift% = shift% - 1 endif display$ = "" 'build display one character at a time for foo% = 1 to 16 if len (full_display$) >= (foo% + shift%) then display$ = display$ + mid$(full_display$, foo%+shift%, 1) endif next foo% return

216

Appendix C Sample BASIC Programs

Page 225

'* '* '* '* '* '* '* fn_power description: Respond to a power event. These events are generated when the power switch is moved to the off position. Respond by setting the hardware to a low-power state.

fn_power: 'option(256) = 0 sleep 0 'option(256) = 1 return

'turn off the LCD 'sleep indefinitely 'turn the LCD back on

'* '* file_error '* description: There was an error opening or writing to a '* file. Alert the user. '* file_error: gosub ring cls print "Error accessing " print "data file!" sleep 10 return

'* '* evt_esc '* description: Escape key was pressed (LaserLite Pro/Mx). '* evt_esc: sound 1397, 10 'click so user knows we got the key cls print "Escape key" print "was pressed."; 'n_times% = 1 'gosub kill_time sleep 1000 return

Appendix C Sample BASIC Programs

217

Page 226

'* '* evt_mem '* description: Memory key was pressed (LaserLite Pro/Mx). '* Display remaining available RAM. '* evt_mem: sound 1397, 10

'click so user knows we got the key retry_mem: cardcmd C, F gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error card_space$ = mid$ (cardreturn$, 10, 4) 'avail space (hex) total_files$ = mid$ (cardreturn$, 14, 2) '# of files (hex) foo% = bin (card_space$, 4) card_space$ = str$ (foo%)

'convert hex to integer 'convert integer to string foo% = bin (total_files$, 2) total_files$ = str$ (foo%) cls print total_files$; " files on card" 'display available print card_space$; "K available"; 'space on card 'n_times% = 3 'gosub kill_time sleep 3000 return '* '* evt_bat '* description: Battery key was pressed (LaserLite Pro/Mx). '* Display battery voltage. '* evt_bat: sound 1397, 10 'click so user knows we got the key cls print environ$(0); " volts"; sleep 3000 return

218

Appendix C Sample BASIC Programs

Page 227

'* '* evt_f1 '* description: F1 key was pressed (LaserLite Pro/Mx). '* evt_f1: 'sound 1397, 10 cls gosub rwloop return

'click so user knows we got the key

'* '* evt_f2 '* description: Gets the system restarted. '* evt_f2: sound 1397, 10 'click cls print "Updating card..." just_open:

'This routine opens the data file for 'appending user input cardcmd O, 2203, I, "data.txt" gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error cardcmd C, S 'makes sure that we know this is the 'file to use for user input gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error chandle$ = mid$(cardreturn$,14,2) dhandle$ = chandle$ return

Appendix C Sample BASIC Programs

219

Page 228

'* '* '* '* '* '* '* '* '* evt_f3 description: This is a routine for searching records written to the numbers file. It presents an input field into which the user may key in up to a five character number. Then the program searches for that number. It is a demonstration of lookup for records written on the fly.

evt_f3: sound 1397, 10 'click so user knows we got the key cls locate 0,0 print "Opening file on" print "card."; gosub questiontone cardcmd O, 2203, I, "rwloop2.txt" 'This is numbers database gosub process_cardcmd_error IF crderr% THEN return cardresult% = cardstatus(cardreturn$) gosub process_card_error cardcmd C, S gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) gosub process_card_error chandle$ = mid$(cardreturn$,14,2) 'Record current file handle seekprompt$ = "Number to seek" 'Set up prompt for the user looping% = true% 'Set up an inputevt loop cls while looping% gosub check_voltage 'check battery voltage cls print seekprompt$; NL$; "-> "; 'display a prompt inputevt 4, 1, 10, 2, type%, symbol%, device%, data$ 'get an event on type% gosub fn_null, fn_seek, fn_quitseek,| fn_quitseek, fn_quitseek, fn_quitseek, fn_power,| evt_pfail, fn_quitseek, fn_null, evt_nomodule,| evt_nocard, evt_badcard, evt_cardID,| evt_card_interrupted, fn_null, fn_null, fn_null,| fn_left, fn_right, evt_mem, evt_bat, fn_quitseek,| fn_quitseek, fn_quitseek, fn_quitseek, fn_quitseek 'process the event 'Some keys will quit the function. Only the 'Enter key with data will perform the seek. wend gosub deletetone 'exit tone return

220

Appendix C Sample BASIC Programs

Page 229

'* '* fn_seek '* description: Demo for lookup in the numbers file. '* fn_seek: cardcmd F, data$ gosub process_cardcmd_error cardresult% = cardstatus(cardreturn$) IF cardresult% = 0 THEN sound 1397, 10 rtime$ = mid$(cardreturn$,instr(cardreturn$,| chr$(09))+1,8) rdate$ = right$(cardreturn$,5) num$ = left$(cardreturn$,instr(cardreturn$,chr$(09))-1) cls locate 0,0 print "Found! "; num$ print rdate$; " @ "; rtime$; device% = 0 while device% <> 1 inputevt 0,0,0,0, type%, symbology%, device%, data$ wend sound 1397, 10 ELSEIF cardresult% = 35 THEN sound 698, 700 cls locate 0,0 print data$; " not in file..." device% = 0 while device% <> 1 inputevt 0,0,0,0, type%, symbology%, device%, data$ wend sound 1397, 10 ELSE gosub process_card_error looping% = false% ENDIF return

Appendix C Sample BASIC Programs

221

Page 230

'* '* fn_quitseek '* description: Get out of the seek loop. '* fn_quitseek: looping = false% return '* '* evt_f4 '* description: F4 key was pressed (LaserLite Pro/Mx). '* Display operating system. '* evt_f4: ' optnum = 255 ' optval = 0 ' do ' sound 1397, 10 'click so user knows we got the key ' cls ' print "option("; optnum ;")=";optval ' print "new #: "; ' inputevt 8,1,11,2,opt_type,opt_sym,opt_dev,opt_data$ ' if opt_type = 1 then ' optnum = val(opt_data$) ' optval = option(optnum) ' endif ' if optnum = 0 then ' print opt_type, opt_data$ ' gosub kill_time ' endif ' loop while opt_type = 1 'bar$ = environ$(2)+ " " + left$(environ$(4),5) + " " +| right$(environ$(4),5) if vertoggle = 0 then bar$ = environ$(2) vertoggle = 1 else bar$ = environ$(4) vertoggle = 0 endif cls print left$ (bar$, 16) if len(bar$) > 16 then print right$ (bar$, len(bar$)-16); 'print right$ (bar$,16); endif 'n_times% = 2 'gosub kill_time sleep 2000 return

222

Appendix C Sample BASIC Programs