/*-=-=-=-=-=-=-=-=-=-=-=- RCCL/RCI Notice of Copyright -=-=-=-=-=-=-=-=-=-=-*
 *									    *
 *	Copyright (C) 1987, 1991 by John E. Lloyd and Vincent Hayward.	    *
 *									    *
 *	Information on copyright permissions, as well as a complete	    *
 *	disclaimer of warranty, is given in the file COPYRIGHT.		    *
 *									    *
 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#include "mk2.c"

/* Table of parameters which are loaded into the joint microprocessors
   by controller start-up time. */

/* RAM Parameters */

#define  WHLSIZ     0x0900 /* 004400 no. of encoder counts times 4        */
#define  PENVELOPE  0x4700 /* 043400 position envelope                    */
#define  INTSCL     0x5a00 /* 055000 log 2 of the # of ticks per sample   */
#define  NINTER     0x5900 /* 054400 number of ticks per sample           */
#define  PGAIN      0x0300 /* 001400 position error servo gain (0 to 7)   */
#define  IGAIN      0x0500 /* 002400 integration gain                     */
#define  ASCALE     0x0400 /* 002000 acceleration scale                   */
#define  PPGAIN1    0x6900 /* 064400 proportional path gain               */
#define  PPGAIN2    0x6a00 /* 065000 another proportional path gain       */
#define  FOOGAIN    0x5800 /* 054000 another unknown gain                 */
#define  VDECAY     0x5600 /* 053000 velocity averaging constant          */
#define  ALEAD      0x5400 /* 052000 velocity averaging lead              */
#define  BLEAD      0x5500 /* 052400 another velocity averaging lead      */
#define  VGAIN      0x5c00 /* 056000 velocity average gain                */
#define  SCALE      0x0600 /* 003000 output scale                         */
#define  ITERM      0x0a00 /* 005000 integration term                     */
#define  CURPOS     0x2a00 /* 025000 current position (2 bytes)           */
#define  POSERR     0x6100 /* 060400 current position error (2 bytes)     */
#define  POSTOL     0x4900 /* 044400 position tolerance (2 bytes)         */
#define  INTTOL     0x4b00 /* 045400 integration tolerance (2 bytes)      */
#define  CURVEL     0x1800 /* 014000 current velocity (2 bytes)           */

unsigned short defaultRamTable [][7] =
	{ WHLSIZ,		0xe8,  0x20,  0xe8,  0xe8,  0xe8,  0xe8,

	  INTTOL,		0x32,  0x32,  0x32,  0x32,  0x32,  0x19, 
	  INTTOL+0400,		   0,	  0,	 0,	0,     0,     0,
	  POSTOL,		0x28,  0x28,  0x28,  0x28,  0x28,  0x14, 
	  POSTOL+0400,		   0,	  0,	 0,	0,     0,     0, 

	  VGAIN,		   1,	  1,	 2,	3,     3,     3,
	  PGAIN,		   1,	  1,	 1,	1,     1,     1,
	  ASCALE,		   3,	  3,	 3,	3,     3,     3, 
	  IGAIN,		   7,	  6,	 7,	6,     6,     6, 
	  SCALE,		   5,	  5,	 5,	5,     5,     5,
	  NINTER,		0x40,  0x40,  0x40,  0x40,  0x40,  0x40,
	  INTSCL,		   6,	  6,	 6,	6,     6,     6,
	  ALEAD,		   0,	  0,	 0,	0,     0,     0,
	  BLEAD,		   0,	  0,	 0,	0,     0,     0,
	  VDECAY,		   2,	  2,	 2,	2,     2,     2, 
	  PPGAIN1,		   2,	  3,	 2,	3,     3,     3,
	  PPGAIN2,		   2,	  2,	 2,	2,     2,     2,
	  FOOGAIN,		   3,	  3,	 3,	4,     3,     4,

	  -1,			   0,	  0,	 0,	0,     0,     0};

int varClkRate = 1;		/* system clock rate can be changed */
int varClkParam = 6;		/* parameter used in changing clock rate */
int baseClkRate = 28;		/* nominal system clock rate (.1 msec.). */
int jntClkRate = 9;		/* joint servo rate (.1 msec.). */
