
Using Time, Date, and Day
87
Axcess Programming Language
Using Time, Date, and Day
The system variables TIME, DATE, and DAY can be used to create timing functions. TIME
contains the current time in the form of the string HH:MM:SS, in which HH equals hours, MM
equals minutes, and SS equals seconds. The time is given in a 24-hour format (military time).
DATE contains the current date in the form of the string MM/DD/YY, in which MM equals month,
DD equals day, and YY equals year. Finally, DAY contains the current day of the year in the form
of one of the strings MON, TUE, WED, THU, FRI, SAT, or SUN.
The time and date mechanism is year 2000 compliant. For more details, see Newcalls.TXT and the
system call LONGDATE in the Axcess Docs directory.
These variables have the following restrictions:
!
They cannot be changed in the Axcess program. Instead, this is done with the terminal
emulator, or the SEND_COMMAND clock. For information on the terminal emulator,
refer to Terminal emulator in the Communications Menu section.
!
Individual storage locations cannot be referenced.
Typically these variables are used with an IF statement. Once the condition is true, certain
statements are executed. For instance, suppose you wanted to turn off all of the lights at 11:00 PM
every night. The code would look like this:
DEFINE_VARIABLE
PULSING_LIGHTS (* 1 IF PULSING LIGHTS SO IT HAPPENS ONLY ONCE
*)
DEFINE_PROGRAM
IF ((TIME = '23:ØØ:ØØ') AND (NOT PULSING_LIGHTS))
{
PULSE[LIGHTS,LIGHT_OFF]
ON[PULSING_LIGHTS]
WAIT 2Ø 'PULSING TIMEOUT'
OFF[PULSING_LIGHTS]
}
The statements following the IF statement will be executed every day at 11:00 PM. To change the
code so that the lights turn off at every hour, the statement would be changed to read:
IF ((TIME = '??:ØØ:ØØ') AND (NOT PULSING_LIGHTS))
{
PULSE[LIGHTS,LIGHT_OFF]
ON[PULSING_LIGHTS]
WAIT 2Ø 'PULSING TIMEOUT'
OFF[PULSING_LIGHTS]
}
The question mark (?) acts like a wildcard character, allowing any character to be in its place. Since
question marks are used in place of the hour, the comparison will be true, once an hour, when the
minutes and seconds are Ø, causing the lights to turn off.
Содержание Axcess
Страница 1: ...instruction manual Software Axcess Programming Language ...
Страница 8: ...vi Axcess Programming Language Table of Contents ...
Страница 12: ...Introduction 4 Axcess Programming Language ...
Страница 22: ...Axcess Basics 14 Axcess Programming Language ...
Страница 38: ...Channel Characteristics 30 Axcess Programming Language ...
Страница 54: ...Levels 46 Axcess Programming Language ...
Страница 62: ...Operators 54 Axcess Programming Language ...
Страница 66: ...Variable Types and Conversions 58 Axcess Programming Language ...
Страница 70: ...Two Dimensional Arrays 62 Axcess Programming Language ...
Страница 80: ...While Keywords 72 Axcess Programming Language ...
Страница 86: ...Using Buffers 78 Axcess Programming Language ...
Страница 94: ...Waits and Timer Keywords 86 Axcess Programming Language ...
Страница 102: ...Using Subroutines 94 Axcess Programming Language ...
Страница 108: ...Include Files and System_Calls 100 Axcess Programming Language ...
Страница 120: ...Compiler Error Messages 112 Axcess Programming Language ...
Страница 124: ...The External_Control Protocol 116 Axcess Programming Language ...
Страница 143: ...Index 135 Axcess Programming Language ...