Commands and functions – Xylem STORM 3 Basic Programming manual User Manual

Page 20

Advertising
background image

18

COMMANDS AND FUNCTIONS

Begins a loop encompassed by FOR and NEXT with an optional STEP command. The default STEP

is 1, meaning each iteration of the loop will increase the variable by 1. Negative STEPs may be

used to count backwards.

FOR x = 1 TO 3

REM retrieve the past 3 values of the Sensor named “Analog”

GETVALUE SENSOR “Analog” x, var$

NEXT x

FOR x = 6 TO 1 STEP -2

REM retrieve every other past value of the Sensor named “Analog”

GETVALUE SENSOR “Analog” x, var$

NEXT x

FOR

Returns the fractional portion of the given number.

var = FRAC(26.245) REM sets var to 0.245

FRAC (number)

Used in conjunction with an identifier to request a new measurement or stored value on the Storm.

Available identifiers are listed below. Astring or number variable must be specified after a comma

to store the result. If an error is encountered or a value is not available, the Storm’s Error Value

(default is -99.99) is returned.

GETVALUE

Returns the voltage reading of the switched +12 volt.See SetValue to turn on or off the

+12Vswd reference.

GETVALUE 12VSWD, v12$ REM sets v12$ to the voltage of +12Vswd

12VSWD

Returns the voltage reading of the +5V reference.See SetValue to turn on or off the +5V

reference

.

GETVALUE 5VREF, v5$

REM sets v5$ to the voltage on +5Vref

5VREF

Returns a new measurement from the specified Analog channel.TheXfollowing the identifier

specifies which analog channelis measured.

GETVALUE ANALOG1, a1$ REM sets a1$ to the voltage on Analog channel 1

GETVALUE ANALOG2, a2$ REM sets a2$ to the voltage on Analog channel 2

ANALOGX

Advertising