Data Sheet
MicroBasic Scripting
198 Advanced Digital Motor Controller User Manual V1.8, August 28, 2017
Label names are case insensitive that is PrintLabel is identical to printLabel.
The scope of a label extends whole the program. Labels cannot be declared more than
once in the program.
Variables
Micro Basic contains only two types of variable (Integer and Boolean) in addition to
arrays of these types. Boolean and arrays must be declared before use, but Integer vari-
ables may not be declared unless you use the Option Explicit compiler directive.
Option Explicit
Variables can be declared using DIM keyword (see Dim (Variable Declaration) on
page 200).
Variable name should start with alphabetical character and followed by zero or more alpha-
numeric characters or underscore. Variable names cannot start with underscore. Variable
names cannot match any of Micro Basic reserved words.
Variable names are case insensitive, that is VAR is identical to var.
The scope of a variable extends whole the program. Variables cannot be declared more
than once in the program.
Arrays
Arrays is special variables that holds a set of values of the variable type. Arrays are de-
clared using DIM command (see Dim (Variable Declaration) on page 200).
To access specific element in the array you can use the indexer [] (square brackets). Arrays
indices are zero based, so index of 5 refer to the 6th element of the array.
arr[0] = 10 ‘Set the value of the rst element in the array to 10.
a = arr[5] ‘Store the 6th element of the array into variable a.
Terminology
In the following sections we will introduce Micro Basic commands and how it is used, and
here is the list of terminology used in the following sections:
• Micro Basic commands and functions will be marked in blue and cyan respectively.
• Anything enclosed in < > is mandatory and must be supplied.
• Anything enclosed in [ ] is optional, except for arrays where the square brackets is
used as indexers.
• Anything enclosed in { } and separated by | characters are multi choice options.
• Any items followed by an ellipsis, ... , may be repeated any number of times.
• Any punctuation and symbols, except those above, are part of the structure and
must be included.
var is any valid variable name including arrays.
arr is any valid array name.
expression is any expression returning a result.