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 24 of 25

Application Builder for DuraTrax/LaserLite/LaserLite Pro/LaserLite Mx, for Windows Computers, pages 231 to 240

Pages 231 to 240 of 245

The original document is the PDF (2.4 MB). 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 231

FOREVER Looping Command The following example shows how the FOREVER loop is used in a commands text file to continually look for data collectors to transfer. Example FOREVER Commands File: Example: FOREVER I 0000000000 'Unlock any unit. M1 Downloading Data S Z T G END

'Begin the loop. 'Put message on unit’s display. 'Download data from unit. 'Clear data from unit. 'Set time by computer’s time. 'Restart the application. 'End loop, begin re-executing at top.

Note on the UNLOCK command (I id): No additional characters should be included on the same line as the UNLOCK command. Any characters after the unit 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.

Appendix C Using Multiple Data Collectors and Base Stations

223

Page 232

FOREACH Looping Command The following example shows how the FOREACH loop is used in a commands text file to attempt to transfer the data from each data collector in the list once. Example FOREACH Commands File: You can either list the IDs individually as in the first line of Example 1, or you can make a text file of the IDs and use the filename in quotes as in the first line of Example 2. Example 1 Commands Text File for Transferring Data from Multiple Data Collectors (IDs listed on command line): FOREACH ID1, ID2, ID3 'Begin the loop. All IDs listed on line. I loop_id 'Unlock the unit using the special identifier. This identifier substitutes 'for all the units listed on the first line. M1 Downloading Data 'Put message on unit’s display. S 'Download 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. 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. For examples showing appropriate use of a FOREACH loop, refer to the discussions of Scenarios 3 and 4 on pages 226 - 227. 224

Appendix C Using Multiple Data Collectors and Base Stations

Page 233

Example 2 Commands Text File for Transferring Data from Multiple Data Collectors (IDs listed in IDs.txt file): FOREACH "IDs.txt"

'Begins the loop. All IDs listed in 'the IDs.txt file.

I loop_id 'Unlock the unit using the special identifier. This identifier substitutes 'for all the units listed on the first line. M1 Downloading Data 'Put message on unit’s display. S 'Download 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. The IDs.txt file must contain a list of the IDs. The IDs in the text file must be separated by commas or spaces.

Appendix C Using Multiple Data Collectors and Base Stations

225

Page 234

FORALL Looping Command The following two examples show how the FORALL loop is used in a commands text file to transfer the data from each data collector in the list. Example FORALL Commands File: You can either list the IDs individually as in the first line of Example 1, or you can make a text file of the IDs and use the filename in quotes as in the first line of Example 2. Example 1 Commands Text File for Transferring Data from Multiple Data Collectors (IDs listed on command line): FORALL ID1, ID2, ..., IDN

'Begins the loop. All IDs are listed on 'this line.

I loop_id 'Unlock the unit using the special identifier. This rotates through 'identifiers for each unit. M1 Downloading Data S Z T L END

226

'Put message on unit’s display. 'Download data from unit. 'Clear data from unit. 'Set time by computer’s time. 'Lock the unit and put it to sleep. 'End loop, begin re-executing at top.

Appendix C Using Multiple Data Collectors and Base Stations

Page 235

Example 2 Commands Text File for Transferring Data from Multiple Data Collectors (IDs listed in IDs.txt file): FORALL "IDs.txt" 'Begin the loop. I loop_id 'Unlock the unit using the special identifier. This identifier substitutes 'for all the units in the IDs.txt file. M1 Downloading Data 'Put message on unit’s display. S 'Download 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. The IDs.txt file must contain a list of the IDs. The IDs in the list must be separated by commas or spaces. In order to clarify the functioning of these different looping structures, it is helpful to consider the four following scenarios for downloading multiple units. Scenario #1: The user has multiple data collectors to download, but only one at a time will be put in the Base Station or in front of the external IR transceiver. A computer is dedicated to downloading 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 Downloading Data S Z T L END This loop will continue indefinitely, unlocking any data collector that is available. It is important that only one unit at a time be in the Base Station or in front of the external IR transceiver 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. Appendix C Using Multiple Data Collectors and Base Stations

227

Page 236

Scenario #2: The user has multiple data collectors to download. Some or all of them may be in the Base Station at any time. Each of the units must be downloaded exactly one time. A computer is dedicated to downloading 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 Downloading Data S Z T L END This loop will continue until each unit in the IDs.txt file has been downloaded once. Multiple units can be in the Base Station at one time because only one unit will be unlocked at a time. Scenario #3: The user has multiple data collectors to download. Some or all of them may be in the Base Station at any time. Each unit is to be downloaded when it is placed in the Base Station; some of the units may be downloaded more than one time. A computer is dedicated to downloading 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 Downloading Data S Z T L END END

228

Appendix C Using Multiple Data Collectors and Base Stations

Page 237

This loop will continue indefinitely, continually attempting to unlock any units contained in the IDs.txt file. Unlike the FORALL loop in Scenario #2, this loop will continue attempting to download a data collector even after it has been successfully downloaded one time. Scenario #4: The user has multiple data collectors to download; all of the units to be downloaded are in their Base Stations. However, some of the units (listed in the IDs.txt file) are not available to download. If the computer is unable to unlock a particular unit, the computer will stop 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 Downloading Data S Z T L END

Appendix C Using Multiple Data Collectors and Base Stations

229

Page 238

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 C-2). Dummy1 Dummy2 Dummy3 Dummy4 Dummy5 Dummy6 ValidID1 ValidID2 ValidID3 ValidID4 Figure C-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 the unit is downloaded. 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 download each unit. For complete information on using the commands file, see Chapter 1 of the Developer’s Reference Manual.

230

Appendix C Using Multiple Data Collectors and Base Stations

Page 239

Notes on Using Multiple Data Collectors To avoid problems when using multiple data collectors and Base Stations, you need to be aware of the following cautions: •

Each of the data collectors used in a multiple Base Station arrangement must have a unique ID. See the preceding section in this appendix for information on changing a data collector’s ID.

•

When the data transfer process begins, do not remove a data collector from its Base Station, quit the program, or shut down your computer until the transfer process is completed. CAUTION: Do not attempt to send an application to more than one data collector at a time in a multiple Base Station set up. The units will not be damaged, but they will not be properly programmed. When transferring data from the data collectors, do not interrupt the process by removing the unit from its Base Station or aborting the program. The system is designed to avoid data loss, but observing this caution provides added protection.

If you should inadvertently remove a data collector while it is in the process of transferring data, the software displays a message that it was unable to communicate with the unit and then continues to try to transfer the data from all of the other data collectors. The data in the interrupted unit will not be cleared and can be transferred after the others have completed their data transfer. Key Points on Using Multiple Data Collectors •

Each data collector must have a unique ID.

•

When sending files to a data collector, it must be the only unit in a Base Station.

•

Do not interrupt the data transfer process.

•

Data is not cleared from a data collector until all of the data is correctly transferred to the computer. Appendix C Using Multiple Data Collectors and Base Stations

231

Page 240

Notes:

232

Appendix C Using Multiple Data Collectors and Base Stations