Auxiliary Operations
XW-210 WiFi™ Users Manual
6.7 Basic Scripts
BASIC (Beginners All-purpose Symbolic Instruction Code) is a computer programming language that has
been in use for many years. The XW-210 has an integrated BASIC interpreter for a simple BASIC script.
This provides a great deal of flexibility by allowing users to customize basic functions of the unit. The
interpreter only supports a small subset of the BASIC commands that are available for larger computers.
Some non-standard commands have been added, and some commands may function differently on the
XW-210 BASIC interpreter than on other platforms. The following is a short tutorial on the supported
BASIC functions.
Example scripts are available at
www.controlbyweb.com
. Contact customer support if further assistance
is required.
6.7.1 Structure
A BASIC script is written as a .txt file, which is then uploaded to the device using the
Script setup tab
.
The maximum script size is 4-Kbytes. Each line within the script contains a single statement. Line
numbers are not used.
Statements are not case sensitive; however, variables are.
IF THEN, FOR loops, and DO loops can only be nested up to 5 times per command. For those not
familiar with nesting, the following is an example of nested FOR loops:
FOR a = 0 to 100
FOR b = 0 to 100
NEXT b
NEXT a
Every program must end with an END statement. Subroutines would then follow after the END
statement, if required. The last line of the script should be left blank.
6.7.2 Line Format
Every line follows the same format. The basic format is:
statement (variable) (=, <, >, <=, >=, <>) (expression) (THEN)
The fields in parentheses are optional depending on the statement. Spaces must be used between
all statements, numbers, variables, operators, expressions, etc. Multiple spaces are invalid.
Comments may be inserted, but must begin with an apostrophe. All text on a line after the apostrophe is
ignored.
Examples:
LET a=1
'this will return an error because of insufficient spacing
LET a = 1
'this is valid
LET a = 1
'this will return an error because of too many spaces
Only a single variable or literal is allowed on the left side of any operator. The following example is
incorrect and will return an error. The error occurs because there is more than a single value to the left of
the comparison operator (a + 2 is to the left of =).
IF a + 2 = 3 THEN 'this will return an error
To fix the above line, replace 'a + 2'. One of the following options may be used:
LET b = a + 2
IF b = 3 THEN
...
END IF
Page 76
Xytronix Research & Design, Inc.
Summary of Contents for WebRelay Wireless XW-210I
Page 1: ......