beautypg.com

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

Page 28

background image

GETDB ERRORSTR, var$

REM stores the Default Error String in var$

GETDB SITEID, var$ REM stores the System 5000 Site ID in var$

task$ = “myTask”

GETDB SCANRATE task$, A REM stores the Scan Rate for myTask in A

GETDB TASKNAME, name$ REM stores the calling Task’s name in name$

26

Used to retrieve the on/off status for a powered piece of hardware. Available parameters are

ACTIVELED (Active LED), ETHERNET (10/100 BaseT), SW12V (Switched +12V) , and the 5VREF (+5V

Reference) whose status’ can be read, returning a 1 for On or 0 for Off.

GETPOWER ACTIVELED, var

REM stores the status of the Active LED in var

GETPOWER ETHERNET,var REM stores the status of the Ethernet port in var

GETPOWER SW12V, var

REM stores the status of the Switched +12V in var

GETPOWER 5VREF SLOT1, var

REM stores the status of the +5V Ref in var

GETPOWER

Used to send a command and retrieve its response on the SDI-12 bus. The given command can

optionally contain the trailing exclamation point (“!”) and automatically performs retries. The

response is stored in the last variable provided. If no response is found, and System 5000™

Default Error String (default is -99.99) is returned. No caching of commands or responses is

performed.

REM Retrieve the second measurement parameter from an SDI-12 sensor

REM SDI Measurement commands return 5 characters (atttn)

REM a = sensor address, t = seconds to measure, n = # of measurements

GETSDI “0M!”, var$ REM returns 00022

delay_time$ = mid$(var$, 2, 3)

REM stores 002 in delay_time$

delay_time = val(delay_time$)

REM stores 2 in delay_time

DELAY delay_time REM waits for 2 seconds

sdi_cmd$ = “0D0!”

GETSDI sdi_cmd$, var$

REM returns 0+2.941+.012

var$ = mid$(var$, 2) REM saves +2.941+.012 in var$

ARRAY arr$(1)

REM declare our array for use with TOKEN

result = TOKEN(var$, arr$(), “+-”) REM separate based on + or -

FOR param = 1 TO result

REM result = 2

IF (param == 2) THEN

var2$ = arr$(param)

END IF

NEXT param

PRINT var2$ REM prints .012

GETSDI

BASIC COMMANDS & FUNCTIONS