
Chapter 11 Variables 95
Set All Variables Equal To ###
Puts the value ### into all
variables. This command can be used to quickly initialize all variables
(usually to zero).
Advanced Variable Commands
Indirect Commands
Variable @ Variable “XXX” = ###
This command looks up the value
of variable “XXX” and uses it as the ID number of the variable to
set. The corresponding variable is then set to the constant value ###. If the value of the first
variable is not a valid variable number, no action will be performed.
Example
: Assume the command
Variable @ Variable #3 = 100
is executed. The controller will first look up the value of variable number 3. Let’s assume its value is
12. The controller will then set variable number 12 to 100.
Increment Variable @ Variable “XXX” [Stop At 255]
Increment Variable @ Variable “XXX” [Roll Over At 255]
Decrement Variable @ Variable “XXX” [Stop At 0]
Decrement Variable @ Variable “XXX” [Roll Under At 0]
These commands look up the value
of variable # XXX and use it as the ID number of the variable to
increment or decrement. If the value of the variable is not a valid variable number, no action will be
performed. The incrementing and decrementing work the same as for the standard commands.
Variable @ Variable “XXX” = Current Year
Variable @ Variable “XXX” = Current Month
Variable @ Variable “XXX” = Current Date
Variable @ Variable “XXX” = Current Day Of Week
Variable @ Variable “XXX” = Current Hour
Variable @ Variable “XXX” = Current Minute
Variable @ Variable “XXX” = Current Second
Variable @ Variable “XXX” = Current Centisecond
These commands look up the value
of variable # XXX and use it as the ID number of the variable to
set. The corresponding variable is then set to the specified value.
Example
: Assume the command
Variable @ Variable #3 = Current Hour
is executed. The controller will first look up the value of variable number 3. Let’s assume its value is
12. The controller will then set variable 12 to the current hour.
If the value of the variable is not a valid variable number, no action will be performed. For instance,
assume that in the previous example, you have only 10 variables defined. Since variable 12 doesn’t
exist, no action will be performed. If variable 3’s value later changes to a valid variable number and
the command is executed again, it will work properly.
Variable “XXX” = Variable @ Variable “YYY”
Comentários a estes Manuais