beautypg.com

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

Page 32

background image

30

COMMANDS AND FUNCTIONS

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

Returns TRUE if the left, right, or both expressions are TRUE, FALSE if both are FALSE.

var = 100

IF (var > 0 OR var < 50) var = 1

REM sets var to 1

IF (var > 0 OR var < 150) var = 1

REM sets var to 1

OR

A read-only constant containing the number 3.1415926535897932.

var = PI REM sets var to 3.14159

PI

Writes characters to a file or serialport.An automatic carriage return and line feed (\r\n) are added

to all PRINT statements used with file operations unless the statement is ended with a semicolon (;).

PRINT statements used with serial operations send only the characters specified with no additional

characters automatically appended. The USING statement may also be appended for added

precision or to set the number of digits to print, specified with hashes “#”.

Serial communication (RS-232 and RS-485):

OPEN “RS-232 COM” AS #4

REM Wake up the H-3531 sensor by sending a character

PRINT #4 “W” REM Wakes up our sensor with a “W”

INPUT #4 6000, H3531$ REM retrieve our measurements (6 sec timeout)

CLOSE #4

OPEN “RS-485” AS #3

PRINT #3 “0316” REM Send command to our sensor

INPUT #31000, var$ REM retrieve our measurements (6 sec timeout)

CLOSE #3

File communication:

OPEN “SiteID.csv” FOR WRITING AS #1

PRINT #1 “Digital2,AC-In” REM \r\n automatically added

var = 1

var2 = 256.25

var3 = 12.565

PRINT #1 var, “,”, var2, “,”; REM saves 1,256.25, \r\n not added

PRINT #1 var3 USING “##.##” REM saves12.57 followed by \r\n

PRINT #1 “Done” REM \r\n automatically added

CLOSE #1

PRINT