Xpert/Xlite BASIC User Manual
Total Page:16
File Type:pdf, Size:1020Kb
Sutron Corporation Xpert/9210 XLite BASIC Users Manual Rev. 3.13 #8800-1151 07/2013 1 Xpert/9210B XLite BASIC Manual USERS MANUAL Part No. 8800-1151 Rev. 3.13 July 12, 2013 Sutron Corporation | 22400 Davis Drive | Sterling, VA 20164 | 703.406.2800 | www.sutron.com | [email protected] Sutron Corporation Xpert/9210 XLite BASIC Users Manual Rev. 3.13 #8800-1151 07/2013 2 Table of Contents Introduction ..................................................................................................................................... 9 Overview ....................................................................................................................................... 10 Installing and Configuring BASIC.SLL ....................................................................................... 11 Installation................................................................................................................................. 11 Configuration ............................................................................................................................ 11 Program Start and Stop ......................................................................................................... 11 Recording Start and Stop ...................................................................................................... 12 Recurring Schedule ............................................................................................................... 12 Basic Blocks.......................................................................................................................... 13 Format Data for SatLink/GPRS/Iridium Transmission ........................................................ 14 Run Always Mode ................................................................................................................ 15 Program "Basics" .......................................................................................................................... 16 Using the Language ...................................................................................................................... 19 Comments ................................................................................................................................. 19 Statements and Functions ......................................................................................................... 19 Variables ................................................................................................................................... 19 Operators ................................................................................................................................... 21 Logical and Binary Operators ............................................................................................... 22 Math Functions ......................................................................................................................... 22 Conditional Statements and Loops ........................................................................................... 22 Aborting a Program................................................................................................................... 25 String Functions ........................................................................................................................ 25 Subroutines and Functions ........................................................................................................ 25 Recursion .............................................................................................................................. 26 Pass by Reference ................................................................................................................. 27 Public Subroutines and Functions ......................................................................................... 27 Calling Subroutines and Functions contained in a DLL ....................................................... 27 Date and Time ........................................................................................................................... 28 Debugging ................................................................................................................................. 29 Error Handling .......................................................................................................................... 30 File I/O ...................................................................................................................................... 31 Log I/O ...................................................................................................................................... 31 Serial I/O ................................................................................................................................... 31 Socket I/O ................................................................................................................................. 32 Digital I/O ................................................................................................................................. 32 Analog I/O ................................................................................................................................ 32 SDI I/O ...................................................................................................................................... 32 SSP Messaging.......................................................................................................................... 32 Satlink/GPRS/Iridium Formatting ............................................................................................ 32 Basic Tags ................................................................................................................................. 33 Basic Blocks And Basic Sensors .............................................................................................. 34 Readings .................................................................................................................................... 36 Run Always Mode .................................................................................................................... 37 Running a Program at System Start or Shutdown ................................................................ 37 Multi-threading ......................................................................................................................... 38 2 Sutron Corporation Xpert/9210 XLite BASIC Users Manual Rev. 3.13 #8800-1151 07/2013 3 Resource Contention ............................................................................................................. 38 Yielding the CPU .................................................................................................................. 39 Thread Synchronization ........................................................................................................ 39 Web Page Creation and CGI-style forms handling................................................................... 39 Miscellaneous Statements and Functions ................................................................................. 41 Solving Problems with Basic ........................................................................................................ 43 Stage And Log Processing Example ......................................................................................... 43 SelfTimed Message Formatting Example ................................................................................. 50 Creating a new sensor from a combination of two other sensors ............................................. 51 Interacting with the user via the Graphical Display.................................................................. 52 Moving from Tiny Basic to Xpert Basic....................................................................................... 54 Overview ................................................................................................................................... 54 Scheduling a Program ............................................................................................................... 54 Detecting Initial Startup ............................................................................................................ 55 Detecting Recording Stop ......................................................................................................... 55 Program Example...................................................................................................................... 55 Time to Measure/Log ................................................................................................................ 55 Custom Hourly Averaging ........................................................................................................ 56 Custom GOES Formatting ........................................................................................................ 56 Custom Speech Modem Handling ............................................................................................ 57 Obsolete Functions.................................................................................................................... 57 Language Reference...................................................................................................................... 58 Language Reference Syntax ....................................................................................................