Quick Start Guide    Using the Motion Basic User Interface     Language Reference      Subroutine & Function Reference

Motion Basic Overview

Our NMC controller modules, the PIC-SERVO, PIC-STEP and PIC-I/O, accept commands over a serial port from a host computer which controls the sequence of actions.  The host can be a PC, an embedded controller (for stand-alone systems), or almost any other type of computer system.   Motion Basic is a stand-alone host controller and is one of the easiest ways to creating a control programs for your NMC control modules.

What is Motion Basic?
Motion Basic is a programming language embedded in a microcontroller chip (a PIC18F2610) which allows you to create stand-alone control systems for NMC based controllers: the PIC-SERVO , PIC-STEP and PIC-I/O.  The Motion Basic chip, along with a serial EEPROM chip, plug into sockets on the SSA-485 serial port converter board.  Using our Windows based Motion Basic User Interface, you can create Motion Basic programs, download them and debug them.  Once satisfied with your program, it will run automatically on power-up to create a stand-alone control system.  (Click here to view an example Motion Basic program.)

    mbmode.gif (3194 bytes)

What is the ACI Mode?
ACI stands for ASCII Command Interface.  It is included in the Motion Basic controller chip and is an alternate way of sending commands to NMC controllers.  The PIC-SERVO, PIC-STEP and PIC-I/O controllers normally communicate over a serial port with a host computer using a very efficient binary commands, but binary communications can be more complicated to use.  The ACI mode provides you with a set of simple ASCII commands you can send to the controllers using a terminal program or other computer program.   (Click here to view  examples of ACI commands.) 

     acimode.gif (3297 bytes)

ACI commands are not part of the Motion Basic language, but the Windows Motion Basic User Interface gives you access to ACI commands, making program development and working with your hardware easier.   Complete documentation for the ACI mode can be in aci_manual.pdf.

What are the capabilities of Motion Basic?
Motion Basic is very easy to use, but it has limits to its capabilities.  Complex applications involving critical timing, a high degree of coordination, or large amounts of data are not suitable for implementation in Motion Basic.  These applications should be implemented using a PC or other type of host computer.  However, the vast majority of applications requiring simple sequences of motions, basic branching and basic computations can be implemented very quickly and easily.  Here is a summary of Motion Basic's attributes:

An Example Motion Basic Program
The following program moves a servo motor to a position of 5000 encoder counts and then back to zero three times.  It illustrates servo controller function calls, for/next looping, if/then statements, and user input from the serial port. 

    #example Motion Basic Program

    N = getnminit()                             #Initialize controller modules
    print "Number of NMC controllers:", N
    svgain(1,100,1000,0,0,255,0,2000,1,1,1)    #Set servo gain parameters
    stopmot(1, 5)                               #Use stop motor to enable servo

10  for I=1 to 3                               #FOR loops code block 3 times
        svtraj(1,151,5000,100000,100,0)        #Move to position 5000
        waitmove(1)                            #Wait till move finished
        svtraj(1,151,0,100000,100,0)           #Move back to 0
        waitmove(1)
        print "Loop count = ", I
    next

    input "Repeat sequence (0=no, 1=yes)?", A  #Get data from user
    if A=1 goto 10                             #Jump to line 100 to repeat

    end

Note that program comments are marked with a '#' symbol.  Also note that not every line is required a label.  Motion Basic is not case sensitive, so you can use upper or lower case letters, whichever you find more readable.  A complete description of the Motion Basic language can be found in the Motion Basic Language Reference, and details of the motion controller functions can be found in the Motion Basic Function Reference.

An Example of Using ACI Commands
In the program example above, you may decide that after one back and forth motion, you need to halt the motion and reposition the motor.  This is easy to do without having to completely restart your program:

First, use the STOP button in the User Interface program to halt the execution of your program.  You can then use the servo motor off ACI command ("svof") to disable the servo for manual repositioning:

    1 svof

After repositioning the motor by hand, you can re-enable the servo using the servo stop motor command ("svst"):

    1 svst

Finally, you can reset the motor's position counter to zero using the servo zero position command ("svzp"):

    1 svzp

Alternately, if you knew you needed to move the motor's position to 6000, you could use the servo move position command ("svmp"):

    1 svmp 6000

Finally, the servo query position command ("sv?p") can be used to read the current motor position:

    1 sv?p
    :5992

The number '1' that begins each command in the examples is the address of the servo module being commanded.  The Motion Basic chip supports up to 8 modules, so the address value can be 1 through 8.

Note that as you enter ACI commands in the Motion Basic User Interface, the commands are echoed in Input/Output window, along with any data returned from query-type commands.  Complete documentation for the ACI commands mode can be in aci_manual.pdf.