Expressions And Operators - ABB PGC2000 Operation And Service Manual

Process gas chromatograph
Table of Contents

Advertisement

and those values can then be accessed by another BASIC program. Thus, the COMMON! array is a
mechanism whereby information and data values can be passed between BASIC programs.
Another characteristic of the COMMON! array is that the memory allocation is static. That is, the
COMMON! array stays around forever and the values are retained between program modifications
and compilations. As a result, the contents of the COMMON! array normally only change when a
value is assigned to an array element by using the assignment statement. If the analyzer is reset
using the Reset switch on the Single Board Computer PCB, the COMMON! array contents are reset
to zero. All other variables are local and their memory allocation is dynamic. Local variables
maintain their values between program executions, but not between compilations. When a program
is successfully compiled, all local variables are initialized to zero and the previous contents are
destroyed.

Expressions and Operators

An expression consists of operands combined together by operators. Operands can be constants,
variables, functions or subexpressions. Operators are either arithmetic, relational, logical or string
type. The data type of operands determines which operators are allowed. Mixed mode expressions
(i.e., expressions in which operands have different data types) are not allowed. For instance, a
floating point operand cannot appear in an expression with an integer operand. Conversion routines
are provided for data type conversions necessary to mix data types in expressions.
Arithmetic Operators: Arithmetic operators include:
+
-
*
/
unary -
Relational Operators: Relational operators are used to compare operands of the same data type
yielding a logical (Boolean) result. Since there are no Boolean type variables in this implementation,
the result of a relational operator cannot be stored in a variable, unless a conversion routine is used.
Relational operators are:
<
>
<=
>=
<>
=
Logical Operators: The logical operators NOT, AND and OR operate on logical operands to yield a
logical result: TRUE or FALSE.
String Operators: The only string operator is concatenation, which is accomplished using "+."
Operator Precedence and Associativity: The order of operators is determined by operator
precedence and associativity. When an expression is evaluated, operators having the highest
precedence are evaluated first. Operators of equal precedence are evaluated according to
associativity. Parentheses can be used to override precedence and associativity. Operator
precedence from highest to lowest are:
( )
unary -
* /
+ -
10-4
addition
subtraction
multiplication
division
operates on a single operand to yield the negation of the operand.
less than
greater than
less than or equal to
greater than or equal to
not equal to
equal
Parentheses
Arithmetic
Arithmetic
Arithmetic
2000-OSM, F1

Advertisement

Table of Contents
loading

Table of Contents