beautypg.com

Xl™ series – Xylem XL-BASIC Programming Guide User Manual

Page 13

background image

XL™ SERIES

XL-BASIC Programming Guide 23-13

In the second example the two data values are separate based on the spaces
inside the quotes, and the line is again terminated with a carriage return
line feed because of the lack of a comma or semicolon.
In the last example the first value is formatted to 8 characters, (due to
using the ‘;’ option) and the second value is printed using no extra spaces,
and the line is NOT terminated since it ends with a comma.

Normally ASCII text is sent out the serial port but at times it may be
necessary to send special control codes, for example to initialize a serial
display. To send out a single character control code in HEX format use a
‘&’ character as a prefix to the HEX data. The HEX data is in the range of
00 to FF.

print &hh

where & indicates to the system a two character hex value
follows, and the hh is the hex value from 00 to FF.

Example:

print &0D

sends a carriage return

print &0A

sends a line feed.

PRINT2

Same as print except the output is to com port 2.

PRINT3

Same as print except the output is to com port 3.

PRINT4

Same as print except the output is to com port 4, the RS-485 port.

INPUT

Waits for a numeric value to be entered on comport 1. If no input is
received within the timeout period defined by the INPUTDELAY
command then program execution continues and the variable used with the
INPUT command will remain unchanged. Like standard BASIC this
command can be used to print a prompt to the user.

Example:

opencom1
input “Enter First Value “,a
input “Enter Second Value”,b
print “Sum = “,a+b
end

INPUT2

Waits for a numeric value to be entered on comport 2. See the Input
command for more information.

INPUT3

Waits for a numeric value to be entered on comport 3. See the Input
command for more information.

INPUTDELAY(x)

Set a timeout delay for serial input operations. The range is 1 to 60000
milliseconds. The default is 10000 or 10 seconds.