beautypg.com

Abs (number), Acos (number), Array – Xylem STORM 3 Basic Programming manual User Manual

Page 11

background image

9

Commands and Functions

The Storm’s implementation of Basic uses both commands and functions to perform actions and

return values, though each is syntactically different. Commands such as INPUT and GETVALUE

return values to the variable specified at the end of line (following a comma):

REM the following command stores the value of Analog 1 in variable a1

GETVALUEANALOG1, a1

Functions, on the other hand, specify the variable first, followed by the equal operator (“=”) to

assign the calculated value:

REM the following function stores the result in variable dt

dt = DATETIME(TIME)

Commands and Functions available to the Basic language are listed alphabetically below.

Returns the absolute value of the given number.

var = ABS(-2.5) REM sets var to 2.5

var = ABS(100) REM sets var to 100

ABS (number)

Returns the arc-cosine value of the given number.

var = ACOS(0) REM sets var to 1.5708 (PI/2)

var = ACOS(0.5) REM sets var to 1.0472 (PI/3)

ACOS (number)

A logical operator used between two expressions in a conditional statement (e.g. IF, WHILE, etc.).

Returns TRUE if the left and right expressions are TRUE, otherwise FALSE is returned.

var = 75

IF (var > 0 AND var < 50) var = 0REM does not set var (FALSE)

IF (var >50 AND var < 150) var = 100 REMsets var to 100 (TRUE)

AND

Declares and creates an array. Arrays may be single or multi-dimensional and filled with numbers

or strings. Number arrays, when created, are filled with zeros, while string arrays are filled with

empty strings (“”). To enlarge an array’s size (not its dimension), re-declare the array with a larger

size. Existing data will be preserved. Re-declaring an array with a smaller size does nothing.

ARRAYDIM and ARRAYSIZE can be used to determine the number of dimensions of an array as well

as the sizes of those respective dimensions.


ARRAY