The text of a manual · part 5 of 23
DuraTrax/LaserLite, LaserLite Pro/LaserLite Mx Developer's Reference, pages 41 to 50
Pages 41 to 50 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 41
For example, to change a unit’s ID to 12345: 1.
Use a word processing program to create a commands file containing the following three lines: I 0000000000 C 12345 L
2.
Save the file as a text file with a .txt, .vdx, or no extension and quit the program.
3.
Place a data collector into the Base Station slot.
IMPORTANT: When you are sending a file to a data collector, it must be the ONLY data collector attached to the computer. 4.
Enter the name of the commands file on the Download.exe command line.
5.
Download.exe executes the commands listed in the file: it unlocks the unit, changes the ID as instructed by the C command (in this case, 12345), and then relocks the unit.
6.
Remove the data collector from the Base Station slot and it is ready to use.
Chapter 1 Communications Programs
33
Page 42
To continue changing other data collector’s IDs: 1.
Reopen the commands file.
2.
Change the ID listed after the C command by selecting 12345 and typing in a new ID. (Note: There must be a space character between the C and the ID.)
3.
Save and close the file.
4.
Insert a data collector into the Base Station slot.
5.
Reactivate the Download.exe command line containing the name of the commands file.
6.
Download.exe executes the commands listed in the file: it unlocks the unit, changes its ID as instructed by the C command, and then relocks the unit.
7.
Continue these same steps until you have assigned a unique ID to each of your units.
Note: Keep a list of the IDs you are using; you will use this list in the section “Transferring Data from Multiple Data Collectors.”
34
Chapter 1 Communications Programs
Page 43
Changing a Data Collector’s ID with a Macintosh Computer
To assign an ID with a Macintosh computer, you must first create a commands file, and then click and drag the file onto the Videx Download icon. Videx Download uses the commands file to unlock the data collector and change the ID. (Note: The LaserLite Mx is not Macintosh compatible.) During normal operation, a data collector is given an ID of ten zeros. To change the ID, create a commands file consisting of the following three command lines: 1) an I command, followed by a space, followed by ten zeros to unlock the data collector; 2) a C command, followed by a space, followed by the new ID for the data collector; 3) and an L command to relock the data collector. For example, to change a data collector’s ID to 12345: 1.
Use a word processing program to create a file containing the following three lines: I 0000000000 C 12345 L
2.
Save the file as a text file with a .txt, .vdx, or no extension and quit the program.
3.
Place a data collector into the Base Station slot.
IMPORTANT: When you are sending a file to a data collector, it must be the ONLY data collector attached to the computer.
Chapter 1 Communications Programs
35
Page 44
4.
Click and drag the commands file onto the Videx Download icon.
5.
Videx Download executes the commands listed in the text file: it unlocks the unit, changes the ID to what is listed after the C command (in this case, 12345), and then relocks the unit.
6.
Remove the data collector from the Base Station slot; it is now ready to use.
To continue changing other data collector’s IDs: 1.
Reopen the commands file.
2.
Change the ID listed after the C command by selecting 12345 and typing in a new ID. (Note: There must be a space character between the C and the ID.)
3.
Save and close the file.
4.
Insert another data collector into the Base Station slot.
5.
Click and drag the edited commands file to the Videx Download icon.
6.
Videx Download executes the commands in the commands file: it unlocks the unit, changes its ID as instructed by the C command, and then relocks the unit.
7.
Continue these same steps until you have assigned a unique ID to each data collector.
Note: Keep a list of the IDs; you will use this list in the following section: “Transferring Data from Multiple Data Collectors.”
36
Chapter 1 Communications Programs
Page 45
Transferring Data from Multiple Data Collectors
To transfer data from a group of data collectors in one transfer process, you must: 1. Create a commands text file that uses the FOREVER, FOREACH, or FORALL looping commands to transfer the data from the data collectors. 2. Insert all of the data collectors into their Base Stations. 3. If using Windows, click and drag the commands text file onto the Vxcom icon; if using DOS, enter the name of the commands text file on the Download.exe command line; or if using Macintosh (DuraTrax, LaserLite, or LaserLite Pro only), click and drag the commands text file onto the Videx Download icon. The three looping commands provide transfer methods for three different situations. The FOREVER loop is useful if you have a computer dedicated to transferring the data from the data collectors. The FOREACH loop is useful if you are transferring data from only a portion of the data collectors. The FORALL loop is useful if all of the data collectors are required to be transferred during the process. The following table describes the looping commands: FOREACH
This loop will search for each data collector in the list of IDs. If it locates the data collector with the ID, it executes the commands within the loop once; if it does not locate the data collector with the ID, it goes on to the next ID. This loop attempts to execute commands within a loop once for each ID listed.
FORALL
This loop will look for each listed data collector’s ID until it has located and transferred the data from each ID in the list. This loop attempts to execute commands within a loop indefinitely, until all listed IDs have been located.
FOREVER
For use with a computer that is dedicated to transferring data. This loop will transfer the data from any data collector it locates. This loop attempts to execute commands within a loop indefinitely.
Table 1-1 Looping Commands
Chapter 1 Communications Programs
37
Page 46
FOREVER...END - Attempts to execute commands within the loop indefinitely. Example: FOREVER 'Begin the loop. I 0000000000 'Unlock any unit. M1 Transferring Data 'Put message on display. S 'Transfer data from unit. Z 'Clear data from unit. T 'Set time by computer’s time. G 'Restart the application. END 'End loop, begin re-executing at top.
Note on the Unlock (I) command: No additional characters should be included on the same line as the Unlock (I) command. Any characters after the ID (for example, space characters or comments) will cause this command to fail. In the above example, the comment associated with the Unlock command is on a separate line. FOREACH [“id file.ext”] or [<ID-1, ID-2, ...>] ... END - Attempts to execute the commands within the loop once for each ID passed. Requires an argument that may be either a list of IDs or the quoted name of a file that contains a list of IDs. The list may be either comma or space delimited. If a file is used, the IDs may also be separated by carriage return/line feed characters. Example: FOREACH ID1, ID2, ID3 'Begin the loop. I loop_id 'Unlock the unit using the special identifier. This 'identifier substitutes for all the IDs listed on the 'first line. M1 Transferring Data 'Put message on display. S 'Transfer data from unit. Z 'Clear data from unit. T 'Set time by computer’s time. L 'Lock the unit and put it to sleep. END 'End loop, begin re-executing at top.
38
Chapter 1 Communications Programs
Page 47
Note on the loop_id argument: When the argument of the Unlock command is a specific ID (as in the previous FOREVER example), the program attempts to unlock the unit eight times at five-second intervals. This ensures that a unit is unlocked regardless of its sleep cycle (a unit sleeps for 25 seconds, then wakes for 5 seconds). If the program does not unlock a unit, the program returns an error and aborts. On the other hand, when the argument of the Unlock command is loop_id (as in the FOREACH example), the program only makes one attempt to unlock the unit. If it is successful, it performs the remaining commands in the loop; if not successful, it moves on to the next value for loop_id without aborting the program. Given the unit’s sleep cycle, it is unlikely that one attempt will successfully unlock a unit. Therefore, it would generally not be reasonable to use a FOREACH loop by itself as in the above example. See pages 41–42 for examples that show the appropriate use of the FOREACH loop. FORALL [“id file.txt”] or [<ID-1, ID-2, ...>] ... END - Attempts to execute the commands within the loop for each ID passed. FORALL continues to attempt the commands within the loop until all commands are successfully completed for all ID’s. When all commands are completed for one ID, it is removed from the list and that ID isn’t attempted again. Requires an argument that may be either a list of IDs or the quoted name of a file that contains a list of IDs. The list may be either comma or space delimited. If a file is used, the IDs may also be separated by carriage return/line feed characters. Example: FORALL "IDs.txt" 'Begin the loop. I loop_id 'Unlock the unit using special identifier. This 'identifier substitutes for all IDs in the IDs.txt 'file. M1 Transferring Data 'Put message on display. S 'Transfer data from unit. Z 'Clear data from unit. T 'Set time by computer’s time. L 'Lock unit and put it to sleep. END 'End loop, begin re-executing at top.
Chapter 1 Communications Programs
39
Page 48
In order to clarify the functioning of these different looping structures, it is helpful to consider four different scenarios for transferring data from multiple units. Scenario #1: The user has multiple data collectors to transfer, but only one at a time will be put in the Base Station or in front of the JetEye. A computer is dedicated to transferring data from the data collectors, as they become available. In this situation, the units do not need to be assigned individual IDs and a FOREVER loop can be used: FOREVER I 0000000000 M1 Transferring Data S Z T L END
This loop continues indefinitely, unlocking any data collector that is available. It is important that only one unit at a time is in the Base Station or in front of the JetEye when using this looping structure. This loop will unlock any data collector; if more than one data collector is unlocked at a time, communications will fail. Scenario #2: The user has multiple data collectors to transfer. Some or all of them may be in the Base Station at any time. Each unit must have its data transferred exactly one time. A computer is dedicated to transferring the data from the units as they become available. In this situation, each unit must be assigned a unique ID and the FORALL loop can be used: FORALL "IDs.txt" I loop_id M1 Transferring Data S Z T L END
This loop continues until the data from each unit in the IDs.txt file has been transferred once. Multiple units can be in the Base Station at one time because only one unit will be unlocked at a time. 40
Chapter 1 Communications Programs
Page 49
Scenario #3: The user has multiple data collectors to transfer. Some or all of them may be in the Base Station at any time. The data from each unit is to be transferred when the unit is placed in the Base Station; some of the units may have their data transferred more than one time. A computer is dedicated to transferring the units as they become available. In this situation, each unit must be assigned a unique ID and a FOREACH loop nested inside a FOREVER loop can be used: FOREVER FOREACH "IDs.txt" I loop_id M1 Transferring Data S Z T L END END
This loop continues indefinitely, continually attempting to unlock any unit contained in the IDs.txt file. Unlike the FORALL loop in Scenario #2, this loop continues attempting to transfer the data from the unit even after it has been successfully transferred one time. Scenario #4: The user has multiple data collectors to transfer; all of the available units are in their Base Stations. However, some of the units (listed in the IDs.txt file) are not available to transfer. If the computer is unable to unlock a particular unit, the computer stops trying to unlock that unit. In this situation, each unit must have a unique ID and a FOREACH loop can be used: FOREACH "IDs.txt" I loop_id M1 Transferring Data S Z T L END
Chapter 1 Communications Programs
41
Page 50
As was explained in the earlier discussion of the FOREACH loop, when the argument of the Unlock command is loop_id, the program only makes one attempt to unlock the unit. Given the unit’s sleep cycle, it is unlikely that one attempt will successfully unlock a unit. However, it is possible to ensure that each unit is awake when the program attempts to unlock it. This is done by placing six unused IDs at the beginning of the IDs.txt file (Figure 1-2). Dummy1 Dummy2 Dummy3 Dummy4 Dummy5 Dummy6 ValidID1 ValidID2 ValidID3 ValidID4 Figure 1-2 Sample IDs.txt File If a unit is awake and receives an Unlock command with the wrong ID, it will stay awake as long as it detects activity on the serial port. By placing six unused IDs at the beginning of the IDs.txt file, it is possible to ensure that each unit receives at least one Unlock command with an invalid ID and then stays awake. Then each unit is awake when the FOREACH loop attempts to unlock it and transfer its data. The program only attempts to unlock each unit one time; if a unit is not present, the program moves on to the next ID. The program quits after attempting one time to unlock and transfer the data from each unit.
42
Chapter 1 Communications Programs