Motion Basic Overview
Using the Motion Basic User Interface
Language Reference Subroutine & Function Reference
Motion Basic Quick Start Guide
1. What You Need
You will need the following items:
- SSA-485 Smart Serial Adapter Board
- Motion Basic Controller Chip Set (Motion Basic
Controller chip and 24LC256 EEPROM chip)
- Logic Power Supply
- USB cable (or RS232 cable)
- Motion Basic Windows User Interface Software
- PIC-SERVO board (or PIC-STEP board)
- Servo motor (or stepper motor)
- Servo motor/encoder cable (or stepper motor/encoder cable)
- Motor power supply
- 10 pin flat ribbon cable with standard IDC connectors at both ends
2. Copy Files
The Motion Basic Software is available for download from jrkerr.com/software.html. The Motion
Basic software includes the user interface application, example programs,
and documentation. Download the Motion Basic Software and unzip
the file into a single folder on your PC.
3. Plug In
- Plug the Motion Basic Controller chip into the 28 pin socket
on the SSA-485 board with pin 1 (notched end of chip) pointing
to the top of board.
- Plug 24LC256 EEPROM chip into the 8 pin socket on SSA-485
board with pin 1 (notched end of chip) pointing to the left of board.
- Set the SSA-485 jumpers:
If using Version 1 of the SSA-485 board, install jumper JP5, set
jumpers JP3 and JP4 to "SSQ", and set jumper JP8 to "USB" or
"232" as required.
If using Version 2 of the SSA-485 board, install jumper JP5, and
set jumpers JP3 and JP4 to "MB".
- Set the PIC-SERVO (or PIC-STEP)
jumpers: jumpers should be installed on JP3, JP4, JP5, JP6, and JP7.
- Connect 10 pin flat ribbon cable between JP1 of SSA-485 board
and JP2 of PIC-SERVO (or PIC-STEP)
board.
- Plug in USB cable into the USB connector on the SSA-485 board
and into your PC's USB connector. (If using RS232, plug the 9-pin RS232 cable into
the hub and into your PC's COM port.)
- Make sure the motor power supply is off, then connect the motor and motor power supply
to the PIC-SERVO (or PIC-STEP) board.
Refer to the Quick Start guide in the PIC-SERVO (or PIC-STEP)
Board Data Sheet for more information on the motor and power supply connections.
Data sheets are available for download from jrkerr.com/docs.html.
- Connect the logic power supply to the SSA-485 board and turn
the supply on. If using USB, your PC should acknowledge (pop up a message or make a
beep) when the USB device is recognized. (The USB device should be recognized
as a USB COM port.) If the USB device is not recognized, you may need to download
the appropriate driver. You can download the driver for your version of Windows
from: ftdichip.com/Drivers/VCP.htm
4. Verify / Configure your serial port
Use the Windows Control panel (Control Panel->System->Hardware->Device
Manager->Ports) to verify the status of the serial port you plan to use. (The
logic power supply to the SSA-485 board must be turned on.)
- If using a USB port, you should see listed in the ports a USB Serial port.
Double-click on this port. If the port is not listed as COM5 through COM8, click on
the Port Settings and then on Advanced button. Select a COM port number of 5 through
8.
- If you plan on using and RS232 port, you will be typically be using COM1 through
COM4. Make sure that one of these ports is listed, and that you know which one
corresponds which COM port connector (DB9 - male) on the back of your computer. Once
you have verified which port you will use, no configuration is necessary.
5. Run MotionBasic.exe
- Turn off the SSA-485 logic power supply
- Run the program MotionBasic.exe
- Turn the SSA-485 logic power supply back on. A status
window should pop up indicating a Motion Basic controller is
connected.
- Using the File menu, open the file "mbservo.mb" (for stepper motors, open the
file "mbstep.mb").
- Turn on the motor power supply.
- Click on the Run button. Your motor should rotate back & forth 3 times.
You will be asked if you want to repeat the motion.
6. Try Some Editing with the Function Assistant
- Position the cursor at the blank line after the "next" statement. Press
tab to indent.
- Right-click with the mouse anywhere in the Listing window. A window will pop up
with a list of functions and subtroutines.
- If using the example program "mbservo.mb" click on the "homing"
subroutine listed under PIC-SERVO. If using the example program
"mbstep.mb", click on the "homing" subroutine listed under PIC-STEP.
The edit window for the selected subroutine will pop up.
- Click on the options "Home on Limit 1" and "Stop smooth on home" and
then click on OK. The subroutine "homing(1,33)" will then appear in your
code.
- Now select the the entire text of "homing(1,33)" starting with the
"h" and ending with the ')'.
- Right-click anywhere in the Listing window and the edit window for the homing subroutine
will pop up. Unclick ""Stop smooth on home" and click on "Stop
abrupt on home". Click OK, and the subroutine will appear in your code with the
new parameters.
7. Try Some Debugging
- Click on the program line that says 'print "Loop count = ", I', then
click on the Break button. This sets a breakpoint at that line, and the line will be
displayed in red.
- Click on the Run button again. The motor should move back & forth once and
then stop. Notice that the value of the variable "I" in the window on the
right is now equal to 1. (If you double-click on "I", you can change its
value.)
- Try using an ACI command: In the ACI command line window at the bottom, type in the line
"1 sv?p" to query the position value of servo module address 1 (type "1
st?p" to query the position value of stepper module address 1) . Click on the
"Send ACI", or hit ENTER. The current motor position will be displayed in
the Input-Output window.
- Click on the line "Loop count =" again and click on the Break button again to
remove the breakpoint.
- Click on the Run button again to resume program execution.
8. Example Programs
After you are familiar with using Motion Basic and want to
write you own programs, see the example programs quickstart.mb, picservodemo.mb,
picstepdemo.mb, and piciodemo.mb. These programs give additional examples of how to
use Motion Basic to control the PIC-SERVO,
PIC-STEP, and PIC-IO modules.