Instruction Manual
Language Reference • Reference 211
Publication 1398-PM601A-EN-P — October 2000
WORDS
Gn
Variable, Nonvolatile, User Variable
Purpose Load a user-defined variable with a value from another variable, result of a math
expression, a constant, a timer, or an analog input.
Syntax Gn = value
variable = Gn
n The number of the variable. n = 1, 2, 3, ..., 64.
value Value can be a constant, a nonvolatile 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 Gn remain in effect even after power is removed. Changes made
to a Gn by one program will be seen by other programs. Vn variables are volatile and
will lose their values when power is removed
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 Vn, Fn, Bn, Part 4 • Programming, Arithmetic
Example
G7 = ADC1
G14 = PCMD
G7 = V7 + 1
G8 = TIMER1
G9 = POS1
G or V = ±+
±
±
2 147 483 648
32 767
32 767
,,,
,
,