beautypg.com

Settimestamp, Setvalue, Sgn (number) settask – Xylem System 5000 BASIC Manual User Manual

Page 45

background image

Basic Commands and Functions

43

Sets the provided Task’s most recent timestamp to the given number or string. If an unknown Task

is specified, no value will be stored.

REM Find the Maximum value within the last four entries and set our

REM most recent entry to that datetimestamp and maximum value

Task$ = “myTask”

TaskMax = 0

TaskMaxDate$ = “”

FOR i = 1 TO 4

‘ get our time and date

GETTIMESTAMP Task$ i, Timestamp$

GETTASK Task$ i, TaskValue$

‘ Compare our Max values
TaskValue

=

VAL(TaskValue$)

IF (TaskMax == 0 OR TaskValue > TaskMax) THEN

TaskMax = TaskValue

TaskMaxDate$ = Timestamp$

ENDIF

NEXT i

SETTASK Task$, TaskMax

SETTIMESTAMP Task$, TaskMaxDate$

SETTIMESTAMP

Used to change current hardware settings. Available parameters are DIGITALX (Digital Port Level),

COUNTERX (Event Counter), QUADXX (Quadrature Counter), and 420MA (4-20mA Output) where

X is a number indicating the requested port. An optional SLOTX may be specified for option cards

(if not, the daughterboard is presumed), followed by the requested value. Note also that Counter

values should be integer (non-decimal) values.

a = 16.0

SETVALUE DIGITAL1 SLOT3, a

REM sets Digital port 1 on Slot 3 high

SETVALUE

Returns an integer (-1, 0, or 1) indicating the sign (negative, zero, or positive respectively) of the

given number.

var = SGN(-32.645) REM stores -1

var = SGN(1023.98) REM stores 1

SGN (number)

SETTASK

Sets the provided Task’s most recent value to the given number or string. If an unknown Task is

specified, no value will be stored.

task$ = “myTask”

GETTASK task$, a

SETTASK “myTask”, a * 2

REM doubles the last measurement value of myTask