Schematic

MicroBasic Scripting
188 Advanced Digital Motor Controller User Manual V1.8, August 28, 2017
The complete details on the language can be found in the MicroBasic Language
Reference on page 195.
Source Program and Bytecodes
Programs written in this Basic-like language are interpreted into an intermediate string of
Bytecode instructions that are then downloaded and executed in the controller. This two-
step structure ensures that only useful information is stored in the controller and results in
significantly higher performance execution over systems that interpret Basic code directly.
This structure is for the most part entirely invisible to the programmer as the source ed-
iting is the only thing that is visible on the PC, and the translation and done in the back-
ground just prior to downloading to the controller.
Depending on the product, programs can be from 8192 to 32768 Bytecodes long. This
translates to approximately 1500 to 6000 lines of MicroBasic source.
Variables Types and Storage
Scripts can store signed 32-bit integer variables and Boolean variable. Integer variables can
handle values up to +/– 2,147,483,647. Boolean variables only contain a True or False state.
The language also supports single dimensional arrays of integers and Boolean variables.
In total, up to 1024 or 4096 (depending on the product) Integer variables and up to 1024
Boolean variables can be stored in the controller. An array of n variables will take the stor-
age space of n variables.
The language only works with Integer or Boolean values. It is not possible to store or
manipulate decimal values. This constraint results in more efficient memory usage and
faster script execution. This constraint is usually not a limitation as it is generally sufficient
to work with smaller units (e.g. millivolts instead of Volts, or milliamps instead of Amps) to
achieve the same precision as when working with decimals.
The language does not support String variables and does not have string manipulation
functions. Basic string support is provided for the Print command.
Variable content after Reset
All integer variables are reset to 0 and all Boolean variables are reset to False after the
controller is powered up or reset. When using a variable for the first time in a script, its
value can be considered as 0 without the need to initialize it. Integer and Boolean vari-
ables are also reset whenever a new script is loaded.
When pausing and resuming a script, all variables keep the values they had at the time the
script was paused.
Controller Hardware Read and Write Functions
The MicroBasic scripting language includes special functions for reading and writing
configuration parameters. Most configuration parameters that can be read and changed
using the Configuration Tab in the Roborun PC utility or using the Configuration serial
commands, can be read and changed from within a script. The GetConfig and SetConfig
functions are used for this purpose.
The GetValue function is available for reading real-time operating parameters such as Ana-
log/Digital input status, Amps, Speed or Temperature.