The text of a manual · part 16 of 23
DuraTrax/LaserLite, LaserLite Pro/LaserLite Mx Developer's Reference, pages 151 to 160
Pages 151 to 160 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 151
Common Precautions for Using a Memory Card
It is important to be aware of the following notes and precautions when using a memory card: •= Do not remove the memory card from the LaserLite Mx unless the lock switch is in the OFF position (towards the lock icon). •= Do not remove the memory card or turn off power to the LaserLite Mx during operations; such as, file transfer, card formatting, or file deletion. This could damage the memory card. Doing either of the above could interrupt writing important data management information to the memory card and render some data irretrievable. Note: Removing a memory card from the LaserLite Mx while the unit is ON automatically places the memory card module processor in ‘halt’ mode. This prevents any undesirable writing to the memory card. To restart the memory card module processor, the LaserLite Mx must restart from the ‘sleep’ mode. This happens when the unit is switched OFF or when it times out. ‘Sleep’ mode is indicated by a blank display. The memory card is a precision electronic device: •= Do not apply pressure or shock. •= Do not bend or drop. •= Do not use or store the memory card in an environment subject to strong static electricity or electrical noise interference. •= Do not use the memory card in a hot, humid, or corrosive environment. •= Make sure no dirt or foreign particles are on the contact area. Do not touch the contact area with your fingers. •= Clean the memory card with a soft anti-static cloth (available at electronic stores).
Chapter 5 LaserLite Mx Memory Card Data Management
143
Page 152
Protecting the Data in the Memory Card
•= Transferring files to and from the memory card is prevented when a write/protect adhesive seal is applied to the write/protect area. To enable file transfer, remove the write/protect adhesive seal. •= Apply the write/protect adhesive seal properly. Make sure that the write/protect adhesive seal is applied securely in its place. •= Data can be written to the memory card at least 250,000 times. For example, if data is written to the memory card 30 times a day, the card will last at least 20 years. •= Data can be lost or destroyed in the following situations: •= Improper handling and use of memory card by the user or third party. •= Exposure to static electricity or EMI (electronic magnetic interference). •= Removing the memory card or turning off power to the LaserLite Mx during an operation. •= The memory card can be used reliably over many years, but will eventually lose its ability to store and transfer data. At this point, replace with a new card. •= We recommend saving your important data to another medium; such as, a floppy disk or hard disk.
144
Chapter 5 LaserLite Mx Memory Card Data Management
Page 153
Booting From the Memory Card The LaserLite Mx system allows the developer to create and load bootable application files onto the memory card. When the LaserLite Mx system starts, it automatically checks for the presence of these files and boots under certain conditions. To create the bootable file, use Vxcom as follows: Vxcomxxx <application name>.s LMXxxx.os -f1 -k2 This creates a new image file called FLASH.IMG. Rename the FLASH.IMG file to CPU. The file LOADCPU.VDX contains the following commands: I 0000000000 'Unlock the LaserLite Mx for communications. † D B CPU 'Delete any previous copy of CPU boot file. K 'Free up all available memory. R B CPU 'Load the CPU file from the computer. F 'Create a file report to CFILES.TXT. L 'Lock the LaserLite Mx. †
Note: If a CPU file is not on the memory card when the commands sequence is executed, the D command will not generate an error. This commands file works whether a CPU file is present or not. You can use LOADCPU.VDX or create a similar commands file to send the new CPU file to the memory card. To do so, use this command line: VXCOMxxx LOADCPU.VDX This procedure assumes that an OS file is already installed and running on the LaserLite Mx. (Note: The LaserLite Mx OS filename is LMXxxx.OS, where xxx represents the version number of the file.) If the .OS file is not installed on the LaserLite Mx, you will need to load both the memory card and the main RAM with the desired program.
Chapter 5 LaserLite Mx Memory Card Data Management
145
Page 154
To load the new image file to both the memory card and the RAM on the LaserLite Mx, create the CPU file as described on the previous page, and use a text editor to modify LOADCPU.VDX as follows: I 0000000000 'Unlock the LaserLite Mx for communications. R 'Load files included on the command line. D B CPU 'Delete any previous copy of CPU boot file. K 'Free up all available memory. R B CPU 'Load the CPU file from the computer. F 'Create a file report to CFILES.TXT. T 'Set LaserLite Mx time by computer’s time. L 'Lock the LaserLite Mx.
Then use this command line: Vxcomxxx <application name>.s LMXxxx.os LOADCPU.VDX
146
Chapter 5 LaserLite Mx Memory Card Data Management
Page 155
Sending Cross-Reference Files to the Memory Card A commands file must be passed with Vxcom or Download to send cross-reference files to the memory card. Cross-reference files are typically used for lookups and data verification in applications built with Videx BASIC. The LaserLite Mx also permits applications to delete and add records to cross-reference files that reside on the memory card. A cross-reference file for the memory card must be created as an ASCII text file and have a .TXT extension. The text file can be created with a text editor, a spreadsheet program, or exported from a database. A tab character must separate the fields and each record must end with a carriage return/line feed (which is the default behavior for computerbased text editors and ASCII exports from computer database programs). See page 149 for more information on creating a cross-reference file for a memory card. Following is an example of a commands file to load a cross-reference file on the memory card: I 0000000000 'Unlock the LaserLite Mx for communications. D I <filename.txt> 'Delete any previous copies of the file. K 'Free up all available memory. R 2203 I <filename.txt> 'Create and load new I type file. F 'Create a file report to CFILES.TXT. L 'Lock the LaserLite Mx.
When Vxcom or Download sends the file to the LaserLite Mx, it sends it one record at a time. As 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.
Chapter 5 LaserLite Mx Memory Card Data Management
147
Page 156
Transferring Data from the Memory Card To retrieve data from the memory card, set up a commands file similar to this: I 0000000000 'Unlock the LaserLite Mx for communications. S I <filename.ext> 'Open and send the named type and file. L 'Lock the LaserLite Mx.
This commands file does not clear the data from the file. To clear data, the file must be deleted with the line: D <file type> <filename>. Vxcom or Download appends the transferred data to a file of the same name if it exists; otherwise, it creates a new file.
148
Chapter 5 LaserLite Mx Memory Card Data Management
Page 157
Creating a Cross-Reference File for the Memory Card You can use your computer to create a cross-reference file for the memory card. The file should be created as a tab-delimited ASCII text file with no quotes around the records or the fields. The structure of each record is as follows: Data Field 1 (key field)
Tab
Data Field 2
Tab
Data Field 3
…
The maximum record length is 1000 characters. There is no limit to the number of fields within that 1000-character limit. These are the steps to load a cross-reference file onto a memory card: 1. Create a tab-delimited ASCII file as defined above. In this example, we will use the name PICKLIST.TXT for the filename. 2. Using a text editor such as Windows Notepad, create a commands file that contains the following commands. Note: Do not include the comments. I 0000000000 ' Unlock unit D I picklist.txt ' If file exists on card, delete it K ' Free all available memory on card R 2203 I picklist.txt ' Load file to memory card F ' Write memory card file system ' status to CFILES.TXT G ' Restart application
Chapter 5 LaserLite Mx Memory Card Data Management
149
Page 158
Opening a File on the Memory Card Up to 60 different files may reside on the memory card including deleted files. In Videx BASIC, the following command syntax opens an existing file named picklist.txt on the memory card: CARDCMD O, I, picklist.txt
The memory card software system receives the command, processes it, then this syntax retrieves the file handle. cardresult% = CARDSTATUS(cardreturn$)
Cardresult% captures the success or failure of the command. If CARDSTATUS returns 0 to cardresult%, then CARDCMD executed successfully. If picklist.txt is not on the memory card, then cardresult% should have a value of 31. If picklist.txt is found and opened, then cardreturn$ will contain the file handle number. You can then put the file handle number into a variable… IF cardresult% = 0 THEN picklist$ = cardreturn$
…then later re-open that file by referencing the file handle number only. fileopen$ = “O, “ + picklist$ CARDCMD fileopen$
See the Videx BASIC Manual for information on Videx BASIC.
150
Chapter 5 LaserLite Mx Memory Card Data Management
Page 159
Data and Cross-Reference File Handling on the Memory Card The following routine demonstrates matching input against a crossreference file, extracting data from the second field of the record, checking for duplicate scans in the data file, and saving data. It processes input from an INPUTEVT loop as follows: Data from INPUTEVT loop
Is it an <ENTER> key with no data?
No
Open the crossreference file and attempt to find a match
Is it in the crossreference file?
No
Sound low tone and return to INPUTEVT loop
No
Record the data and display the second field (description) from the cross-reference file.
Yes
Yes Sound low tone and return to INPUTEVT loop
Parse and store the second field from the crossreference file.
Open the data file and attempt to find a match.
Has it already been scanned?
Yes Sound low tone and return to INPUTEVT loop
Chapter 5 LaserLite Mx Memory Card Data Management
151
Page 160
This is the corresponding BASIC source code. fn_input: '* fn_input '* description: Respond to a user input event. '* Data is validated by checking if it is in cross-reference '* file on memory card. If data is valid, emit beep, flash Valid '* Scan LED, and display description field corresponding to the '* key field which was scanned. if device% = 1 then if len(data$) = 0 then 'it's an ENTER key, with no data sound 698, 250 'sound a low beep return endif endif cardcmd O, 2203, I, "bigcrf.txt" 'open crf file on card gosub process_cardcmd_error cardresult% = cardstatus (cardreturn$) gosub process_cardret_error cardcmd F, data$ 'search for data$ in crf file gosub process_cardcmd_error cardresult% = cardstatus (cardreturn$) gosub process_cardret_error if (cardresult% <> 35) then 'data found in crf file tabpos% = instr (cardreturn$, chr$(9)) 'look for tab desc$ = mid$(cardreturn$, (tabpos%+1),(len(cardreturn$)-tabpos%)) cardcmd O, 2203, I, "data.txt" 'open data file on card gosub process_cardcmd_error cardresult% = cardstatus (cardreturn$) gosub process_cardret_error cardcmd F, data$ 'search for data$ in data file gosub process_cardcmd_error cardresult% = cardstatus (cardreturn$) gosub process_cardret_error if (cardresult% = 35) then 'data not already in data file option(258) = 1 'turn on the LED sound 1446, 250 'good beep option(258) = 0 'turn off the LED cardcmd A, data$ 'add this scan to data file on card gosub process_cardcmd_error cardresult% = cardstatus (cardreturn$) gosub process_cardret_error display$ = desc$ 'display the input on the screen mode = mode_dn% 'scroll down to last line of file full_display$ = desc$ 'initialize scroll right & left shift% = 0 else gosub bad_tone 'duplicate scan, sound bad beep endif else gosub bad_tone 'not in crf file, sound bad tone endif return
152
Chapter 5 LaserLite Mx Memory Card Data Management