Switch, Tan (number), Taskname – Xylem System 5000 BASIC Manual User Manual
Page 49

Basic Commands and Functions
numbers less than or equal to zero will turn the Switched +12 Volt Off.
GETPOWER SW12V, var
REM stores a 1 if On, 0 if Off for the Switched +12V
REM on the daughterboard in the var variable
SETPOWER SW12V, 0
REM turns the Switched +12 Volt Off
a = 16.0
SETPOWER SW12V, a
REM turns the Switched +12 Volt On
47
Declares the beginning of a SWITCH-CASE clause. The single variable given after the SWITCH
keyword specifies the character or characters to match. Once a CASE match is made, the program
will continue until a BREAK statement is seen, at which point the program will continue execution
at the END SWITCH statement. A DEFAULT route may be specified and followed if no other CASE
statements cause a match to occur.
var = 6
SWITCH var
CASE 0:
CASE 1:
PRINT “Number too low”
BREAK
CASE 2: PRINT “Low” : BREAK
CASE 4: PRINT “Mid” : BREAK
CASE 6:
PRINT “High” REM prints “High”
BREAK
DEFAULT: PRINT “Unknown number: “, var
END SWITCH
SWITCH
Returns the tangent value of the given number.
var = TAN(PI/4)
REM stores 1 in the var variable
PRINT TAN(0) REM prints “0”
TAN (number)
Used in conjunction with the GETDB command, TASKNAME requests calling Task’s name. For
example, if a Task is created with the name of “myTask”, GETDB TASKNAME will store the value of
“myTask” into the given string variable.
GETDB TASKNAME, var$
REM stores the calling Task’s name in var$
TASKNAME