Expressions, Relational expressions, System control values – Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 41

Advertising
background image

Operating Functions

Chapter 5

5–4

Important: The BASIC Module requires less time to find a scalar
variable because there is no expression

to evaluate. If you want to run a

program as

fast as possible, use dimensioned variables only when

necessary. Use scalars

for intermediate variables and assign the final

result to a dimensioned

variable. Also, put the most frequently used

variables

first. Variables defined first require the least amount of time

to locate.

An expression

is a logical mathematical expression that involves

operators (both unary and dyadic),

constants and variables. Expressions

are simple or complex, (e.g. 12*EXP(A)/100, H(1)

+ 55, or

(SIN(A)*SIN(A)+COS(A)* COS(A)/2).

A “stand alone” variable [var]

or constant [const] is also considered an expression. We refer

to

expressions as:

[expr].

Relational

expressions involve the operators EQUAL (=), NOT

EQUAL (

tu), GREATER THAN OR EQUAL TO (u=), and

LESS THAN OR

EQUAL TO (t=). You use them in control statements

to test a condition

(i.e. IF A t100 THEN...). Relational expressions

always require two operands.

We refer to relational expressions as:

[rel expr].

The system control values include

the following:

LEN (returns the length of your program).

MTOP (the last memory location assigned to BASIC).

See the following

Section 5.6.2 titled, “System Control Values” for

more information.

5.2.8
Variables (continued)

5.2.9
Expressions

5.2.10
Relational Expressions

5.2.11
System Control Values

Advertising