Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual
Page 63

6Ć23
6.7.2
START EVERY Statement
The START EVERY statement format is similar to the DELAY
statement format but is used to do a periodic reĆstart or scan of the
task. The format of the START statement is:
START EVERY n time_units
where:
n = any arithmetic expression or constant that evaluates to
an integer result
time_units = unit of time to be delayed before starting
The possible time units for both the START and the DELAY
statements are ticks, seconds, minutes, and hours. The tick rate is
userĆdefinable for each Processor being used. The range is 0.5
milliseconds to 10 milliseconds. The default tick rate is 5.5
milliseconds. The plural form of the time unit must always be used,
e.g., DELAY 1 HOURS.
When a START EVERY statement executes, it notifies the operating
system that the task needs to be reĆstarted n time units" from now,
starting with the statement following the START EVERY statement.
After notifying the operating system, control is passed back to the
task, which continues to execute. The task will eventually execute an
END statement, which causes that task to relinquish control. When
the time interval in the START EVERY statement expires, the
operating system makes that task eligible to run. It will run unless
there is a higher priority task eligible to run.
The point in time when the task begins executing again is based on
how long the task runs after the START is encountered and before
an END statement is executed. Consider the following example:
10 . . .
20 . . .
ąąă.
ąąă.
ąąă.
200 START EVERY 20 TICKS
ąąă.
ąąă.
ąąă.
850 END
This body of the proĆ
gram will be eligible
to run every 20 ticks
starting after the START
EVERY statement.
The DELAY statement tells the operating system to stop the task
where it is and continue running it after a certain length of time.The
START EVERY statement effectively defines for the operating system
a reĆstart point and a time interval. The operating system will
automatically start the task at the next statement after the START
EVERY when that time period expires. The execution time required
for program body between the START EVERY and the END
statements must not be longer than the specified time period or an
overlap error will occur.
By using the START EVERY statement, the programmer can
program tasks to be scanned at a certain frequency, enabling him to
do the slower control loop functions in BASIC if he desires.
However, BASIC may be too slow to accommodate some high
speed control requirements. For most applications Control Block
language should be used. For more information, refer to the
AutoMax Control Block Language Instruction Manual (JĆ3676).