Intro
Spex uses 2 SM34205D smart motors.
4 where purchased in 2012/12: Model SM34205d, Firmware: 5.0.3.41

1. Grating

2. Rotator

The command are different that the previous SMART Motor Generation
Here is a summary useful Class 5 commands:

Smart motor RS-232 cable is pluged diretly into the PC's serial port.

Spex uses a digi to access the smart motor RS-232 over the network.
See software/digi_ts4 for cabling notes. Use the digi add overhead to 
the communicaton, for example and "RPA" can take 0.016 seconds over RS-232,
but take about 0.225 sec on a digi TS4 (I have seen network delay greater that 0.5 sec).


Initialization commands:

  For wheels, disables the hardware limits. 
	EIGN(2)   ' Disable Left  Limit
	EIGN(3)   ' Disable Right Limit

  Set the Amp limit ( 0 to 1023 ), Velocity and Acceleration/Deceleration.
	  AMPS=200 VT=20000 ADT=100 

  Put the motor into POSITION mode
	  MP

  Set Origin or present value.
	  O=0

Intro
Moving the motor:

   MP examples:

 Absolute position move to 5000.
	  PT=50000 G

 Relative position move to +5000 steps.
	  PRT=5000  G

 Jog in the positive direction.
	  MV VT=100000 G

Stopping the motor

Decelerated stop
  X

Abruptly Stop 
  S

Turn Motor Servo off
  OFF

Off with free-wheel spin
  BRKRLS

Homing

The /home/s2/src/spex/ldog/sm_wheel_home.sms is downloaded to each 
spex motor (all wheel). The program was loaded using the SmartMotorInterface 
program, which is archive in vendor_info/animatics/.

The smartmotor for spex are wired up up:
   Pin   IO_inx    Function
	 1      0       Analog output from HE sensor, 0 to 5 v output.
	 2      1       Comparator +TTL: 0=InHomePosition, 1=Not at home
	 3      2       Comparator -TTL: not used by the software (no reverse magnet installed).

Use this command to find the home switch (closes to GND on input 0.)

   MV VT=20000 ADT=100 G RUN


IO and other setup

	EIGN(2)   ' Disable Left  Limit
	EIGN(3)   ' Disable Right Limit
	EIGN(W,0) ' Set all I/O to be general inputs

   a = IN(0)     ' reading input 0
	a = IN(0) Ra  ' input input, report value.

   To read analog voltage:

	   v=INA(A,4) Rv        // return AD counts, 0 to 32735 = 0-5v
	   v=INA(V1,4) Rv      // returns millivots, ie 3456 is 3.456 VDC


Other Commands

  Report the motor position
	  RPA

  Report the assigned current
	  RAMPS

  Turn the motor off
	  OFF

  Reset errors 
	  ZS

  RSP - report sampiling rate and firware version
    "12500/5.0.3.41" for spex's 34205D, so 0.000125 or 8000Hz

MISC

Some SM34205D defaults:
   KP is 1000
	KI is 240
	KD is 12000
	KL is 32767