While Keywords
While Keywords
While Keywords
WHILE
MEDIUM_WHILE
70
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
DEFINE_PROGRAM
RELAY_INDEX = 1
WHILE (RELAY_INDEX <= 14)
{
ON[RELAY,RELAY_INDEX]
RELAY_INDEX = RELAY_INDEX + 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.
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
DEFINE_PROGRAM
RELAY_INDEX = 1
WHILE_TIMEOUT = Ø
WAIT 3Ø
WHILE_TIMEOUT = 1
MEDIUM_WHILE ((RELAY_INDEX <= 14) && (!WHILE_TIMEOUT))
{
ON[RELAY,RELAY_INDEX]
RELAY_INDEX = RELAY_INDEX + 1
}
(* FOR TURNING ON RELAYS *)
(* FOR MEDIUM_WHILE TIMEOUT *)
(* FORCE LONG_WHILE TO
TIMEOUT AFTER 3 SECONDS *)
Axcess Programming Language
Need help?
Do you have a question about the AXCESS CONTROL SYSTEM PROGRAM and is the answer not in the manual?