Quick Start Guide Motion Basic Overview Using the Motion Basic User Interface Language Reference
Motion Basic Functions and Subroutines
Motion Basic includes an assortment of functions and subroutines, mostly related to operating the PIC-SERVO, the PIC-STEP and the PIC-I/O controllers. Both functions and subroutines may take a list of parameters in parentheses (e.g. homing(1, 35)). Functions, however, also return a value which can be either assigned to a variable or used in an expression. The following table summarizes each subroutine and function, and provides a link to a more detailed description.
General Purpose Functions |
|
| getchar | Returns asynchronous user input |
| geterr | Returns number of communications errors |
| getnminit | Initializes NMC network and returns number of modules found |
| getstat | Returns status byte |
| gettype | Returns module type |
| getver | Returns module version |
| peek | Returns contents of processer memory address |
| retrieve | Returns contents of Motion Basic memory address |
| testbit | Tests if specified data bit is set |
General Purpose Subroutines |
|
| nmreset | Resets all modules to their power up state |
| poke | Writes data to processor memory address |
| refresh | Refreshes module status data |
| store | Writes data to a Motion Basic memory address |
PIC-SERVO Functions |
|
| getad | Returns A/D input value |
| gethome | Returns home position |
| getpos | Returns current position |
| getsvaux | Returns auxiliary status byte |
| getsverr | Returns position error |
| getsvvel | Returns current velocity |
PIC-SERVO Subroutines |
|
| homing | Sets the homing parameters for capturing the home position |
| resetpos | Resets the position counter to 0 |
| stopmot | Used to stop a motor. Also used to enable/disable the amplifier |
| svcbits | Clears the latched status bits |
| svgain | Sets operating parameters |
| svtraj | Sets motion data for position, velocity, and PWM moves |
| waitmove | Waits until move is complete |
| PIC-STEP Functions | |
| getad | Returns the A/D input value |
| gethome | Returns home position |
| getpos | Returns the current position |
| getstin | Returns the inputs value |
| PIC-STEP Subroutines | |
| homing | Sets the homing parameters for capturing the home position |
| resetpos | Resets the position counter to 0 |
| stopmot | Used to stop a motor. Also used to enable/disable the amplifier |
| stoutput | Sets general purpose output pins and internal amplifier |
| stparam | Sets operating parameters |
| sttraj | Sets motion data for position and velocity moves |
| waitmove | Waits until move is complete |
| PIC-I/O Functions | |
| getioad | Returns the A/D input value |
| getioin | Returns the inputs value |
| gettmr | Returns timer/counter value |
| PIC-I/O Subroutines | |
| iodir | Sets direction of I/O pins |
| iooutput | Sets I/O output pin value |
| iopwm | Sets the PWM output values |
| iotimer | Sets the timer/counter mode of operation |
| getchar() # Returns asynchronous user input | ||||||||
|
||||||||
|
||||||||
|
||||||||
| geterr(reset) # Returns number of communications errors | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
| getnminit() # Initializes NMC network and returns number of modules found | ||||||||
|
||||||||
|
||||||||
|
||||||||
| getstat(addr) # Returns status byte | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| gettype(addr) # Returns the module type | ||||||||||||
|
||||||||||||
|
||||||||||||
|
||||||||||||
| getver(addr) # Returns the module version | ||||||||
|
||||||||
|
||||||||
|
||||||||
| peek(addr) # Returns contents of processor data memory | ||||||||
|
||||||||
|
||||||||
|
||||||||
| retrieve(addr) # Returns contents of Motion Basic memory address | ||||||||
|
||||||||
|
||||||||
|
||||||||
| testbit(data, bit) # Tests if specified data bit is set | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
| nmreset() # Resets all modules to their power up state | ||||
|
||||
|
||||
|
||||
| poke(addr, data) # Writes data to processor memory address | ||||||
|
||||||
|
||||||
|
||||||
| refresh(addr) # Refreshes module status data | ||||
|
||||
|
||||
|
||||
| store(addr, data) # Writes data to a Motion Basic memory address | ||||||
|
||||||
|
||||||
|
||||||
| getad(addr) # Returns A/D input value | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| gethome(addr) # Returns home position | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| getpos(addr) # Returns current position | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| getsvaux(addr) # Returns auxiliary status byte | Servo |
Step |
I/O |
||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
| getsverr(addr) # Returns position error | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| getsvvel(addr) # Returns current velocity | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| homing(addr, hmode) # Set homing parameters | Servo |
Step |
I/O |
||||||||||||||||
|
|||||||||||||||||||
|
|||||||||||||||||||
|
|||||||||||||||||||
| resetpos(addr) # Resets the position counter to 0 | Servo |
Step |
I/O |
||||
|
|||||||
|
|||||||
|
|||||||
| stopmot(addr, mode) # Stop the motor using the specified mode. Also use to enable/disable the amplifier | Servo |
Step |
I/O |
||||||||||||
|
|||||||||||||||
|
|||||||||||||||
|
|||||||||||||||
| svcbits(addr) # Clears the latched status bits | Servo |
Step |
I/O |
||||
|
|||||||
|
|||||||
|
|||||||
| svgain(addr, kp, kd, ki, il, ol, cl, el, sr, dc, sm) # Sets servo operating parameters | Servo |
Step |
I/O |
||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
| svtraj(addr, mode, pos, speed, acc, pwm) # Sets motion data for velocity, trapezoidal, and PWM moves | Servo |
Step |
I/O |
||||||||||||||||||||||
|
|||||||||||||||||||||||||
|
|||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| waitmove(addr) # Waits until move is complete | Servo |
Step |
I/O |
||||
|
|||||||
|
|||||||
|
|||||||
| getstin(addr) # Returns the inputs value | Servo |
Step |
I/O |
||||||||||||||||||||
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
| stoutput(addr, outval) # Sets general purpose output pins for configuring the amplifier | Servo |
Step |
I/O |
||||||||||
|
|||||||||||||
|
|||||||||||||
|
|||||||||||||
| stparam(addr, mode, minspeed, runcur, holdcur, thermlim) # Sets operating parameters | Servo |
Step |
I/O |
||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
| sttraj(addr, mode, pos, speed, acc) # Sets motion data for velocity and position moves | Servo |
Step |
I/O |
||||||||||||||||
|
|||||||||||||||||||
|
|||||||||||||||||||
|
|||||||||||||||||||
| getioad(addr, adnum) # Returns A/D input value | Servo |
Step |
I/O |
||||||||||
|
|||||||||||||
|
|||||||||||||
|
|||||||||||||
| getioin(addr) # Returns the inputs value | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| gettmr(addr) # Returns timer/counter value | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| iodir(addr, ionum, iodir) # Sets direction of I/O pins | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| iooutput(addr, ionum, ioval) # Sets I/O output pin value | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| iopwm(addr, pwm1, pwm2) # Sets the PWM output values | Servo |
Step |
I/O |
||||||||
|
|||||||||||
|
|||||||||||
|
|||||||||||
| iotimer(addr, mode) # Sets the timer/counter mode of operation | Servo |
Step |
I/O |
||||||||||||
|
|||||||||||||||
|
|||||||||||||||
|
|||||||||||||||