4.3
Variables
Basic variables
There are two basic types of variable, as follows:
• Integer variable (
• Floating-point variable (
Integer variables are denoted by placing a % % symbol after the name of the
Integer
variables
variable, and are internally represented by a two's complement
32-bit number. This gives a decimal range of ±2147483647.
Floating-
Floating-point variables have no symbol. These variables are
IEEE double-precision (64-bit) numbers which give a range of approximately
point
±1.7976 x 10
variables
Accessing the variables
All variables are global within a program (ie. they can be accessed and
altered by any task). (There are no local variables.)
Bit-addressing of variables
All integer variables and arrays (see below) may be bit-addressed. This
means that each individual binary bit in the variable may be separately read
or written to. Bit-addressing is achieved by appending .n .n to the end of the
variable name, where n n is the bit number to be accessed.
Example
flags%.3 = 1
IF flags%.5 = 1 THEN ...
Naming conventions
The first character of a variable must be a letter. Subsequent characters
may include letters, numbers and the underscore (
be in any order.
Variable names are case sensitive (eg. the variable name speed%
same as SPEED%
SPEED%).
Preferred use of variables
It is recommended that integer variables are used where possible.
Operations on integer variables perform much faster than for
floating-point variables.
UD70
Issue code: 70nu2
)
INT
FLOAT
±
308
.
;set bit 3 to 1
;check bit 5
DPL programming
)
_
) character. These may
speed% is not the
4-3
Need help?
Do you have a question about the UD70 and is the answer not in the manual?
Questions and answers