While Keywords
70
Axcess Programming Language
While Keywords
While Keywords
WHILE
Axcess checks to see if the condition following it is true, then either executes
statements within the WHILE statement, or continues to the next statements in
the code.
Example:
DEFINE_VARIABLE
RELAY_INDEX (* FOR TURNING ON RELAYS *)
DEFINE_PROGRAM
RELAY_INDEX = 1
WHILE (RELAY_INDEX <= 14)
{
ON[RELAY,RELAY_INDEX]
RELAY_INDEX = RELAY 1
}
In this example, the variable RELAY_INDEX is first set to 1. Next, the WHILE
statement checks to see if RELAY_INDEX is less than or equal to 14. Since it is
(making the statement true), Axcess executes the compound statement
directly following the WHILE. Since RELAY_INDEX equals 1, the device-chan-
nel referenced by [RELAY,1] is turned on, and RELAY_INDEX is incremented
by one. Then the program loops back to the WHILE statement. This loop con-
tinues until RELAY_INDEX becomes 15; in this case the compound statement
following the WHILE is not executed, and Axcess continues to the rest of the
program. This block of code effectively turns on the first 14 channels of device
RELAY.
MEDIUM_WHILE
Operates like a LONG_WHILE, but it ignores input changes from Axcess
devices.
You must provide a way out of your MEDIUM_WHILE (by allowing the condition
to become false), the program will become stuck inside the MEDIUM_WHILE
and no other code outside of the loop will be executed.
Example:
DEFINE_VARIABLE
WHILE_TIMEOUT (* FOR MEDIUM_WHILE TIMEOUT *)
DEFINE_PROGRAM
RELAY_INDEX = 1
WHILE_TIMEOUT = Ø
WAIT 3Ø (* FORCE LONG_WHILE TO
TIMEOUT AFTER 3 SECONDS *)
WHILE_TIMEOUT = 1
MEDIUM_WHILE ((RELAY_INDEX <= 14) && (!WHILE_TIMEOUT))
{
ON[RELAY,RELAY_INDEX]
RELAY_INDEX = RELAY 1
}
Summary of Contents for Axcess
Page 1: ...instruction manual Software Axcess Programming Language ...
Page 8: ...vi Axcess Programming Language Table of Contents ...
Page 12: ...Introduction 4 Axcess Programming Language ...
Page 22: ...Axcess Basics 14 Axcess Programming Language ...
Page 38: ...Channel Characteristics 30 Axcess Programming Language ...
Page 54: ...Levels 46 Axcess Programming Language ...
Page 62: ...Operators 54 Axcess Programming Language ...
Page 66: ...Variable Types and Conversions 58 Axcess Programming Language ...
Page 70: ...Two Dimensional Arrays 62 Axcess Programming Language ...
Page 80: ...While Keywords 72 Axcess Programming Language ...
Page 86: ...Using Buffers 78 Axcess Programming Language ...
Page 94: ...Waits and Timer Keywords 86 Axcess Programming Language ...
Page 102: ...Using Subroutines 94 Axcess Programming Language ...
Page 108: ...Include Files and System_Calls 100 Axcess Programming Language ...
Page 120: ...Compiler Error Messages 112 Axcess Programming Language ...
Page 124: ...The External_Control Protocol 116 Axcess Programming Language ...