`Motion Controller
`C Program111ing GuidE
`
`Version 1.3 ·May, 1992
`
`U27
`
`U7
`
`U12
`
`U26
`
`)
`
`U23
`
`ui 2 Motion Engineering, Inc.
`520 East Montecito Street •Santa Barbara, CA 93103 • (805) 962-5409/Fax: (805) 962-8001
`
`RA v. AMS
`Ex. 1025
`
`Page 1 of 55
`
`
`
`1.0 INTRODUCTION
`
`1.1 Customer Support
`
`Motion Engineering takes customer service seriously: We want your system to world Our staff of applications
`engineers are knowledgeable and dedicated to answering any questions you may have in getting your system
`up and running. Please feel free to call - we only ask that you take the time to read the Installation and
`Programming manuals to make sure that information in the manual has not been overiooked.
`
`. !-
`
`1.2 Software Updates
`
`The PC/DSP software is being continuously upgraded by Motion Engineering. New features are being
`implemented, performance enhanced and new applications being developed every month. Contact us for the
`latest software release or list of new features.
`
`The PC/DSP board has non-volatile memory space to store configuration and tuning parameters for each axis.
`Future versions of the SETUP program will give users the ability to store the tuning and axis parameters.
`Users may set the configuration and tuning parameters in their programs, however, with
`the functions
`included in the library.
`
`Note that all "firmware" can be downloaded to the board from disk; hence, the PC/DSP can be easily upgraded.
`Upcoming features include on-board storage of configuration and tuning parameters; continuous motion
`graphic tuning; S-curve acceleration; and support for absolute encoders and resolvers. Corttact Motion
`Engineering for details ...
`
`1.3 Design Summary
`
`The PC/DSP utilizes the Analog Devices ADSP-2105 IC for on-board computing power. The DSP handles all
`servo loop calculations for up to 8 axes in addition to coordinating 1/0 functions. A block diagram of the
`internal architecture follows:
`·
`
`Page· 1
`
`RA v. AMS
`Ex. 1025
`
`Page 2 of 55
`
`Page 2 of 55
`
`
`
`.._
`
`..... · - - ·
`
`-
`
`... ,.., •••••• , · · - - · ........... _ . , .......... ""-"I;.. •••• .,, .. - . -
`
`•'G• ........... t 1,4
`
`.___,,.__Hos_t
`
`PC -----1/:i
`r1Memo~1~
`~ 16 bit O/A
`L:.=:J .
`88
`-fr t-
`
`,
`
`'
`
`;,~~~~s
`
`0-7
`
`Step/01rect ion
`Signals
`0-7
`
`Encoder
`Input
`0-7
`
`Encoder
`Feedback
`
`Joystrcl:
`
`The PC/DSP design allows the PC CPU to directly access the
`DSP, memory, and 110 registers .
`
`. The PC/DSP uses a unique architecture to provide advanced capabilities without excessive complexity. If you
`are familiar with other board-level motion controllers, please pay particular attention to the sections describing
`open architecture and the programming libraries.
`
`HARDWARE FEATURES
`
`* Control up to 8 axes per board
`* One card can control any of the following motor types with no software changes:
`- Brush Servo
`- Brushless Servo
`- Open-loop Stepper
`- Closed-loop Stepper
`... Up to 56 bits of user VO are available with headers conforming to Opto-22 standards
`* Servo output:+/- 10 v analog, 16 bit resolution
`* Stepper output: Step/direction to 4.0 MHz with up to 2 PPS velocity resolution over the entire range
`" 6.7 MHz encoder inputs
`* 8 Analog input channels
`" Multiple boards can be installed 1n a single PC
`* Stand-alone control via optional RS-232 packaging
`
`Page-2
`
`RA v. AMS
`Ex. 1025
`
`Page 3 of 55
`
`Page 3 of 55
`
`
`
`SOFTWARE FEATURES
`2nd Order filter with velocity feed-forward and acceleration feed-forward
`" Linear or $-curve acceleration
`* Continuous contouring with unlimited number of vectors - motion can be reversed on-path
`* Change acceleration. velocity, filter parameters on-the-fly
`* Open software architecture: Path generation performed in the PC CPU with C and BASIC function libraries
`(including sources)
`* 48 bit actual position register, 32 bit velocity, acceleration, and jerk registers,
`* Dual-loop control with user-defined algorithms
`* User-definable home and limit switch polarity and actions
`* Programmable software limits for position, velocity, acceleration, position error and torque
`
`1-
`
`" 40 MHz DSP on-board
`* Loop update rate: 4.0 kHz (4 Axes), 2.0 kHz (8 axes)
`* Fast data transfer to PC through dual-ported (shared) memory
`" Latch positions on-the-fly in under 1 usec
`
`SPEED AND PRECISION
`
`Page-3
`
`RA v. AMS
`Ex. 1025
`
`Page 4 of 55
`
`Page 4 of 55
`
`
`
`1.4 Open Architecture
`
`Open architecture takes full advantage of the power, memory and peripherals available with the modem PC.
`Open architecture puts more functionality into the PC and standard programming languages such as c,
`PASCAL or QuickBASIC.
`
`Users are no longer restricted by firmware commands stored in EPROM. Applications are no longer hindered by
`slow internal ASCII communications.
`
`User programs running in the host CPU directly access 1/0 mappec -egisters which control and monitor the
`motion of each axis. The PC/DSP chip constantly polls the PC memory for new instructions. Detailed
`position and other commands (110 status, etc.) are buffered on-board or executed immediately.
`
`With open architecture, users can:
`
`* Write all application software with their familiar development tools under PC-DOS
`* Create special functions using DOS-based programming
`* Execute continuous path lengths of essentially unlimited length, not limited by board memory
`.. Tightly integrate motion with other events controlled or monitored by PC peripherals
`
`plus many other functions or applications simply not possible with other controllers.
`
`1.5 The SETUP Program
`
`The PC/OSP is provided with an extremely powerful setup program which allows users to configure and tune the
`controller. A typical SETUP .EXE screen follows:
`
`A Typical SETUP .EXE Screen Showing Tuning Parameters,
`Status of Axis and Motion Commands for One Axis
`
`Page· 4
`
`RA v. AMS
`Ex. 1025
`
`Page 5 of 55
`
`Page 5 of 55
`
`
`
`1.6 PID Control Algorithm
`
`The PC-DSP controller uses a PIO servo control algorithm based on the current position error. The controller
`records the actual position and the command position. The difference between these is the position
`error. The analog motor control voltage output from the controller is calculated by the following (simplified)
`formula:
`
`-1--
`
`error sum = error sum + error
`o(t) =-
`(P • error)
`.
`+(I• error_sum)
`+- (D 0 (error(t) - error(t-1 )))
`+OFFSET
`+ (VEL_FF • velocity)
`+ (ACCEL_FF • ac~leration)
`
`The above formula demonstrates that position error is the basis for changes in control voltage. To reviey.r how
`each element of the PIO algorithm affects motion; and how to utilize VEL_FF and ACCEL_FF, consult the
`PC/DSP Installation Manual.
`
`Note that the PC/DSP generates it's own error signal internally when configured for open-loop steppers.
`
`Page- 5
`
`RA v. AMS
`Ex. 1025
`
`Page 6 of 55
`
`Page 6 of 55
`
`
`
`• -·->...>• ~·~ ,,,............v.-....... Vf1i;vuc:1 - ....., ,-1~1a.ll1it1111~ 1v1a11uca1 - ""uµy11gnL, 1:;,::::."'-. Mouon t:ng1neer1ng, inc. - vers;on 1.2
`
`2 .. 0 PROGRAMMING THE PC/DSP CONTROLLER
`
`2.1 Programming Methods: Function-based vs. Command-based
`
`for high(cid:173)
`tremendous advantages
`The PC/DSP uses "function-based" based programming, which has
`perfonnance motion control.Many users may be more familiar with traditional "command-based" controllers
`which use on-board command
`interpreters and ASCII-like communications. While command-based
`controllers are simple to program, their flexibility is very limited and their response time slow.
`
`2.1.1 Command-based Programming
`
`To draw a 100-count box, a command-based program might appear as:
`
`AC10
`VE50
`PA 0, 100
`PA1,100
`PAO,O
`PA 1, 0
`
`2.1.2 Function-based Programming
`
`The PC-DSP controller is programmed by calling functions written in standard C. For example, this function,
`using axes 0 and 1, creates motion that may draw a 1 CO-encoder count length box:
`
`void mainO
`{
`
`int e;
`
`r store the return code • /
`e = dsp_init(PCOSP _BASE); r software initialization •t
`
`if(! e)
`{ move(O, 100, 50, 1 O);
`move(1, 100, 50, 1 O);
`move(O, 0, 50, 1 O);
`move{1, 0, 50, 1 O);
`
`r max. veJ=50 ctslse<;_ ·1
`r accel = 1 o cts/(sec"} •t
`r go back to O counts ·1
`
`However. the power of a language like c becomes quickly apparent. The following example displays actual
`position during a move:
`
`void mainO
`{
`int e;
`e = dsp_init(PCDSP _BASE);
`
`if(! e)
`r move to 1000
`{
`start_move(O, 1000, 100, 500);
`counts, vel = 100, accel = 500 ·1
`start_move(O, -4000, 300, 1000);
`while (laxis_done{O) &&
`laxis_done(1))
`plintf(" Axis O: %If, Axis 1: %1f'l". get_positioo(O), get_position(1 ));
`
`Using C does not limit you to only displaying your position. You can perform just about any function within the
`loop waiting for these axes to finish. This flexibility is rarely trivial in most interpreted motion control
`environments.
`
`Page-6
`
`RA v. AMS
`Ex. 1025
`
`Page 7 of 55
`
`Page 7 of 55
`
`
`
`3.0 LIST OF FUNCTIONS
`
`Initialization and Limits*
`
`Set Hardware Address
`Reset
`Digital filter
`Position limits
`Velocity limit
`Acceleration limit
`Error limit
`Limit switches
`Home switch
`Amp fault
`In position tolerance
`Set/get unit scaling factors
`
`dsp_init(address)
`dsp_resetO
`set_filter, get_filter(axis,coeffs)
`set_pos_limit, get_pos_limit(axis,lo,high,action)
`set_ vel_limit. get_ vel_limit(axis,limit,action),
`set_accel_limit, get_accel_limit(axis,limit,action)
`set_error_limit, get_error_limit(axis,limit,action)
`set_limit_action, get_limit_action(axis,action 1)
`set home action, get home action(axis,action)
`set=amp_fault_action:- get_amp_fault_action(axis,action)
`set_in_position, get_in_position(axis,limit)
`set_conversion, get_conversion(axis,pos_scale,time_scale)
`
`·Initialization data is normally entered using the setup and exercise program. The ·action· parameters can specify controller off; fast (emergency)
`stop, slow (normal) stop, or ignore limit.
`
`Velocity Mode
`
`Run at constant speed
`
`set_velocity(axis, vel, accel)
`
`Single A.xis Motions
`
`"Get current position
`Set current position
`Set command position
`Get command position
`Move to home sensor
`Wait for home sensor
`Move to point
`Start motion
`Wait ·for motion to complete
`Get current error
`
`get_position(axis,pos)
`set_position(axis, pas)
`set_ command(axes,pos)
`get_command(axes,pos)
`goto_home(axis, vel,accel)
`wait_for_home(axis, vel,accel)
`move(axis,pos, vel,accel)
`start move(axis,pos. vel,accel)
`wait]or_done(axis)
`get_error(axis,pos)
`
`Multi-Axis Point-to-Point Motions
`
`Move an Axis Group
`Start a Group Move
`Wait for Motion to Complete
`
`Coordinated Motion
`
`move_all(number,axis_list,pos_list,vel_list,accel_list)
`start_move_all(number,axis_list,pos_list,vel_list,accel_list)
`wait_for-'-all(number,axis_list)
`
`Start a list of points
`Add a point to list
`Add an arc segment
`End a list of points
`Start path motion
`Stop path motion
`Resume path motion
`
`start_point_list(max,first_point)
`add_point(point)
`add_arc(center,arc,division)
`end_point_listO
`start_motion(repeat_count,direction)
`stop_motionO;
`resume_motion(direction)
`
`Master/Slave and Electronic Gearing
`Link axis
`
`Set_link(mast._axis, slave_axis, ratio)
`
`Jogging
`
`Set jog Maximum Velocity
`Set Jog Acceleration
`Set Number of Axes Jogged
`
`set_jog_max_ velocity(velocity)
`set_jog_acceleration(accel)
`set_jog_axes(axes)
`
`Page- 7
`
`RA v. AMS
`Ex. 1025
`
`Page 8 of 55
`
`Page 8 of 55
`
`
`
`'.o) · · - · · - - · . --r-J··o··~· · - - -.......... - .. -•·::;,o .. ,\;;;.:;. .... ::;, • ........ -
`
`.i;;. ............
`
`,,..,_
`
`1/0 Control
`
`Set Jog Keys
`
`set_jog_keys(axis, keys)
`
`Initialize 110 ports
`Set Output bits
`Read Output bits
`Read Input bits
`Read Analog Input
`Set DIA output
`
`init_io(port,io)
`set_output(port, value)
`get_output(pdrt, value)
`get_input(port, value)
`get_analog(channel);
`set_output(axis,value)
`
`Controller Status
`
`Get controller status
`Clear Status
`In Motion
`End Motion
`Stop Motion
`In Position
`In Sequence
`Emergency Stop
`Idle Mode
`Run Mode
`
`Sense Switch State
`
`Home Switch
`Positive Limit Switch
`Negative Limit Switch
`Amp Fault Switch
`
`dsp_status(axis)
`clear_status(axis)
`in_motion(axis)
`axis_ done( axis)
`set_ stop( axis)
`in_position(axis)
`in_sequence(axis)
`set_e_stop(axis)
`controller_idle(axis)
`controller_run(axis)
`
`home switch(axis)
`pos_switch(axis)
`neg_ switch( axis)
`amp_fault_switch(axis)
`
`Page-8
`
`RA v. AMS
`Ex. 1025
`
`Page 9 of 55
`
`Page 9 of 55
`
`
`
`3.1 Path Geometry
`
`A motion path is described by a list of points which describe all of the turning points during motion. These points
`are stored in a list and loaded into the controller as the motion is executed. Each element in the list contains
`the following information:
`
`* The coordinates of the turning point (1-8 axes)
`* The velocity to be used in reaching the turning point
`* The acceleration to be used in turning past the point
`" The comer radius to be used in rounding the comer as the point is passed
`.. An 110 value to be sent to the controller after the turning point is reached
`
`The PC-DSP controller executes a motion profile which produces a smooth path through a list of points. As a
`com~r in the path is reached the controller begins to accelerate toward the new direction of motion prior to
`reaching the comer. This produces a sequence of blended moves which approximates a path described by
`the straight lines joining the points. The following two dime.nsional example illustrates the motion geometry:
`
`~·Ax,, Y,
`
`~;:.;-:::--:::-:-,._~~~ -9
`.,
`
`'
`
`~..
`
`; / /
`
`',\'',,,<,
`
`/
`
`f>..•
`
`/
`~ /
`x., Y.
`
`',~ '9
`'~
`'
`'::-,~
`X2' Y 2
`
`Constant Veloc rty
`- Accel/Oeccel
`-
`-
`--------- 110 State 1
`rn th is reg ion
`
`The above path represents the motion described by 3 path points. The motion starts at X0. Yo proceeds to X1 • Y 1
`and terminates at X2.Y2. The acceleration specified in the first point (AO) is used during the indicated portions
`of the motion and around the first comer. The comer radiµs used is specifiable in the first point. The output
`value specified in the second point is output by the controller at the beginning of the comer acceleration
`section of the motion.
`
`3.1.1 Using 1/0 with Coordinated Motion
`
`The PC/DSP controller has general-purpose 1/0 control through 8-bit 1/0 ports (6 (48 bits) for 1-4 axis controllers.
`and 3 (24 bits) for 5-8 axis controllers). These are normally configured through calls to the init_io function
`and read or written to using get_io and set_io respectively. These Medium Level functions access a single 8-
`bit port specified by number (0-5). Some outputs may be controlled on-the-fly using the io element of the
`point structure passed to the add_point and add_arc functions. One 8-bit port is controlled by each axis of
`motion in accessed through the High Level Libraries. The maximum number of ports controlled is 4 (32 bits).
`The Coordinated Motion Sample Program shows how to tum a 110 bit on and off during a coordinated move.
`
`Page- 9
`
`RA v. AMS
`Ex. 1025
`
`Page 10 of 55
`
`Page 10 of 55
`
`
`
`---... _ .. ._
`
`-· ... --
`
`~·
`
`3.2 Error Return Codes
`
`dsp_error
`error_msg
`_error_msg
`
`Name:
`
`U::.1ge:
`
`dsp_error - last error code
`error_msg - copy error mes
`
`#include "pcdsp.h"
`extern int dsp_error;
`int error_msg(int code, char • dst);
`char* _error_msg(int code);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`All the functions except the switch state functions (home_switch( .•• ). etc) and
`_error_msg( ... ) return an integer error code corresponding to one of the following
`values:
`
`DSP _OK (0)
`
`This error code indicates successful completion of the last
`function.
`
`DSP _NOT _INITIALIZED (1)
`
`DSP _NOT _FOUND (2)
`
`DSP _INVALID_AXIS (3)
`
`DSP _ILLEGAL_ANALOG(4)
`
`dsp_init( .•. ) must be called to initialize static data. This error is
`returned if this static initialization hasn't been performed: See
`dsp_init( ••• ) for more detail.
`
`dsp_init( .•. ) wasn't able to find the PC-DSP board at the given 1/0
`base address.
`
`Any function taking an Axis parameter can return this error code,
`indicating reference to a non-existent axis.
`
`The PC-DSP board has eight analog inputs, numbered Oto 7.
`_This error indicates a call to get_analog( ••• ) requesting an illegal
`channel.
`
`DSP _ILLEGAL_IO (5)
`
`Only 1/0 ports O through 6 (or O through 3 for greater than four
`axis boards) are valid for init_io( .•• ), get_io( .•• ), and set_io( ••• ).
`
`DSP _OUT_ OF _MEMORY (6)
`AND
`DSP_FRAME_UNALLOCATED(7)
`
`DSP _ILLEGAL_PARAMETER (8)
`
`DSP _ILLEGAL_ CONVERSION (9)
`
`are internal library error messages, and should never be seen at
`higher levels. If you receive one of these messages, please
`contact us. They indicate problems passing information to the PC(cid:173)
`DSP board.
`
`A move with zero acceleration or velocity is considered illegal. Be
`sure to check your conversion factors. See move( ••• ),
`set_ velocity( ••. ), and set_conversion( ••• ) for more information.
`
`When either the Counts per Distance or Seconds per Period
`conversion factors are zero. any function using positions.
`velocities, or accelerations will return this error. See
`set_ conversion( •• ;) for more detail.
`
`The global variable dsp_error is set to the most recent error code. The function
`er ... or_msg( ..• ) copies a string description of the error corresponding to code into the
`
`Page-10
`
`RA v. AMS
`Ex. 1025
`
`Page 11 of 55
`
`Page 11 of 55
`
`
`
`,_....,.,,..,...., •••..,u"""'' '"""""'''u""''''-' · -
`
`, '""':::t''"'""'''"'.;p ··-··--·
`
`--r-1 :1··•, · - - - , ·•·-·•- .. -·•.;p•••--·
`
`.":>•
`
`·-
`
`character array pointed to by dst. This character array must be able to hold at least
`MAX_ERROR_LEN characters. The function _error_msg( ... ) returns a pointer to a
`static string containing a description of the error specified by code.
`
`Example Code:
`
`This example prints an error message if dsp_init( .•• ) fails:
`
`# include "pcdsp.h"
`# include <stdio.h>
`
`int main()
`{
`
`int e = dsp_init(PCDSP _BASE);
`if (e)
`{
`fprintf(stderr, "PC-DSP Initialization error: 'lbs (%d)\n", _error_msg(e). e);
`return e;
`
`return O;
`
`Page-11
`
`RA v. AMS
`Ex. 1025
`
`Page 12 of 55
`
`Page 12 of 55
`
`
`
`4 .. 0 FUNCTIONS
`
`4.1 User 1/0 Control
`
`init_io
`set_io
`get_io
`
`-;...
`
`Name:
`
`init_io - set 1/0 configuration,
`set_io - set an output port value,
`get_io - get an input or output port value.
`
`Usage:
`
`#include "pcdsp.h"
`int init_io(int port, int direction);
`int set_io(int port, int value);
`int get_io(int port;int *value);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`The PC-DSP-100 through 400 controllers have 48 bits (6 eight-bit ports) of
`uncommitted 1/0, the PC-DSP-500 through 800 have 24 (3 eight-bit ports). These
`ports are aceessible by the get_io and set_io Junctions. The port numbers start with
`port 0. init_io configures a port as either input or output. Use IO_INPUT or
`10 _OUTPUT for the direction parameter to specify the direction of a port.- get_io
`returns the current state of both input and output ports. set_io changes the state Of
`an output port to the value specified. set_io has no effect on an input port.
`
`init_io( •.• ) is usually unnecessary-the Setup and Exerciser program permanently
`stores the direction information on the board. This information is loaded during a
`hardware reset.
`
`Error Return Values:
`
`DSP _NOT_INITIALIZED, DSP _NOT_FOUND. DSP _ILLEGAL_IO will be returned if
`an invalid port is accessed.
`
`Example Code:
`
`This program configures the second port (port 1) as input, runs axis Oat a constant
`velocity until port 1 bit O goes high.
`
`# include "pcdsp.h"
`int mainO
`int e = clsp_init(PCDSP _BASE);
`{
`int val;
`
`if (!e)
`init_io(O, IO_INPUT);
`{
`set_ velocity(O, 1000, 5000);
`while (!get_io(1,&val))
`if(val & 1 )break;
`set_ velocity(O, 0, 5000);
`
`return O;
`
`r set port 0 to INPUT. •t
`r accelerate axis o • /
`r wait for bit 0 .• ,
`
`Page-12
`
`RA v. AMS
`Ex. 1025
`
`Page 13 of 55
`
`Page 13 of 55
`
`
`
`'
`
`...... ._.....,,
`
`............... ~ ....... u ...... ,
`
`'""'""''"IVtU:I -
`
`i,_. l""l""":::JICllllUlilll~ l'OllCllll..IQI -
`
`,,_, ......... )'ll'l:;lll\,
`
`I;;;);).(.., 1'¥1UUUll C..11~1ilC"Cl111~. 111 ......
`
`- vc1.> ...... ••
`
`' .....
`
`4.2 Read Analog Inputs
`
`get_ analog
`
`Name:
`
`get_analog - get an analog input ~_'.'llue.
`
`Usage:
`
`#include "pcdsp.h"
`int get_analog(int channel;int *value);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`Error Return
`Values:
`
`The PC-DSP has 8 eight-bit analog inputs which can be read using the get_analog
`function. The input channels are numbered 0-7.
`
`DSP _NOT_FOUND, DSP _NOT_INITIALIZED. or DSP _ILLEGAL_ANALOG if an
`invalid channel is requested.
`
`See also:
`
`The installation manual for analog input electrical specifications.
`
`Example Code:
`
`This program monitors the analog input, halting axis O if the analog channel 2
`voltage input exceeds +2.5 volts (an eight-bit reading of 128):
`
`# include "pcdsp.h"
`
`void mainO
`int e = dsp_int(PCDSP _BASE);
`{
`int val
`
`if (I e)
`r move slowly to 1 million counts •t
`{ move(O, 1 CXXXXlO, 100, 2000);
`while {!get_analog{2,&val) && !axis_done{O)) r watch while axis is in motion •t
`{
`if {val> 128)
`r axis_done( ... ) will become true. ·1
`set_stop{O);
`
`Page - 13
`
`RA v. AMS
`Ex. 1025
`
`Page 14 of 55
`
`Page 14 of 55
`
`
`
`··--·-·· ..__ ................ -
`
`.._. ·-::J'""''"••111~ 1 .. u;u1..-.a• • '-""t-'11 1 :::ii1•~. 1.;;J:;;,..:.., rv1uuocl t:.ngineec1ng, inc.· v~r:::.lUfl 1 . ..J
`
`4.3 Initialization
`
`dsp_init
`dsp_reset
`
`Name:
`
`Usage:
`
`dsp_init - set the controller base address for all other software calls
`dsp_reset - reset the controller to its power-up state.
`
`-1-
`
`#include "pcdsp.h"
`int dsp_init(int control/er_address);
`int dsp_resetQ;
`
`_Prototype in:
`
`pcdsp.h
`
`Description:
`
`A call to dsp_init( ... ) sets the controllers base address to by the other library
`functionsand stores reads other configuration data from the PC/DSP controller.
`Note: dsp_init must be called before any other function can be used. The
`controller_ address argument specifies the 1/0 address of the controller. The value
`of contro/Jer_address must match the switch settings on the controller (see the
`Installation Manual). If these switch settings are left at the factory defaults the
`defined value PCDSP _BASE may be used for controller_ address.
`
`A call to dsp_reset() causes a power-up reset of the PC-DSP controller. Software
`and hardware configurations are re-read from boot memory.
`
`Error Return
`Values:
`
`DSP _NOT _INITIALIZED, DSP _NOT _FOUND.
`
`Example Code:
`
`This program simply performs a hardware reset of the PC-DSP boarq:
`
`# include "pcdsp.h"
`int mainO
`{
`
`int e = dsp_intt(PCDSP _BASE);
`lf(le)
`dsp_resetO;
`return dsp _err~· · ·
`
`Page-14
`
`RA v. AMS
`Ex. 1025
`
`Page 15 of 55
`
`Page 15 of 55
`
`
`
`4.4 Software Limits
`
`set_error_limit,
`get_error_limit,
`set_accel_limit,
`get_accel_limit,
`set_ vel_limit,
`get_ vel_Jimit,
`set_pos_limit,
`get_pos_limit,
`set_in_position,
`get_in_position,
`
`Name:
`
`Usage:
`
`set_error_limit, get_error_fimit - set or read the limit value and action for position error.
`set_accel_limit, get_accel_limit - set or read the limit value and action for acceleration.
`set_ vel_limit . get_ vel_limit - set or read the limit value and action for velocity.
`set_pos_limits, get_pos_limits - set or read the limit values and action for position.
`set_in_position, get_in_position - set or read the maximum value for In Position status.
`
`#include "pcdsp.h"
`int set_error_limit(int axis.double limit, int action);
`int set_accel_limit(int axis.double limit, int action);
`int set_vel_limit(int axis.double limit, int action);
`int set_pos_limit(int axis.double low, double high, int action);
`int set_in_position(int axis, double limit);
`int get_error_limit(int axis.double *limit, int *action);
`int get_accet_limit(int axis.double *limit, int *action);
`int get_vel_limit(int axis.double *limit, int *action);
`int get_pos_limit(int axis.double *low, double *high, int *action);
`int get_in_position(int axis, double *limit);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`The PC-DSP has programmable limits for acceleration, velocity and highest and
`lowest position. The acceleration and velocity limits are absolute value limits(cid:173)
`whenever the absolute value of the error, acceleration or velocity exceeds its limit
`the associated action is performed. These limits are have the range 0 to 32, 767
`counts (error and in position), counts per second (velocity), or counts per second2
`(acceleration). Position limits can be +/-2, 147,483,647 counts. One of four actions
`can be taken when a limit is exceeded:
`
`Action ValueAction to be taken
`NO_ACTION
`STOP
`E_STOP
`ABORT
`
`Ignore the limit.
`Decelerate at to a stop (gentle).
`Decelerate to a stop (maximum deceleration).
`Disable control for this axis.
`
`The set_in_position function determines how small the position error must be to
`activate the In Position status bit (see dsp_status( ... )).
`
`The Setup and Exerciser program stores software limits in boot memory. These are
`restored on power-up or dsp_reset( ••• ), replacing any limits set by these functions.
`
`Page-15
`
`RA v. AMS
`Ex. 1025
`
`Page 16 of 55
`
`Page 16 of 55
`
`
`
`-
`
`-
`
`-
`
`_, __ , __ ••·-~·-·· --·•~•""'••-· ~ ._ ,- •-::1•-'''''"''• I•••••-• -""'t-"J''lit'"'·• I,.,~ ... l"'-'-1 C.ft\;114M::1:::iill~, l,K:,.,"' 'rJt::(~ ),J
`
`Error Return
`Values:
`
`DSP _NOT_FOUND, DSP _NOT_INITIALIZED, DSP _INVALID_AXIS, or
`DSP _ILLEGAL_ CONVERSION.
`
`See AJso:
`
`·1-
`set_ conversion( ••• ). hardware limit functions.
`
`Example Code:
`
`The following program will run axis 0 at 5000 counts per second. Exceeding the
`software position limit at 2 million counts. the axis will stop. This program will exit
`after the acceleration ramp is complete.
`
`#include "pcdsp.h"
`void mainQ
`{
`
`dsp_init(PCDSP _BASE);
`
`if (I dsp _error)
`set_pos_limit(O, 0, 2000000, STOP); r stop if we exceed 2 million counts ·1
`{
`r run at 5000 counts per second*/
`set_velocity(O, 5000, 10000);
`
`Page-16
`
`RA v. AMS
`Ex. 1025
`
`Page 17 of 55
`
`Page 17 of 55
`
`
`
`4.5 Home, Limit and Device Fault Actions
`
`set_home_action
`get_home_action,
`set_limit_action
`get_limit_action,
`set_amp_fault_action
`get_amp_fault_action,
`
`Name:
`
`Usage:
`
`set_home_action, get_home_action - set or read the action to be taken when the
`home sensor is activated.
`set_limit_action, get_limit_action- set or read the action associated with a limit
`sensor.
`set_amp_fault_action, get_amp_fault_action - set or read the action to be performed
`when a device fault is detected.
`
`#include "pcdsp.h"
`int set_home_action(int axis, int level, int action);
`int set_limit_action(int axis, int level, int action);
`int set_amp_fault_action(int axis, int level, int action);
`int get_home_action(int axis, int *level, int •action);
`int get_limit_action(int axis, int *level, int *action);
`int get_amp_fault_action(int axis, int *level, int, *action);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`These functions configure the PC-DSP controller's responses to home, positive limit,
`negative limit, and amp fault sensors. The level parameter indicates the activated
`state of the sensor-FALSE (0 volts) or TRUE (+5 volts). When the PC-DSP board
`detects a change from the state given in level, the specified action is. taken. action
`can be one of the following values:
`
`Action Value
`NO_ACTION.
`STOP
`E_STOP
`ABORT
`
`Action to be taken
`Ignore the limit.
`Decelerate at to a stop (gentle).
`Decelerate to a stop (maximum deceleration).
`Disable control for this axis.
`
`Error Return
`Values:
`
`DSP _NOT_INITIALIZED, DSP _NOT_FOUND, DSP _INVALID_AXIS.
`
`See Also:
`
`input switches, software limits.
`
`Page -17
`
`RA v. AMS
`Ex. 1025
`
`Page 18 of 55
`
`Page 18 of 55
`
`
`
`4.6 Positions
`
`set_position,
`get_position,
`set_ command,
`get_ command,
`get_ error
`
`Name:
`
`Usage:
`
`set_position - set the current actual position register.
`get_position - get the current actual position.
`set_command- set the current command position register.
`get_command- get the current command position.
`get_ error - get the current position error.
`
`#include "pcdsp.h"
`int set_position(int axis.double position);
`int get_position(int axis, double *position);
`int set_command(int axis,double position);
`int get_command(int axis, double *position);
`int get_error(int axis; double * error);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`Error Return
`Values:
`
`These functions provide on-the-fly actual position, command position, and position
`error readings. Call set_position( ••• ) to modify the current contents of the actual
`position register. Use set_ command( .•• ) to cause an immediate jump to the
`specified position. Note that get_ error( ••• ) saturates after+/- 32, 767 counts, so
`get_ error( •.• ) never returns anything greater than+/- 32,767 counts. All returns are
`in user-units.
`
`DSP _NOT_INITIALIZED, DSP _NOT_FOUND, DSP _INVALID_AXIS.
`
`See Also:
`
`set_conversion( ••• ). move( ••. ), set_velocity( ••• ). set_error_limit( ... ).
`
`Sample Code:
`
`This function resets the actual position register for axis 0, and displays its position
`through a move to 100,000 counts:
`
`# include "pcdsp.h"
`#include <stdio.h>
`intmainO
`{
`double pos;
`if (dsp_init(PCDSP _BASE))
`return dsp _error ;
`
`r any problems initializing? • ,
`r just {enninate the program .• ,
`r reset axis O's actual position •t
`set_position(O. 0.0};
`start_move(O, 100000.0, 5000, 10000}; r move to 100,000 counts ·1
`
`while (!get_positon(O,&pos) && !axis_done(O})
`printf\Current Position: %1!\t", pos);
`
`return dsp _error ;
`
`Page -18
`
`RA v. AMS
`Ex. 1025
`
`Page 19 of 55
`
`Page 19 of 55
`
`
`
`4. 7 Run/Idle
`
`Name:
`
`usage:
`
`controller_run,
`controller_idle
`
`controller_run - set the controller fnto run mode.
`controller_idle - set the controller into idle mode. -
`
`#include "pcdsp.h"
`int controller_run(int axis);
`int controller_idle(int axis);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`Error Return
`Values:
`
`Idle mode disables control for the specified axis. controller_idle( ••. ) sets the
`motor's analog control voltage to zero volts, and turns the amp enable bit off.
`To re-enable control of an axis, use the controller_run( ..• ) function. This will reset
`the PC-DSP control word, re-enabling servo control. Note that set_amp_output( ••. )
`must also be called to re-enable the amp enable bit.
`
`DSP _NOT_INITIALIZED, DSP _NOT_FOUND, DSP _INVALID_AXIS.
`
`See Also:
`
`set_amp_output( ... ), dsp_status( ... ), software and hardware limits.
`
`Example Code:
`
`The following program disables control of axis O when 1/0 port O bit o goes high:
`
`# include "pcdsp.h"
`int mainQ
`int e = dsp_init(PCDSP _BASE);
`{
`if {!e)
`e = start_move{O, 250000, 8000, 32000); r move to 250,000 counts. •t
`{
`while (le && I axis_done(O))
`r port obit o going high? •t
`{
`if (get_io(O) & 1)
`{
`controller _idle(O);
`r exit the loop*/
`e =TRUE;
`
`return e;
`
`Page - 19
`
`RA v. AMS
`Ex. 1025
`
`Page 20 of 55
`
`Page 20 of 55
`
`
`
`4.8 Filter Parameters
`
`set_ filter
`get_ filter
`
`Name:
`
`Usage:
`
`set_filter - set the digital filter coefficients.
`get_filter - get the digital filter coefficients.
`
`#include "pcdsp.h"
`int set_filter(int axis, int coeffsfCOEFFICIENTSJ);
`int get_filter(int axis, int coeffsfCOEFFICIENTSJ);
`
`Prototype in:
`
`pcdsp.h
`
`Description:
`
`Servo motors and closed loop steppers are controlled by a standard PIO control
`algorithm. The get_filter( ... ) function returns the current filter coefficients used by
`the PC-DSP board set_filter( ... ) changes them. Both functions expect a pointer to
`an array of COEFFICIENTS integers, mapped as follows:
`
`coefft:DF _PJ
`coefft:DF _I]
`coefft:DF _DJ
`coefft:DF _ACCEL_FF]
`coefft:DF _ VEL_FF]
`coettt:DF _!_LENGTH}
`coefft:DF _OFFSET]
`coeft{DF _DAC_LIMIT]
`
`Proportional Gain,
`Integral Gain
`Derivative Gain
`Acceleration Feed Forward
`Velocity Feed-Forward
`Integration Delay
`Offset
`Torque Limit
`
`Each of these digital filter coefficients is described in the Tuning· section of the
`Installation Manual.
`
`Error Return Values: DSP _NOT_FOUND, DSP _NOT_INITIALIZED, DSP _INVALID_AXIS.
`
`Sample Code:
`
`The following code decreases the gain before a first move, and increases it before a
`second move, repeating between two points:
`
`# include "pcdsp.h"
`int mainO
`{
`int Coefficients[COEFFICIENTSJ;
`int e = dsp_init(PCDSP _BASE);
`get_filter(O, Coefficients);
`while(! e)
`{ Coeffrcients[DF _PJ = 245 ;
`set_filter{O, Coefficients);
`move(O, 100000, 8000.0, 16000.0);
`
`r move axis 0 to 100,000 counts ·1
`
`Coefficients[DF _PJ = 1024 ;
`r set the higher gain. ·1
`set_filter(O, Coefficients);
`e = move(O, 0, 320000, 320000.0, 320000.0); r quickly back to O counts. •t
`
`return e;
`
`Page- 20
`
`RA v. AMS
`Ex. 1025
`
`Page 21 of 55
`
`Page 21 of 55
`