Xylem STORM 3 Basic Programming manual User Manual
Page 31

29
Commands and Functions
File
:
OPEN “SiteID.csv” FOR APPENDING AS #1
PRINT #1, “A1,B2,C3,D4”
CLOSE #1
REM Check if file exists, OPEN #1 FOR READING will fail if it does not
FileExists = 1
FileName$ = “LogFile.csv”
IF (NOT OPEN(#1, FileName$)) THEN
FileExists = 0
ELSE
CLOSE #1
OPEN FileName$ FOR READING AS #1
LINE INPUT #1, line$
CLOSE #1
ENDIF
Serial Ports (RS-232 and RS-485):
SETPORT 300, 8, none, 1, none, 50, 0 REM port settings
OPEN “RS-232 COM” AS #5 REM open at 300 baud w/50ms tx char delay
INPUT #5, var$
PRINT #5, “0M!”; REM sends 0M!
CLOSE #5
SETPORT 115200, 8, none, 1, none, 00, 0 REM port settings
OPEN “RS-485” AS #4 REM open at 115200 baud w/0ms tx line or char delay
INPUT #4, var$
PRINT #5, “0M!”; REM sends 0M!
CLOSE #4
Listening Port (RS-232 Com):
OPEN “LISTENER” AS #1 REM settings specified in Storm interface
PRINT #1 “Please enter a number: “
INPUT #1 5000, num$ REM wait for 5 seconds for input
PRINT #1 “\r\n”
PRINT #1 “You entered: “, num$, “\r\n”
CLOSE #1