beautypg.com

Commands and functions – Xylem STORM 3 Basic Programming manual User Manual

Page 30

background image

28

COMMANDS AND FUNCTIONS

ENDIF

ON var GOTO critical,moderate,okay

LABEL critical

SETVALUE DIGITAL1, 1

SETVALUE DIGITAL2, 1

SETVALUE DIGITAL3, 1

END

LABEL moderate

SETVALUE DIGITAL1, 0

SETVALUE DIGITAL2, 1

SETVALUE DIGITAL3, 1

END

LABEL okay

SETVALUE DIGITAL1, 0

SETVALUE DIGITAL2, 0

SETVALUE DIGITAL3, 1

END

Opens a file, serial port, or connects to a listening port.All files and non-listening ports will be

automatically closed when a program ends.

Files may be opened with one of three modes: READING, WRITING, or APPENDING. A file opened

with WRITING mode will create a new file if the file doesn’t exist, or erase the contents of an

existing file. To prevent overwriting of an existing file, use APPENDING for write operations of an

existing file. An alternativeOPEN syntax may be used to determine if a file exists, as shown below

in the file example.

Serial ports are opened with the following defaults: baud rate = 9600, data bits = 8, parity =

none, stop bits = 1, flow control = none, transmit char delay = 0, transmit line delay = 0. If other

port settings are desired, they must be specified prior to opening the port using the SETPORT

command, as shown below in the serial port example.

Listening ports are opened with settings specified in the interface under Outputs > Communication

Ports Setup. The CLOSE command has no effect on a listening port. When communication occurs

on a listening port, the assigned Basic program will be initiated. To send and receive data across

the port, use the OPEN command as detailed in the example below. Subsequent INPUT and PRINT

commands will read and write to the open port.

OPEN