Schematic

MicroBasic Scripting Techniques
Advanced Digital Motor Controller User Manual 193
watchdog timeout. If a serial command is received from the serial/USB port at the same
time a command is sent from the script, both will be accepted and this can cause con-
flicts if they are both relating to the same channel. Care must be taken to keep to avoid,
for example, cases where the script commands one motor to go to a set level while a se-
rial command is received to set the motor to a different level. To avoid this problem when
using the Roborun PC utility, click on the mute button to stop commands sending from
the PC.
Script commands also share the same priority level as Serial commands. Use the Com-
mand Priority Setting (See “Command Priorities” on page 146) to set the priority of com-
mands issued from the script vs. commands received from the Pulse Inputs or Analog
Inputs.
MicroBasic Scripting Techniques
Writing scripts for the Roboteq controllers is similar to writing programs for any other
computer. Scripts can be called to run once and terminate when done. Alternatively,
scripts can be written so that they run continuously.
Single Execution Scripts
These scripts are programs that perform a number of functions and eventually terminate.
These kind of scripts can be summarized in the flow chart below. The amount of process-
ing can be simple or very complex but the script has a clear begin and end.
Processing
Start
End
FIGURE 18-1. Single execution scripts
Continuous Scripts
More often, scripts will be active permanently, reacting differently based on the status of
analog/ digital inputs, or operating parameters (Amps, Volts, Temperature, Speed, Count,
…), and continuously updating the motor power and/or digital outputs. These scripts have
a beginning but no end as they continuously loop back to the top. A typical loop construc-
tion is shown in the flow chart below.