GSE 60 SERIES Technical Reference Manual page 359

Programmable process controllers
Table of Contents

Advertisement

Table 9-8: Math Assignment Examples
A
SSIGNMENT
A = B (Copy Value)
80.1P=10.95%o
80.2P=80.1P%o
100=80.3P%o
80.4P=50-10%o
80.4P="50-10"%o
80.3P=80.4P%o
80.2P=2147483647%o
80.2P=2147483648%o
80.2P=2147483649%o
80.2P=-2147483648%o
80.2P=-2147483649%o
80.3P=4294967295%o
80.3P=4294967296%o
80.3P=4294967297%o
String Assignments
Strings containing numeric values can be used to perform math
calculations. For example, if variable #5 is a string containing the value
10, then
80.5P+=1%o
will increment VAR#5 to a value of 11.
Due to a string's ability to perform math calculations, assigning a value to
a string directly from the entry buffer, as with a "get entry" command,
requires special consideration when a math operator could appear as part
of the entry. For example,
EnterPart#%G
=80.5P%o
will store an operator part number entry in VAR#5. However, suppose the
part number was entered as 100-25. Since variable 5 is a string, the
presence of a "-" character entry will cause the entry to be treated as a
math command. The value 75 will be stored in VAR#5!
To prevent math operations on string assignments, the assigned value
should be encapsulated in quotes " ". This can be accomplished using the
%[ Save Entry Buffer and %] Restore Entry buffer commands to store the
entry in the temporary register and insert it within quotes in the assignment
command. The following example will store a value in string VAR#5
exactly as entered:
EnterPart#%G
%[
80.5P="%]"%o
VAR#1
T
YPE
(F
LOAT
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
A = B
VAR#2
)
(I
)
NT
10.95
10.95
10
10.95
10
10.95
10
10.95
10
10.95
10
10.95
2147483647
10.95
-2147483648
10.95
-2147483647
10.95
-2147483648
10.95
2147483647
10.95
2147483647
4294967295
10.95
2147483647
10.95
2147483647
VAR#3
VAR#4
(U-I
)
(S
)
NT
TRING
100
100
40
100
50-10
50
50-10
50
50-10
50
50-10
50
50-10
50
50-10
50
50-10
50-10
0
50-10
1
50-10
60 Series Technical Reference Manual
Macros 9-111
E
NTRY
B
UFFER

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents