The text of a manual · part 7 of 26
Videx BASIC for DuraTrax, LaserLite, LaserLite Pro, and LaserLite Mx Data Collectors, pages 61 to 70
Pages 61 to 70 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 61
Example 2: Open the ID file with the filename Videx: Cardcmd O, D, "Videx" Returns: &01 "092612456"
ID file created successfully, with ‘Videx’ as the card ID and assigned to file handle 01. ID file could not be created because an ID file already exists with ‘092612456’ as the real card ID.
Successful return values: File handle number or card ID name. Possible error codes that can be returned from this command: 01, 03, 04, 07, 10, 31, 33, 39, 40, 51, 52, 63 (See pages 59–60 for a description of the error codes.)
Chapter 4 Statement & Function Reference
53
Page 62
CARDCMD Statement Commands – continued
Q, {file type}, {filename} Calculates the CRC of a file and sends it back to the host. This command is useful when sending a file to the memory card from the computer. The Vxcom and Download communications programs automatically call this command when sending files to the memory card. Example: Check the CRC of a boot file: CARDCMD Q, B, "CPU" Returns: &B001
The 16-bit CRC of the boot file (boot files on the LaserLite Mx system must always return a CRC of &B001).
Successful return values: 16 bit CRC of the file. Possible error codes that can be returned from this command: 01, 03, 04, 10, 31, 32, 51, 52, 63 (See pages 59–60 for a description of the error codes.)
54
Chapter 4 Statement & Function Reference
Page 63
S, {field number/bytes}, {F/R}, {string} Performs a search within the memory card’s open file. For an indexed file (I/H), this command searches for a record with the given string within the given number of records. The field number limits the search at the particular field. A zero field number forces the program to search through the entire field for the given string. The key field is the number one field. The field number is the fourth byte of the first parameter and the number of records that were searched is given as the three least significant bytes of the first parameter. For a binary file, this command searches through the number of bytes trying to match the given string. With no parameter, it reads the last record or 256 bytes found. This command uses the same pointer as the M command. Since this command does not use indexing, there may be some noticeable delay when using this command to search through large amounts of data. Example: Search the open file for a record in field two with the pattern “abcdefg” within the next 129838 records from the current move pointer: CARDCMD S, &0201FB2E, F, "abcdefg" Returns: "abcdefghijklmnop"
Record found.
Successful return values: A record or 256 bytes of binary data containing the search string. Possible error codes that can be returned from this command: 01, 03, 04, 10, 23, 35, 36, 37, 39, 40, 63, 65 (See pages 59–60 for a description of the error codes.)
Chapter 4 Statement & Function Reference
55
Page 64
CARDCMD Statement Commands – continued
V Reads the memory card’s program version. The version is sent out in ASCII format. The version number for the DMS is: VTDMSx.xx The version number of the firmware is: VTMCFx.xx Example: Read the DMS version: CARDCMD V Returns: "VTDMS1.02"
The DMS version.
Successful return values: Version number of the DMS or firmware. Possible error codes that can be returned from this command: 03, 04, 10 (See pages 59–60 for a description of the error codes.)
56
Chapter 4 Statement & Function Reference
Page 65
Y Repeats the data sent by the memory card processor. Example: If the last command was the V example previously described: CARDCMD Y Returns: The DMS version.
VTDMS1.02 Successful return values: Last data.
Possible error codes that can be returned from this command: 03, 04, 10 (See pages 59–60 for a description of the error codes.)
Z Puts the memory card processor in sleep mode. Example: Put the memory card processor to sleep: CARDCMD Z Returns: 00
LaserLite Mx memory card processor is in sleep mode.
Successful return values: 00
(Memory card processor in sleep mode)
Possible error codes that can be returned from this command: 03, 04, 10 (See pages 59–60 for a description of the error codes.) Chapter 4 Statement & Function Reference
57
Page 66
CARDSTATUS Function (for LaserLite Mx only) • Action Retrieves the response from the memory card processor after it is given a command. (Videx BASIC) (Note: This function is not supported by the Macintosh version of the Videx BASIC compiler.) • Syntax result% = CARDSTATUS ( BUFFER_VAR$ ) • Parameters Argument BUFFER_VAR$
Description String variable that receives a data component (if there is any) of the memory card processor response. Do not use a string constant or array variable element. The dimensioned size of the string variable must be able to hold any data response that might result from the command given. If it is too small, the data is truncated.
• Remarks If the data is in the form of a single-quoted ASCII field, the enclosing single quotes are removed and any embedded single quotes are interpreted. Hexadecimal fields are passed along unchanged; that is, the return string contains the hexadecimal digits with the initial ampersand (&) marker and terminating marker (if it is not a carriage return). Whenever the CARDCMD statement is executed, the values returned by this function are cleared even if they have not been retrieved. See also CARDCMD and BIN. • Returns If the operation is successful, CARDSTATUS returns zero and the data returned by the memory card processor is placed in BUFFER_VAR$. If an error is detected by the operating system, CARDSTATUS returns a negative number. If the memory card processor times out, the function returns -1. If there is no memory card module, the function returns -2. If a memory card was not installed in the card module at last startup from sleep, the function returns -3. See the following table for information on other error values. 58
Chapter 4 Statement & Function Reference
Page 67
CARDSTATUS Return Values (returned by Operating System) Return Value -1 -2 -3 -5 -6 -7 -8 -9 - 10 - 11 - 15
Description Communications with the memory card timed out. There was no memory card module detected at startup. There was no memory card inserted in the module detected at startup. The CRC of the return from the memory card system does not match. The return from the memory card system is unrecognized. The designated string is too short for return from the memory card. No card command was issued since the last call to CARDSTATUS. CARDCMD statement resulted in an error; get from ERR (). Card processor is still busy when CARDSTATUS called. Card is asleep when CARDSTATUS called. The return from the memory card has exceeded the 2K buffer.
If communication occurs with the memory module, but an error or warning condition is detected, CARDSTATUS returns a positive number. The following table (continued on the next page) lists these return values: CARDSTATUS Return Values (returned by Memory Module) Return Value 00 01
Vxcom Error Code 21000 21001
02 03 04 05 06 07 08 09 10
21002 21003 21004 21005 21006 21007 21008 21009 21010
Description Operation successful. Unrecognized card. This version recognizes Toshiba’s SSFDC 2 MB, 4 MB, and 8 MB memory cards. Unrecognized card. Syntax error. CRC of command did not match. Unknown command. Missing parameters for this command. Incorrect parameters for this command. Binary file. Incorrect file type. Too much data in the command.
Chapter 4 Statement & Function Reference
59
Page 68
Return Value 22 23 31 32 33 34
Vxcom Error Code 21022 21023 21031 21032 21033 21034
35 36 37 38 39 40 41 42 43
21035 21036 21037 21038 21039 21040 21041 21042 21043
51 52
21051 21052
53 54
21053 21054
55
21055
61 62 63 64, 65 66 67
21061 21062 21063 21064, 21065 21066 21067
68
21068
60
Description No ID file. No data. No such file exists. No file opened. Too many files (>60 files). The page has already been written to four times. (Note: Toshiba only allows you to write to a page four times.) No such record exists. End of file. Beginning of file. Time-out occurred. Memory full. Write/protect encountered. Record too large (>1024 bytes). Field too large (>255 bytes). Some of the physical functions are locked to avoid data corruption. Try: N, &0129 to unlock. File management error (control data was changed). Sequential file corrupted (by accidental power failure). Data corrupted. CRC of boot file did not match (program data may be corrupted). The bootcard program is too large (must be less than 24 KB). Card program failed (card may be worn out). Block erase failed (card may be worn out). Card format is incorrect. First block of memory is bad (card may be damaged). Too many bad blocks (card may be damaged). Most of the reserved control blocks are bad (card worn out). The card has been erased more than 32,768 times (each K, &1092 or N, &1092 counts as one erasing).
Chapter 4 Statement & Function Reference
Page 69
• Example 1 This routine opens a file on the memory card called “data.txt.” The process_cardcmd_error routine checks the global error flag and processes the error if there is one. If there is no error, then the routine calls CARDSTATUS to get the return value, again processing any errors if there are any. The subroutines referred to in the following example are located in the sample MXDEMO program located in Appendix C. cardcmd O, 2203, I, "data.txt" gosub process_cardcmd_error 'report errors from sending command to card IF crderr% = 0 THEN cardresult% = cardstatus(cardreturn$) 'retrieve results gosub process_card_error 'handle any errors ENDIF
Chapter 4 Statement & Function Reference
61
Page 70
• Example 2 This routine scrolls down in an open data file. In the demo programs, INPUTEVT calls this routine in response to the user pressing the downarrow key. The subroutines referred to in the following example are located in the sample MXDEMO program located in Appendix C. fn_down: sound 1397, 10 'click so user knows we got the key if (mode% = mode_top%) then 'we are at the top of the 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
62
Chapter 4 Statement & Function Reference