Function Block Commands: Start Loop and End Loop

Basics:
The "Start Loop" and "End Loop" commands create a loop for executing steps a defined number of times.

Details:
The "Start Loop" command starts the loop.  Its Value cell sets the number of times the loop will run in a loop counter.  The loop counter is an integer that decrements by one from a start value >= 1.

All steps to be repeated must be located between the "Start Loop" and "End Loop" steps.

The "End Loop" command ends the loop and its Value cell does nothing.  One "End Loop" command is required for every "Start Loop" command.

When the script is run the steps between "Start a Loop" and "End the Last Loop" will execute the specified number of times.  If the loop is slow enough, you might be able to see a loop counter updating in real time in the Value cell of the "Start a Loop" step. 

A more powerful "loop with variable loop" feature is also available.  On the "Start Loop" step, click the Value cell then press the "=" key twice.  The Expression Builder dialog will open giving complete control of the loop counter to the user.

Scheduler/Script in the Function Block Setup Dialog

Figure 1: This script will send the "Tx Message HS CAN 1" 15 times then move on to step 4.

  Vehicle Spy Documentation - (C) Copyright 1997-2011 Intrepid Control Systems, Inc.

Last Update: Sunday, October 26, 2008