Schematic

Editing, Building, Simulating and Executing Scripts
Advanced Digital Motor Controller User Manual 191
Downloading MicroBasic Scripts to the controller
The Download to Device button will cause the MicroBasic script to be built and then trans-
ferred into the controller’s flash memory where it will remain permanently unless over-
written by a new script.
The download process requires no other particular attention. There is no warning that a
script may already be present in Flash. A progress bar will appear for the duration of the
transfer which can be from a fraction of a second to a few seconds. When the download
is completed successfully, no message is displayed, and control is returned to the editor A
downloaded script cannot be read out..
An error message will appear only if the controller is not ready to receive or if an error oc-
curred during the download phase.
Downloading a new script while a script is already running will cause the running script to
stop execution. All variables will also be cleared when a new script is downloaded. When
using multiple controllers over a CAN network with the RoboCAN protocol, it is possible
to download the script into any node. Use the Download to Device button from the
Scripting tab of the PC Utility.
In networked systems using the RoboCAN protocol, scripts can be loaded in any active
node by using the Download to Remote button in the PC utility.
Saving and Loading Scripts in Hex Format
Compiled scripts can be saved as a .hex format file from the PC Utility. The bytecodes can
then be loaded into the controller using the “Update Script” button on the Console tab.
Using this technique is a good way of keeping the source code secret and/or safe while
allowing field updates.
The bytecodes in the .hex file can also be loaded in the controller by any microcomputer
using the following sequence:
Send the string:
%sld 321654987
the controller will reply with
HLD
to indicate it is waiting for data
then send the hex file, one line at a time. At the end of each line received, the controller
will send a +
Beware that if no data is received for more than 1s, the controller will exit the HLD mode.
Executing MicroBasic Scripts
Once stored in the Controller’s Flash memory, scripts can be executed either “Manually”
or automatically every time the controller is started.