Xylem System 5000 BASIC Manual User Manual
Page 9

Basic Features and Fundamentals
7
Files stored on the System 5000™’s local file system can be accessed for reading, writing, and
appending of data. The OPEN command allows files to be opened and assigned a number for
use throughout the program. Using the INPUT and PRINT commands with the file’s assigned
number allows Basic to read and write to the opened file. Other commands are also available
such as EOF, LINE INPUT, SEEK, and TELL for further manipulation of files.
File I/O
Escape Sequences and Hex Values
Special escape sequences are
available for use within Basic. Non-
printable characters such as a tab or
newline can be created by a using a
backslash (“\”) followed by a single
letter or hex value sequence as
detailed to the right.
Hex values can be specifically
retrieved using the \xXX escape
sequence. For example, \x09
would be translated as a horizontal
tab and \x0A as a newline. Note that
hexadecimal numbers
need to be used (thus 0A is equivalent
to decimal number 10) in this format.
Escape
Sequences
ASCII Value
Hex Value
Description
\b
8
08
backspace
\t
9
09
horizontal tab
\n
10
0A
newline
\v
11
0B
vertical tab
\f
12
0C
form feed
\r
13
0D
carriage return
\”
34
22
double quote
\’
39
27
single quote
\\
92
5C
backslash
\xXX
N/A
N/A
hex value
Serial and Network (Ethernet) communication act much the same as File I/O. COM and Ethernet
Ports can be opened with the OPEN command and closed with the CLOSE command via an
assigned number, similar to File I/O. Using the INPUT and PRINT commands with the network
or serial port’s assigned number allows Basic to read and write to the opened port.
CHECKRETURN provides verification that a PRINT statement was successful. The FLUSH
command can also be used to clear the buffer on an individual port.
such as EOF, LINE INPUT, SEEK, and TELL for further manipulation of files.
Serial and Network I/O
Both Serial and Network Ports may also be set to constantly listen for incoming communication.
Simple web pages, data retrieval, and DAMS-NT are a few benefits Listening Ports can provide.
The Listening Ports Setup found within the System Setup Communications tab of the System
5000TM enables the set up of these ports. Incoming communication from a listening port can
trigger various programs to respond. Basic programs can be very useful for customizing this
interaction. Examples of listening port communication can be found under the OPEN command
detailed later in this document.
Listening Ports