Quick Start Guide Motion Basic Overview Language Reference Subroutine & Function Reference
Using the Motion Basic User Interface (MotionBasic.exe)
User Interface Description
Menu Bar
Buttons
Program Running Light
Serial Communications
Listing Window
Variables Window
Input-Output Window
ACI Command Window
File Status Bar
Function Assistant
Add Function/Subroutine
Edit Function/Subroutine
User Interface Functions
Running a Program
Stopping a Program
Single Step a Program
Setting/Clearing a Breakpoint
Setting a Variable
Resetting a Motion Basic
Program
Sending a Character to Motion
Basic
Erase a Motion Basic Program
Upload a Motion Basic Program
Select Com Port
Clear Input-Output
Set the Motion Basic Startup
Time
Download Program
Send an ACI Command
User Interface Description
The Motion Basic User Interface is used for developing Motion
Basic programs. Users can create and edit Motion Basic
programs, download and upload programs to the SSA-485
Board, debug programs using breakpoints and single step commands, and save the programs to
a file.

Menu Bar
The menu bar at the top of the User Interface consists of the File, Edit, Debugger and
Help Menus.
File Menu |
|
| New | Create a new Motion Basic program |
| Open | Open an existing Motion Basic program |
| Save | Save a Motion Basic program |
| Save As | Save the Motion Basic program with a different name |
| Exit | Exit Motion Basic |
| Print the currently displayed Motion Basic program | |
Edit Menu |
|
| Cut | Cut text (Ctrl+X) |
| Copy | Copy text (Ctrl+C) |
| Paste | Paste text (Ctrl+V) |
| Find | Find text (Ctrl+F) |
Debugger Menu |
|
| Select Com Port | Select communications port (COM1 - COM8) |
| Download | Download Motion Basic program to Motion Basic controller |
| Run | Run Motion Basic program |
| Single Step | Single Step Motion Basic program |
| Stop | Stop Motion Basic program |
| Reset | Reset Motion Basic program |
| Set/Clear Breakpoint | Set or clear a breakpoint |
| Set Variable | Set the value of variable A-Z |
| Send Character | Send an asynchronous character to Motion Basic |
| Clear Window | Clear Motion Basic program from listing window |
| Upload | Upload Motion Basic program from Motion Basic controller |
| Startup Time | Set the Motion Basic start-up delay time (1 - 7 seconds) |
| Erase Memory | Erase the Motion Basic program from the Motion Basic controller |
Help Menu |
|
| Quick Start Guide | Motion Basic Quick Start Guide |
| Language Reference | Motion Basic Language Reference |
| Command Reference | Motion Basic Subroutine and Function Reference |
| User Interface | User Interface Guide (this document) |
| ACI Command Reference | ACI Command Reference |
| About | About Motion Basic (Version Number) |
Buttons
Buttons provide quick access to the most common User Interface functions. The buttons are
context sensitive, and are highlighted only when they are activated for use. For
example, at start up the debugging buttons (run, stop, single...) are not activated until
serial communications is established with the SSA-485
board. Active buttons contain a help message which is displayed by placing the mouse
prompt over the button.
User Interface Buttons |
|
| Run | Run the Motion Basic program |
| Single | Single Step teh Motion Basic program |
| Stop | Stop the Motion Basic program |
| Reset | Reset the Motion Basic program |
| Break | Set or clear a breakpoint |
| Send | Send an asynchronous character to the Motion Basic controller |
| Erase | Erase the Motion Basic program in the Motion Basic controller |
| Select Port | Select communications port (COM1 - COM8) |
| Clear Input-Output | Clear the Input-Ouput screen |
| Send ACI | Send an ACI command |
Program Running Light
The Program Running Light is green when the program is running, and grey when the program
is stopped. The Program Running Light will turn green when the user presses the Run
Button, and remains green until the program is either stopped by the Stop Button, a
breakpoint, or a program error. The Program Running light will also briefly turn
green while it runs a single program line after the user presses the Single Step Button.
Serial Communications
The Motion Basic User Interface communicates with the Motion
Basic controller using the RS232 or USB serial port. Communications ports
COM1-COM8 are supported and may be selected using either the Select Port Button or the
Select Port item in the Debugger Menu. The default Motion Basic
communications port is COM1. When users select a different communications port, the
new port is saved and becomes the new default port.
Listing Window
The Listing Window is used to display and edit Motion Basic
programs. Users may cut, copy, and paste program text to this window. The
window is 80 characters wide, which is the maximum number of characters allowed on a line
in Motion Basic.
The Listing Window uses colors to highlight information. Breakpoint lines are hightlighted in red, and the current line being executed is highlighted in blue (or purple if the current line is also a breakpoint line).
Variables Window
The Variables Window is used to display and edit the value of the 26 Motion
Basic variables A-Z. The Variables Window is updated with the current
value of the variables whenever a Motion Basic program stops -
for example after a single step, a breakpoint is hit, or the user stops the
program. Note that the Variables Window is not updated with the latest
variable values while Motion Basic is running.
Users may set the value of variables A-Z by double clicking on the variable in the Variables Window. A dialog box will appear prompting the user to enter the new value of the variable. Note that variables are initialized to 0 whenever a Motion Basic program starts or is reset.
Input-Output Window
The Input-Output Window displays Motion Basic output from print
messages, and debugging information such as program errors. The window displays the
last 100 lines of output information. The Input-Output Window is be cleared by
pressing the Clear Input-Output button.
There are two types of Motion Basic program inputs: inputs initiated by a Motion Basic "input" command (for example, "input "Enter the value of A", A), and asynchronous user inputs. When a Motion Basic program is running and comes to an "input" statement, the User Interface will display a Dialog Box promping for user input. The Dialog Box will display the input text from the "input" command (for example, "Enter the value of A"). After the input is complete, the Input-Output window diplays the input prompt and input value entered by the user.
Users may also asynchronously send a character to a Motion Basic program at any time while the program is running by pressing the "Send" Button, or by selecting "Send Character" from the Debugger Menu. A Dialog Box will appear prompting the user to enter the character to send. This type of user input is used when the Motion Basic program contains the "getchar" function which returns the last character read by Motion Basic. This function is used to make a Motion Basic program branch based on user input, for example, using the 'q' key to quit a Motion Basic program.
ACI Command Window
Users can send ACI commands to PIC-SERVO, PIC-STEP,
and PIC-I/O modules using the ACI Command Window. ACI
commands are entered into the window and sent either by hitting the return key or pressing
the Send ACI Button. ACI commands can be helpful in debugging systems because they
allow the user to send and retreive information directly to the servo, stepper, and I/O
modules. See the ACI Command documentation for more
information.
The Function Assistant lets users add Motion Basic functions and subroutines to their program by simply selecting from a list of functions/subroutines and then filling in the parameter values in a pop-up form. Existing functions/subroutines can also be edited using the same forms. Each function/subroutine and its parameters are fully described in the edit form for quick reference.
Add Function/Subroutine
To add a new function or subroutine, first position the cursor in your program at the
location you would like to add the function or subroutine. Then right-click with the
mouse anywhere in the program Listing window. Function Assistant Menu will
display:

Click on the desired function/subroutine from the Function Assistant Menu. Edit the function parameters in the Function Assistant Edit Window, then press the OK Button. The new function will be written to the Motion Basic Listing Window. Note that the parameters entered can be numeric values, variables, or complex expressions.
Some functions and subroutines have a "mode" parameter which is actually a collection of individual bits packed into a single 1-byte parameter. For these types of parameters, the Function Assistant provides 8 individual bit-field check boxes (with descriptions) and automatically calculates the proper 8-bit value.

Edit Function/Subroutine
To edit an existing function or subroutine, highlight the complete function/subroutine
beginning with the first letter of the function name and including the final closing
parentheses. Then right-click the mouse anywhere in the Listing window.
The parameters from the selected function/subroutine will be displayed in the Function
Assistant Edit Window. Edit the functions parameters, then select OK. The new
function parameters will overwrite the old parameters.
back to top
Running a Program
To run the Motion Basic program displayed in the Listing
Window, click on the Run Button or select Run from the Debugger Menu. The Motion
Basic program will start running from the current program line (indicated in
blue), and the Program Running Light will change from grey to green. The program
will continue running until the Stop Button is pressed, a break point is hit, or if there
is a program error. Note that if the Motion Basic program
is new or has been changed, the program will be automatically downloaded to the Motion
Basic controller before it starts to run.
Stopping a Program
To stop a Motion Basic program, click on the Stop Button or
select Stop from the Debugger Menu. The Motion Basic
program will stop and the Program Running Light will change from green to grey.
After the program is stopped, the cursor will be at the current Motion Basic
execution line and the line will be highlighted in blue.
Single Step a Program
Click on the Single Button or select Single Step from the Debugger Menu to single step a Motion
Basic program. Single Step will run the current line of Motion
Basic code (indicated with a blue font) then stop. Single stepping is
useful when debugging a Motion Basic program.
back to top
Setting/Clearing a Breakpoint
To set a program breakpoint, place the mouse cursor on a line then click on the Break
Button or select Set/Clear Breakpoint from the Debugger Menu. The line will turn red
indicating that it is a breakpoint line. When debugging a Motion Basic
program, set a breakpoint when you want Motion Basic to stop on
a particular line. To clear a breakpoint, place the mouse cursor on the line and click the
Break button. Motion Basic allows up to 3 breakpoints to be set at at time.
Setting a Variable
Double click on a variable in the Varibles Window or select Set Variable from the Debugger
Menu to set one of the 26 Motion Basic variables (A-Z). A
dialog box will prompt you to enter the new value of the variable.
Resetting a Motion Basic
Program
To reset a Motion Basic program, click on the Reset Button or
select Reset from the Debugger Menu. Resetting a Motion Basic
program clears the 26 Motion Basic variables (A-Z) to 0, and
resets the program so that it starts executing from the first line the next time it is
run.
Sending a Character to Motion
Basic
Click on the Send Button or select Send Character from the Debugger Menu to send a
character to a Motion Basic program. A Dialog Box will
appear prompting the user to enter the character to send. This type of user input
is used when the Motion Basic program contains the
"getchar" function which returns the last character read by Motion
Basic. This function is used to make a Motion Basic
program branch based on user input, for example, using the 'q' key to quit a Motion
Basic program.
Erase a Motion Basic
Program
Click on the Erase Button or select Erase Memory from the Debugger to erase the Motion
Basic program. This will erase the Motion Basic
program and data from EEPROM.
back to top
Upload a Motion Basic
Program
Select Upload from the Debugger Menu to read the Motion Basic
program stored in EEPROM and display it on the Program Listing Screen. This function
is useful when you want to view the program that is stored in Motion Basic
EEPROM.
Select Com Port
The Motion Basic User Interface communicates with the Motion
Basic controller using the RS232 or USB serial port. The default Motion
Basic communications port is COM1. Click on the Select Port Button or
the Select Com Port from the Debugger Menu to change the serial
port to COM1-COM8. When users select a new communications port, the port is saved
and becomes the new default port.
Clear Input-Output
Click on the Clear Input-Output Button or select Clear Window from the Debugger Menu to
clear the Input-Output Window.
Set the Motion Basic
Startup Time
Select Startup Time from the Debugger Menu to set the Motion Basic
startup time. The startup time is the time Motion Basic
will delay after power-on before beginning to run the Motion Basic
program stored in EEPROM. When operating in stand-alone mode (no Motion
Basic User Interface), the startup time should normally be set to the
minimum time so that the Motion Basic program starts right
away. When using the Motion Basic User Interface
(particularly when using USB), a startup time of about 7 seconds should be used to allow
Windows and the User Interface program enough time to connect to Motion Basic.
Download Program
Select Download from the Debugger Menu to download the Motion Basic
program from the Program Listing Screen to EEPROM. Note that manual downloading in
this manner is not normally required because Motion Basic
programs are automatically downloaded when Run Button or Run Menu item is selected.
Send an ACI Command
Users can send ACI commands to PIC-SERVO, PIC-STEP,
and PIC-I/O modules using the ACI Command Window. ACI
commands are entered into the window and sent either by hitting the return key or pressing
the Send ACI Button. ACI commands can be helpful in debugging systems because they
allow the user to send and retreive information directly to the PIC-SERVO,
PIC-STEP, and PIC-IO modules ouside of
the operation of the Motion Basic program. See the ACI command documentation for more information.
back to top