beautypg.com

Basic commands & functions – Xylem System 5000 BASIC Manual User Manual

Page 40

background image

38

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

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

var = 100

IF (var > 0 OR var < 50) PRINT “Small”

REM prints “Small”

IF (var > 0 OR var < 150) PRINT “Large”

REM prints “Large”

OR

A read-only constant containing the number 3.1415926535897932.

var = PI REM stores 3.14159 in var

PI

Writes characters to a file, serial/com port, network/ethernet connection or standard output. If

the PRINT statement is used without specifying an open file, serial port (#X), or ethernet

connection, the output is sent to the System 5000™ terminal. Generally, this will only be useful

while troubleshooting Basic programs. An automatic carriage return and line feed (\r\n) are

added to all PRINT statements unless the statement is ended with a semicolon (;). The USING

statement may also be appended for added precision or to set the number of digits to print

(specified with hashes “#”).

Serial communication:

PRINT “OPENING COM2” REM prints to terminal

OPEN “COM2” AS #4 REM “COM2” and “COM 2” are identical

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

PRINT #4 “W” REM Wakes up our sensor

INPUT #4 6000, H3531$

REM retrieve our measurements (6 sec timeout)

PRINT H3531$

REM print our results to the terminal

CLOSE #4

File communication:

PRINT “OPENING SiteID.csv” REM prints to terminal

OPEN “SiteID.csv” FOR WRITING AS #1

REM WRITING mode creates a new file

PRINT #1 “Digital2,AC-In” REM newline automatically added

var = 1

var2 = 256.25

var3 = 12.565

REM following line prints “1,256.25”

PRINT #1 var, “,”, var2, “,”;

REM newline not added

PRINT #1 var3 USING “##.##” REM prints “12.57” followed by a newline

PRINT #1 “Done”

REM newline automatically added

CLOSE #1

PRINT

BASIC COMMANDS & FUNCTIONS