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

DuraTrax/LaserLite, LaserLite Pro/LaserLite Mx Developer's Reference, pages 141 to 150

Pages 141 to 150 of 229

The original document is the PDF (797 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 141

Memory Card Commands for the Commands File

The following sections provide more information on the commands used in the Vxcom or Download commands file to communicate with a memory card. The following table lists the commands file commands that are used to communicate with the memory card. Note: A space is required between the command letter and the parameters. The following commands are described in detail on the following pages. Command D <file type> <filename> F [<output filename>] K R [<number of bins>] <file type> <filename> S [<folder path>] <file type> <filename>

Description Delete file from card. File management report. Remove deleted files. Send file to card. Get file from card.

R Command

•= The R command sends a file to the LaserLite Mx. If you use the <file type> argument, the file is sent to the memory card. Syntax: R [<# of bins>] <file type> <filename> Parameters: Argument # of bins file type filename

Description Modulus (size) for indexed (I) files only. Integer value can be in the range 1–65535. This argument is not used for sequential (S), identification (D), or boot (B) file types. The type of memory card file (either (I)ndexed, (S)equential, I(D)entification, or (B)oot). Name of file (include extension).

Chapter 5 LaserLite Mx Memory Card Data Management

133

Page 142

S Command

•= The S command retrieves a file from the LaserLite Mx. If you use the <file type> argument, the file is retrieved from the memory card (instead of from RAM). Syntax: S [<folder path>] <file type> <filename> Parameters: Argument folder path

Description Name of folder that the retrieved file is put into; the file is placed in the current folder if a folder path is not given (optional argument). The type of memory card file (either (I)ndexed, (S)equential, I(D)entification, or (B)oot). Name of file (include extension).

file type filename D Command

•= The D command deletes a file from the memory card. Syntax: D <file type> <filename> Parameters: Argument file type

Description The type of memory card file (either (I)ndexed, (S)equential, I(D)entification, or (B)oot). Name of file (include extension).

filename K Command

•= The K command removes deleted files from the memory card. Syntax: K

134

Chapter 5 LaserLite Mx Memory Card Data Management

Page 143

F Command

•= The F command requests the memory card’s file management report. The operating system returns the data as it receives it from the memory card and stores it to a file that can be viewed and printed. Syntax: F [<output filename>] Parameters: Argument output filename

Description Name of file that the information is written to (optional argument). If a filename is not specified, the report is written to a file named CFILES.TXT.

If an <output filename> is provided, the file management report is written to the named file instead of to the default file CFILES.TXT. The communications program presents the memory card’s file management report in the following format: Memory Card File and Memory Status Report Total Space: Bad Space: Available Space: Retrievable Space:

xx Kbytes xx Kbytes xx Kbytes xx Kbytes

Number of deleted files:xx Number of valid files: xx File # 1 2 3 ...

Deleted No No No

Type B B I

Table Size 0 0 2203

Kbytes 26 38 1677

Name BOOTCARD0 CPU CRF1.TXT

Chapter 5 LaserLite Mx Memory Card Data Management

135

Page 144

File Types

The LaserLite Mx system supports the following types of files: identification (D), boot (B), sequential (S), and indexed (I or H). Each file type serves a different purpose. The file types are described in the following table. Type Purpose D B

S I

H

136

A binary file that provides an ID for the memory card. Two types of boot files serve two different purposes. One (CRD) is for the memory card operating software that executes in its 32K XRAM; the other (CPU) is the main operating system (LMXxxx.OS) and application of the LaserLite Mx.

A binary file not intended for booting. This is the primary file type for data and cross-reference. Data is appended record-by-record. Each record is passed to the data management system to ‘hash’ and add to the record. This enables quick lookup. Another type of indexed file, but the decision of table entry is determined outside of the memory card data management system. This system may be useful for programs that must maintain a strict order of data, but require the ability to change or edit data.

Comments Only one (1) ID file may exist on the memory card at a time. These filenames are reserved by the LaserLite Mx system. CRD – The operating software for LaserLite Mx 32K XRAM. This file is required; it is created when the card is formatted using MXFORMAT.EXE. CPU – An operating system and application that may be booted from the memory card. This file is optional; see pages 145–146 for information on creating and loading a CPU file.

A hash table size must be indicated when indexed files are created. Please see the notes on pages 141–142.

Vxcom does not support transferring H files.

Chapter 5 LaserLite Mx Memory Card Data Management

Page 145

Commands File Examples

The following example demonstrates using a commands file with a LaserLite Mx: I 0000000000 'Unlocks the unit to prepare it for communications M1 Get File Report 'Send message to line 1 of unit. F before.txt 'Get file report to write to before.txt. M1 Downloading 'Send message to line 1 of unit. M2 data.txt 'Send message to line 2 of unit. S I data.txt 'Instruct unit to send an ‘I’ type file 'from its memory card. M2 picklist.txt 'Send message to line 2 of unit. S I picklist.txt 'Instructs unit to send another ‘I’ 'type file from its memory card. M1 Clearing files 'Send message to line 1 of unit. M2 **************** 'Send message to line 2 of unit. D I data.txt 'Mark ‘data.txt’ file as deleted. D I picklist.txt 'Mark ‘picklist.txt’ file as deleted. K 'Erase deleted files from memory card 'to free up memory. M1 Receiving new 'Send message to line 1 of unit. M2 picklist file 'Send message to line 2 of unit. R 2203 I picklist.txt 'Instruct unit to create a new ‘I’ 'type file with 2203 ‘bins’ and to 'prepare to receive, index, and save 'each record. M1 Set date and 'Send message to line 1 of unit. M2 time 'Send message to line 2 of unit. T 'Synchronize clock with computer’s. M1 Get File Report 'Send message to line 1 of unit. F after.txt 'Get file report to write to after.txt. L 'Put LaserLite Mx unit to sleep.

The following commands file sends a cross-reference file named crf1.txt to the LaserLite Mx memory card: I 0000000000 'Unlock the LaserLite Mx. R 2203 I "crf1.txt" 'Send a file for the memory card 'to index to 2203 bins. L 'Lock the LaserLite Mx.

Chapter 5 LaserLite Mx Memory Card Data Management

137

Page 146

The following commands file sends a cross-reference file named xref.txt to the LaserLite Mx memory card: I 0000000000 'Unlock the LaserLite Mx for communications. D I "xref.txt" 'Delete previous copies of file. K 'Free up all available memory. R 2203 I "xref.txt" 'Create and send file to the 'memory card, index to 2203 bins. F 'Create a file report to CFILES.TXT. L 'Lock the LaserLite Mx.

Vxcom or Download sends the file (one record at a time) to the LaserLite Mx memory card. When the LaserLite Mx receives the record, it indexes it and adds it to the data file. To send additional files, add them to the commands file or create a new commands file, and execute Vxcom or Download again. The following example commands file retrieves data from a file on a card, deletes the file from the card, sends a new image file to the card, then requests the file management report from the card. I 0000000000 'Unlock the LaserLite Mx. S I "data.txt" 'Receive a file, via YModem, from 'the memory card. D I "data.txt" 'Delete the data file just 'transferred from the card. K 'Remove deleted file from card. R B "CPU" 'Send a new LaserLite Mx operating 'system and boot program to the card. F 'Request file management report. G 'Start the program.

Note: When creating the commands file, do not include any characters on the I command line after the unit ID parameter . Any additional characters (including spaces) after the unit ID will cause this command to fail. In the above examples, the comments associated with the I commands are on the next line.

138

Chapter 5 LaserLite Mx Memory Card Data Management

Page 147

Notes on Communicating with a Memory Card

•= All data transferred between the host and the memory card must begin with a command letter and end with a carriage return. •= The command letter may be lowercase or uppercase. When the command letter is uppercase, the memory card module software is in debug mode; when the command letter is lowercase, the software is in normal mode. The difference between debug mode and normal mode is that the communications between the host and memory card are CRC checked for normal mode, and not CRC checked for debug mode. •= For a lowercase key character command, the CRC is calculated from all of the bytes (including space and escape characters: & and ' or ") before the carriage return. The complements of the two CRC bytes are sent at the end of the command, before the carriage return, with the low byte sent first. The CRC of all the bytes sent across before the carriage return will always be &B001, if correct. The CRC of the returns from the card will only include the bytes before the carriage return. •= A command has two different types of fields besides the command letter: parameters to control the behavior of the command and data to be passed between the host and the memory card. •= All of the fields for a command must be separated by a space and must be input in the order defined. •= The parameters may be binary values, single byte ASCII, and ASCII strings (such as filename and key field). •= A binary parameter may be up to 4 bytes long and can be input in both decimal and hexadecimal formats. •= The data may be hexadecimal values (for binary data) or ASCII strings (for records). •= The hexadecimal values must begin with an ampersand (&) and end with an ampersand, space, or carriage return. •= ASCII strings (with more than one character) must be enclosed in either single ('xxx') or double ("xxx") quotation marks; a single non-numeric ASCII byte does not need to be enclosed in quotation marks. Chapter 5 LaserLite Mx Memory Card Data Management

139

Page 148

•= The returns from the card module can be status bytes (in decimal form), data (in hexadecimal or ASCII string format), or prompts responding to a single carriage input. The prompt for the firmware includes three bytes: a carriage return, a line feed, and a semicolon (:). The prompt for the memory card’s boot program (Data Management System (DMS)) is: a carriage return, line feed, and greater-than sign (>). •= For a lowercase command letter, the CRC is calculated from all of the bytes (including space and escape characters: & and ' or ") before the carriage return. The complements of the two CRC bytes are sent at the end of the command, before the carriage return, with the low byte first. The CRC of all the bytes sent across before the carriage return will always be &B001, if correct. The CRC of the returns from the memory card will only include the bytes before the carriage return. •= For indexed files, the DMS handles one record at a time. The fields within the record must be separated by a tab character. •= For sequential files, every byte in the data field of a command is written to the file. •= Doubling the “escape character” forces the character to be a data byte, for example, “&&” in a quoted string represents character &; “''” represents character '. If two continuous escape characters need to be used as escape (as when sending two strings together) a space must be used to separate the strings. •= Do not include a carriage return or a backspace in a quoted string. A carriage return can only be used as the end of transmission mark and the backspace key will delete the previous byte. If nonprintable bytes need to be sent as part of a string, they should be sent as a hexadecimal value. •= Any binary data, except the control characters (08 hex, 0D hex) and the escape characters (&, " or '), can be sent as ASCII strings.

140

Chapter 5 LaserLite Mx Memory Card Data Management

Page 149

About the Modulus Notes about hashed indexes on the LaserLite Mx Hash tables differ from other tables or arrays because they provide the LaserLite Mx system a fast way to seek data in an ASCII data file. They provide nonsequential access to data elements through the use of a hash function that converts the key field into an integer and divides it by the size (modulus) of the hash table. The remainder becomes the “key,” “lookup value,” or “bin” that indexes where to find the data element. The LaserLite Mx system provides a built-in hash function for distributing data elements into a hash table. While the actual hash algorithm for the LaserLite Mx is written in 8051 assembler, it is based on the following C language code example which is based on Allen Holub’s portable adaptation of Peter Weinberger’s generic hashing algorithm. /*---Hash PJW----------------------------------------/*An adaptation of Peter Weinberger’s (PJW) generic /*hashing algorithm based on Allen Holub’s version. /*Accepts a pointer to a datum to be hashed and /*returns an unsigned integer. *---------------------------------------------------*/ #include <limits.h> #define BITS_IN_int (sizeof(int) * CHAR_BIT) #define THREE_QUARTERS ((int) ((BITS_IN_int * 3) / 4)) #define ONE_EIGHTH ((int) (BITS_IN_int / 8)) #define HIGH_BITS (~((unsigned int)(~0) >> ONE_EIGHTH)) unsigned int HashPJW (const char * datum) { unsigned int hash_value, i; for (hash_value = 0; *datum; ++datum) { hash_value = (hash_value << ONE_EIGHTH) + *datum; if ((I = hash_value & HIGH_BITS) ! = 0) hash_value = (hash_value ^ (I >> THREE_QUARTERS 00 & ~HIGH_BITS; } return 9 hash_value); }

Chapter 5 LaserLite Mx Memory Card Data Management

141

Page 150

What Modulus Should be Used When Creating an Indexed File?

The Videx hashing formula can accommodate any number of records, regardless of the modulus. Performance will decrease as the number of records becomes much larger than the modulus. Use the following rules for selecting the modulus for LaserLite Mx indexed files: •= Optimal trade-off between performance and space efficiency is achieved when the anticipated number of records is less than twice the modulus. •= A prime number modulus provides the best distribution of data. The following prime numbers selections can provide optimal distribution: 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, 9689, 9941, 11213, 21701, 23209, 44497. •= The LaserLite Mx can support a modulus up to 65535.

142

Chapter 5 LaserLite Mx Memory Card Data Management