Version Changes (available on version 2.07 of the XL series data logger)
!Changes to the ‘input’ command to not change the variable value if no input was received
!Added ‘printsdi’ command, print to the SDI-12 port without any retries.
!Added ‘p12vxon’ command, turn on the 12 volt excite, (Only available on newer
hardware).
!Added ‘p12vxoff’ command, turn off the 12 volt excite, (Only available on newer
hardware).
!Added ‘settimeout (x)’ command, set the system time out value from 15 to 600 seconds.
!Added ‘opencom2’, ‘print2’ and ‘closecom2’ commands, allows printing to com port
two.
!Added ‘logvalx’ variable, an indirect variable normally based on a log column function.
!Added ‘reset’ variable, returns the number of times the system has reset.
!Described the ‘basicx’ variable.
Version Changes (available on version 2.10 of the XL series data logger)
!Added input commands for com port 2 and 3
!Added fluchcom1, flushcom2, and flushcom3 commands.
!Updated This document.
XL-BASIC Programs:
The XL™ series data loggers have a built in BASIC interpreter for handling specialized
operations outside the normal use of the data logger. Since this BASIC interpreter is specific to
the XL™ series of data loggers it is called XL-BASIC. XL-BASIC handles many of the standard
BASIC commands, but also provides access to the I/O and other features of the XL™ series data
logger.
Basic1 to Basic5There are five basic programs that can be called any time the system is
collecting data to log or to send to the GOES radio, etc. To execute one of the five programs,
select it from the source list just as “Stage” or “Ana1" is selected. Each XL-BASIC program has
a defined variable that will be used as a return value for the function that caused the XL-BASIC
program to execute. For example, as the system processes the data to log, it looks at the source
for each column. The first column is normally set to “Date” so the current date is placed in
column 1. Column 2 is normally time and a time stamp is placed in this column. If column 3
source was set to “Basic1", then the BASIC 1 program would execute and the value in variable
“Basic1" would be placed in the third column.
A BASIC program is written using a standard text editor on a PC and then loaded into the XL
series data logger. Each BASIC program must be 8K bytes or less in size. The size of the
XL™ SERIESXL-BASIC Programming Guide 23-1
program includes all commands, comments, remarks, and spacing. If the size of the file becomes
too big then cut down on the remarks or the spacing, or break the tasks into two separate
programs.
Variables:
Since the system is limited on RAM, and to keep the operation of the BASIC programming
simple, only predefined variables will be used. All variables types will be double precision
floating point variables. All standard system variables will be accessible to the XL-BASIC
interpreter plus some generic variables used only by the XL-BASIC interpreter system. In the
program the variables may be upper or lower case, here they are shown in lower case.
Main BASIC Program Variables:
Variable
Name
basic1
basic2
basic3
basic4
basic5
The basicx Variable:
This is not a separate variable but is actually an indirect link to one of the normal basic variables,
1 to 5. A program can return a value using the variable associated to the location number where
the basic program is loaded. For example a program loaded into basic program location 1 must
use the variable basic1 as the return variable. Now a program can use the name basicx as the
return variable which allows the program to be loaded in any program location. If loaded into
program location three, then when the program updates the basicx variable it is actually updating
the variable basic3.
General Purpose Variables:
TypeDescription
Read / WriteThese variables are used to return values from Basic program 1
to 5 to the menu option calling the BASIC program. These
variables are initialized to 0.0 when scanning is enabled, and
will retain any modifications between scans. On return the value
will depend on the users BASIC program.
Variable
Name
a to zRead / Write26 General purpose variables initialized to 0.0 when scanning is
23-2 XL-BASIC Programming Guide XL™ SERIES
TypeDescription
enabled. Any value changes will be retained between program
execution and between scans
Standard Input Variables:
VariableTypeDescription
StageRead / WriteThe last measured stage value is returned. (Only available on the
H-350XL and the H-510XL)
RemStageRead / WriteThe last measured value for the remote stage variable is returned.
LastStageRead / WriteThe stage value measured on the previous scan will be returned. Only
available on the H-350).
PtTempRead / WriteThe last measured PtTemp value is returned. (Only on the H-350XL)
PSIRead / WriteThe last measured PSI value is returned. (Only on the H-350XL)
AnaXRead / WriteThe last measured value for analog channel X (X = 1 to 4) is returned.
FreqRead / WriteThe last measured freq value is returned.
Digio1Read / WriteThe last measured input state for digital channel 1 is returned.
Digio2Read / WriteThe last measured input state for digital channel 2 is returned.
CountsRead / WriteThe last measured count value is returned.
TotcntRead / WriteThe last measured total count value is returned.
CountrateRead / WriteThe current count rate on the counter input.
EncodrRead / WriteThe last measured encoder input value is returned.
TscansRead / WriteThe total scans value is returned.
SdiAPRead / WriteThe last measured value for the selected SDI-12 variable is returned
A = address 0 to 9, P = parameter 1 to 9
FntXXRead / WriteThe last calculated value for function XX is returned. (XX = 01 to 40)
BasicXRead / WriteThe value of one program can be used in other programs. (X = 1 to 5)
Note: Standard input variables are normally read only but may also be assigned a new value
directly in the XL-BASIC program regardless of the variables corresponding hardware
input condition. Be aware that based on system configuration the input variable could be
updated by the system after the variable was set by the XL BASIC program. Writing to
these variables should be avoided or only used in advanced applications. For example, in
the following segment of code, the second line makes the first line useless.
measure(ana1)measurement analog input 1 now and update its variable.
ana1 = 12.34Sets variable ana1 to 12.34 regardless of the voltage on analog 1.
XL™ SERIESXL-BASIC Programming Guide 23-3
Read Only Variables:
VariableTypeDescription
DateRead OnlyThe date is returned in the format YYMMDD.0000
TimeRead OnlyThe time is returned in the format HHMMSS.0000
secondsRead OnlyReturn the current seconds in the format SS.0000
minutesRead OnlyReturn the current minutes in the format MM.0000
hoursRead OnlyReturn the current hours in the format HH.0000
dayRead OnlyReturn the current day in the format DD.0000
monthRead OnlyReturn the current month in the format MM.0000
yearRead OnlyReturn the current year in the format YY.0000
BattRead OnlyThe current battery voltage reading is returned
minbattRead OnlyReturn the minimum battery voltage measured since option was reset.
maxbattRead OnlyReturn the maximum battery voltage measured since option was reset.
tankpsiRead OnlyReturn H-355 tank PSI if an H-355 is connected.
linepsiRead OnlyReturn H-355 line PSI if an H-355 is connected.
purgepsiRead OnlyReturns H-355 p urge PSI setti ng.
purgedurRead OnlyReturns H-355 p urge duration setting.
bubrateRead OnlyReturns H-355 bub ble rate setting.
PurgeRead OnlyReturns H-355 purge status,0 = bubbler communication error.
1 = request for purge accepted.
2 = alrea dy p urging.
ResetsRead OnlyReturns the number of times the system has reset.
LogvalXRead OnlyReturns the value associated to a log column when the column is setup to
perform some function on the data like calculating the average, etc. The
‘X’ is the log column 01 to 25.
Note: The read only variables may be read but should not be written. Trying to set or write one
of these variables to some value will have no affect, and the program will continue on
under normal operation. If one of these variables is set to some value and then read
again, the value returned will not be the value set by the program but will be a value
based on the function behind the variable.
23-4 XL-BASIC Programming Guide XL™ SERIES
Math Functions:
Basic Math Operations
+, -, *, /.Standard Math operators
% Modulo divide, returns the remainder from the standard division
^ Power operation, X^Y is X raised to the power of Y, for example 2^8 = 256
Trigonometry Operations (Degrees)
sin(x) cos(x)tan(x)
asin(x)acos(x)atan( x)
Trigonometry Operations (Radians)
sinr(x)cosr(x)tanr(x)
asinr(x)a cosr(x)atanr(x)
Logarithmic Operations
log(x)ln(x)
Misc Function Operations
abs(x)Absolute value of x.
int(x)Integer portion of x.
sqrt(x)Square root of x.
int(x)Integer portion of x.
h377f(anaX) Convert voltage on analog channel X to a temperature in degrees (f) based
on math equation for a model H-377 temperature probe.
h377c(anaX) Convert voltage on analog channel X to a temperature in degrees (c) based
on math equation for a model H-377 temperature probe.
XL™ SERIESXL-BASIC Programming Guide 23-5
XL-BASIC Command Summary:
PROGRAM FLOW / CONTROL COMMANDS
COMMANDDESCRIPTION
REMAdd remarks to the program for documentation.
DELAY(xxxx)Delay or wait for xxxx milliseconds, 1 to 65000.
GOSUB xxxxGo to a subroutine at line number ‘xxxx’.
RETURNReturn from the subroutine.
GOTO xxxxGo to line number ‘xxxx’.
FOR / TO / NEXTLoop commands
IF / THEN Conditional program execution
ENDEnd marker for all programs.
SENSOR INPUT COMMANDS
MEASURE(xxxxx)Take a new measurement from the selected input.
VXONTurn on the 5.0 volt excitation.
VXOFFTurn off the 5.0 volt excitation.
P12VXONTurn on the 12 volt excitation. (Hardware Rev N and newer only)
P12VXOFFTurn off the 12 volt excitation. (Hardware Rev N and newer only)
SETDIG1Set digital I/O 1 high.
SETDIG2Set digital I/O 2 high.
CLEARDIG1Clear digital I/O 1 to a low state.
CLEARDIG2Clear digital I/O 2 to a low state.
CURRENTLOOP(a)Set the 4 to 20 mA current output level to ‘a’.
23-6 XL-BASIC Programming Guide XL™ SERIES
COM PORT COMMANDS
OPENCOMxOpen RS-232 Com Port x for Input and Print operations. (x = 1 to 3)
CLOSECOMxTurn off com port x (x = 1 to 3)
FLUSHCOMxClear out the input buffer for Com Port x (x = 1 to 3)
PRINTSend text and data to com port 1.
PRINT2Send text and data to com port 2
PRINT3Send text and data to com port 3
PRINT4Send text and data to com port 4, this is the RS485 port and it will
turn on automatically as needed. This port has no input options.
INPUTGet numeric values from com port 1.
INPUT2Get numeric values from com port 2.
INPUT3Get numeric values from com port 3.
INPUTDELAY(x)Set how long to wait for input on the serial ports, or keypad.
DIGITS(x)Set the number of digits to the right of the decimal point to display.
BUILT IN DISPLAY / KEYPAD COMMANDS
DISPLAYSend text and data to the local display
DISPCLEARClear the local display.
DISPCURSER(x)Set the curser position for the local display to ‘x’.
DISPOFFTurn off the local display.
INKEYGet a key press input from the local display.
LEDONTurn on the Error LED.
LEDOFFTurn off the Error LED.
XL™ SERIESXL-BASIC Programming Guide 23-7
Loading...
+ 14 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.