beautypg.com

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

Page 34

background image

Returns a string, starting from the left side, containing the given number of characters from the

given string.

var$ = “Hello World”

new_var$ = LEFT$(var$, 6) + “Universe”

REM stores “Hello Universe”

32

LEFT$ (string, number)

Returns the length of the given string.

var = LEN(“Hello World”)

REM stores 11 in var

LEN (string)

Reads an entire line from an open file.

OPEN “SiteID.csv” FOR APPENDING AS #1

LINE INPUT #1 b$

REM retrieves a single line and stores it in b$

CLOSE #1

LINE INPUT

Used as a parameter to the OPEN command, attaches to the listening port associated with the

program. The port can be either a serial (COM) port or network (Ethernet) port and is configured

using the touch screen interface under the Listening Ports Setup screen. Opening the Listener port

enables communication between the System 5000TM and the connecting device.

OPEN “LISTENER” AS #1

INPUT #1 “\r” 2000, cmd$ REM check for a command

IF (cmd$ == “Analog1”) THEN

GETVALUE ANALOG1, val

PRINT #1 “Analog1: “, val

ENDIF

CLOSE #1

LISTENER

BASIC COMMANDS & FUNCTIONS

Returns the natural logarithm of the given number. The LOG function should be used if a common

(base-10) logarithm is required.


var = LN(3) REM stores “1.09861”

var = LN(5) REM stores “1.60944”

LN (number)