Instruction Manual

276 Language Reference Reference
Publication 1398-PM601A-EN-P October 2000
WORDS
Vn
Variable, Volatile, User Variable
Purpose Load a user-defined variable with a value from another variable, a result of a math
expression, a constant, a timer, or an analog input.
Syntax Vn = value
variable = Vn
n The number of the variable: n = 1, 2, 3, ..., 64.
value Value can be a constant, a global variable Gn, a volatile variable
Vn, or a system variable.
variable The variable may be a nonvolatile variable Gn, a volatile vari-
able Vn, or a system variable.
Remarks G and V variables are stored internally as 4 bytes for the mantissa (the part before the
decimal point), 2 bytes for a numerator (the top part of a fraction), and 2 bytes for a
denominator (the bottom part of a fraction). The range of numbers that can be repre-
sented in 4 bytes is ±2,147,483,648. The range of numbers that can be represented in 2
bytes is ±32,767. Therefore, the range of numbers that can be contained in a G or V
variable and any intermediate value is:
The changes made to Vn remain in effect as long as power is maintained. On power-up
Vn is set to zero. If a value needs to be maintained during a power failure use a Gn
user variable. Changes made to Vn by one program will be seen by other programs.
TIP: Variables can be assigned names using the ASSIGN command and then refer-
enced by those names to make the program easier to read.
See Also Gn, Fn, Bn
Example
V7 = ADC1
V14 = PCMD
V7 = V7 + 1
V8 = TIMER1
V9 = POS1
G or V = ±+
±
±
2 147 483 648
32 767
32 767
,,,
,
,