Schematic

MicroBasic Scripting
192 Advanced Digital Motor Controller User Manual V1.8, August 28, 2017
Manual launch is done by sending commands via the Serial or USB port. When connected
to the PC running the PC utility, the launch command can be entered from the Console
tab. The commands for running as stopping scripts are:
!r : Start or Resume Script
!r 0: Pause Script execution
!r 1: Resume Script from pause point. All integer and Boolean variables have val-
ues they had at the time the script was paused.
!r 2: Restarts Script from start. Set all integer variables to 0, sets all Boolean vari-
ables to False. Clears and stops the 4 timers.
On CAN networks running the RoboCAN protocol, a script on a remote node can be
launched or stopped by using the above commands with the RoboCAN prefix. For example
@06!r : Start or Resume Script on device at RoboCAN node 6
If the controller is connected to a microcomputer, it is best to have the microcomputer
start script execution by sending the !r command via the serial port or USB.
Scripts can be launched automatically after controller power up or after reset by setting
the Auto Script configuration to Enable in the controller configuration memory. When en-
abled, if a script is detected in Flash memory after reset, script execution will be enabled
and the script will run as when the !r command is manually entered. Once running, scripts
can be paused and resumed using the commands above.
Important Warning
Prior to set a script to run automatically at start-up, make sure that your script will
not include errors that can make the controller processor crash. Once set to auto-
matically start, a script will always start running shortly after power up. If a script
contains code that causes system crash, the controller will never reach a state
where it will be possible to communicate with it to stop the script and/or load a
new one. If this ever happens, the only possible recovery is to connect the controller
to a PC via the serial port and run a terminal emulation software. Immediately after
receiving the Firmware ID, type and send !r 0 to stop the script before it is actually
launched. Alternatively, you may reload the controller’s firmware.
Debugging Microbasic Scripts
While running a script with the source code visible in the Scripting tab, it is possible to
view the state of all variable in real time. Click on the “Inspect Variable” buttons and over
the variable in the source code. The variable value will appear near the mouse. To see
changes to the variable, move the mouse away and then back on the variable.
Using print statements in questionable parts of the code is also a very effective debug
tool. Run script from the console in order to be able to view the script output.
Script Command Priorities
When sending a Motor or Digital Output command from the script, it will be interpreted
by the controller the same way as a serial command (RS232 or USB). This means that the
RS232 watchdog timer will trigger in if no commands are sent from the script within the