Data Sheet

Script Structure and Possibilities
Advanced Digital Motor Controller User Manual 187
SECTION 18
MicroBasic
Scripting
One of the Roboteq products’ most powerful and innovative features is their ability for the
user to write programs that are permanently saved into, and run from the device’s Flash
Memory. This capability is the equivalent, for example, of combining the motor controller
functionality and this of a PLC or Single Board Computer directly into the controller. Script
can be simple or elaborate, and can be used for various purposes:
Complex sequences:
MicroBasic Scripts can be written to chain motion sequences based on the status
of analog/digital inputs, motor position, or other measured parameters. For exam-
ple, motors can be made to move to different count values based on the status of
pushbuttons and the reaching of switches on the path.
Adapt parameters at runtime
MicroBasic Scripts can read and write most of the controller’s configuration set-
tings at runtime. For example, the Amps limit can be made to change during opera-
tion based on the measured heatsink temperature.
Create new functions
Scripting can be used for adding functions or operating modes that may be needed
for a given application. For example, a script can compute the motor power by mul-
tiplying the measured Amps by the measured battery Voltage, and regularly send
the result via the serial port for Telemetry purposes.
Autonomous operation
MicroBasic Scripts can be written to perform fully autonomous operations. For ex-
ample the complete functionality of a line following robot can easily be written and
fitted into the controller.
Script Structure and Possibilities
Scripts are written in a Basic-Like computer language. Because of its literal syntax that is
very close to the every-day written English, this language is very easy to learn and simple
scripts can be written in minutes. The MicroBasic scripting language also includes support
for structured programming, allowing fairly sophisticated programs to be written. Several
shortcuts borrowed from the C-language (++, +=, …) are also included in the scripting lan-
guage and may be optionally used to write shorter programs.