PMAC1-VME configuration to work with PMAC1 EPICS driver

These must be set from PMAC-Executive program PE3.EXE or PEWIN32.EXE (from the PC), while the ethernet cable is not connected to VME or VME is not booted.

ATTENTION: Generally, EPICS and PE3.EXE/PEWIN32.EXE must not talk to PMAC sumultaneously.

1) Configure PMAC-VME communications in the PE3.EXE/PEWIN32.EXE:
Para-
meter
 
VME-Address
 
 
PMAC-VME
base
address
Don't
care
bits
Inter
-rupt
level
Inter
-rupt
vector
Enable
DPRAM
 
DPRAM
base
address
PMAC-0 $09 A32-Extended data access $807FA000 $04 $02 $A1 Yes $700000
PMAC-1 $09 A32-Extended data access $807FA200 $04 $02 $A5 Yes $704000
PMAC-2 $09 A32-Extended data access $807FA400 $04 $02 $A9 Yes $708000
PMAC-3 $09 A32-Extended data access $807FA600 $04 $02 $AD Yes $70C000
PMAC-4 $09 A32-Extended data access $807FA800 $04 $02 $B1 Yes $710000
PMAC-5 $09 A32-Extended data access $807FAA00 $04 $02 $B5 Yes $714000
PMAC-6 $09 A32-Extended data access $807FAC00 $04 $02 $B9 Yes $718000
PMAC-7 $09 A32-Extended data access $807FAD00 $04 $02 $BD Yes $71C000
2) These make possible the dialog PMAC ASCII driver with PMAC mailbox:

   I1=0 /serial port mode = CS handshake used; no software card address required/.
   I2=3 /control panel = disable -- not standard PMAC range!!!/.
   I3=2 /PMAC acknowledges valid command with ASK and invalid with .
                                   Messages are sent as DATA  ... DATA  /.
   I4=0 /checksums disabled; serial errors are reported immediately/.
   I6=1 /the error message format is {error message}/.
   I7=9 /Nr of consecutive cycles to detect "In-position" -- see PE3.exe/.
   I9=0 /the programs are sent back in short form; decimal-address I-variable return/.
3) Save these VME addresses to take effect
	 Enter "Save" in PE3.EXE .
         Power Off the VME crate.
	 Power On the VME crate.
4) These make the PMAC Dual-Ported RAM responding to PMAC DPRAM driver:
   I48=1 /DPRAM servo data enable -- see PE3.EXE/
   I49=1 /DPRAM background data enable -- see PE3.EXE/
   I59=8 /DPRAM buffer max motor/CS number -- see PE3.EXE/
5) Save these changes to take effect
	 Enter "Save" in PE3.EXE .
         Power Off the VME crate.
	 Power On the VME crate.
ATTENTION: Steps (4)-(5) can be done simultaneously with steps (2)-(3).

6) Set I55=1

    Enter "I55=1" in PE3.EXE
    PMAC Manual says: "I55 is reserved for future use". However, this
    variable is used for Dual-Ported RAM addressing
7) Start PMAC clocks ("gather")

    Enter "gather" in PE3.EXE
8) Each PMAC must be loaded by individual set of PMC programs.
The usual order is:
        mvarstd.pmc --------+                             ---+
        enctblstd.pmc       |These programs are identical    | Grouped as
        plc0.pmc            |       for all PMACs            | begin.pmc
        plc1.pmc            |                                | on the PC
        pcsClear.pmc -------+                             ---+
        pcs-18IDpmac%%.pmc  ----+ These programs are changed depending
        q70-18IDpmac%%.pmc      | on what motors and coordinate systems
        m900-18IDpmac%%.pmc ----+ are associated with PMAC. Edit them!!!
        b%%%.pmc  -- These are motion programs (slew, backlash, etc).
        |______|     Only those b%%%.pmc are loaded, which are needed
            |        in each PMAC. One copy of each program is loaded
            |        regardless of how many assemblies may use it:
            |                          (%=0,1,2)                   Grouped on PC as:
            |               +-- b01%.pmc for 1 motor assembly        --+ b01.pmc
            +---------------|   b03%.pmc for 2 motor assembly          | b03.pmc
                            +-- b07%.pmc for 3 motor assembly          | b07.pmc

The loading can be done using PE3.EXE on a Windows computer.

ATTENTION:
   When you are downloading to PMAC from PC, stop the IOC operation
   before connecting serial cable from PC to PMAC and reboot
   the IOC after disconnecting the cable.
9) Save the above downloads in the PMAC memory.
   1. Bring the Command tool (Command.adl)
   2. Enter "save"

Here is a practical record how we set up our test motor to jog

Ix11=8388607=$7FFFFF /Motor Fatal Error Limit = maximum/ (the operational value is 32000=$7D00)
Ix12=4194303=$3FFFFF /Motor warning Error Limit = 0.5*Ix11/  (operational value is 16000=$3E80)
Ix69=20479=$4FFF     /amplifier output = 6.5V -- not necessary: may be
                      up to 32767=$7FFF, which corresponds to 10V!!!/
Ix25=$A0C0xx
      |||__|
      || +------------[ $00C0xx = PMAC address of flags:
      ||                     xx = 00,04,08,0C,10,14,18,1C   for
      ||                    mtr =  1, 2, 3, 4, 5, 6, 7, 8
      ||
      ||______________[ 0= enable check for position limits (operational value)
      |               [ 2= disable check for position limits(simulation value)
      |
      |               [ 0= enable amplifier fault processing,
      |               [    kill all motors on fault, and
      |               [    low true fault input
      |               [    (not-set values and simuation values)
      +---------------[ A= enable amplifier fault processing,
                      [    kill all coordinate system motors on fault, and
                      [    high true fault input
                      [    (operation values)
                      [ 1= disable amplifier fault processing
                      [    (testing mode values)

-- See page 5-39 of PMAC Software Reference for more details.

Initial setup of PMAC motors

1) Set each motor from simulation to real mode (Ix00, Ix02, Ix03, Ix04,...)
       Ix00 Motor x Activate
       Ix02 Motor x Command Output (DAC) Address
       Ix03 Motor x Position-Loop Feedback Address
       Ix04 Motor x Velocity-Loop Feedback Address
       Ix25 Motor x Limit/Home Flag/Amp Flag Address
       Ix30 Motor x PID Proportional Gain
       Ix31 Motor x PID Derivative Gain
       Ix32 Motor x PID Velocity Feedforward Gain
       Ix33 Motor x PID Integral Gain
       Ix35 Motor x PID Acceleration Feedforward Gain
       Ix69 Motor x Output Command (DAC) Limit
Operational (REAL) mode
MOTOR 1 2 3 4 5 6 7 8  
MEM (Y:): Ix02 $C003 $C002 $C00B $C00A $C013 $C012 $C01B $C01A (1)
MEM_piezo: Ix02         $774 $775 $776 $777 (2)
ENCODER(X:): Ix03=Ix04 $720 $721 $722 $723 $724 $725 $726 $727 (3)
ENCODER_piezo: Ix03=Ix04         $725 $727 $729 $72B (4)
LIMITS Ix25 $A0C000 $A0C004 $A0C008 $A0C00C $A0C010 $A0C014 $A0C018 $A0C01C  
LIMITS_piezo: Ix25         $A2C010 $A2C014 $A2C018 $A2C01C (5)
Other variables:
 Ix00 = 0/1 -- motor Off/On
 Ix15 = Ix17 = Ix19 = 0.9 -- motors acceleration/decceleration parameters; a
                             typical value (piezo motors are always on limit)
 Ix25 = $A0C0xx, xx=00,04,08,0C,10,14,18,1C  -- see p.5-39 of PMAC reference.
 Ix30 = depending on motor (see below)
 Ix31 = depending on motor (see below)
 Ix32 = depending on motor (see below)
 Ix33 = depending on motor (see below)
 Ix35 = depending on motor (see below)
 Ix69 = 32767 = $7FFF /for 10v before amplifier and 24V after it/
(1) See mvarstd.pmc (DAC output).
(2) See mvarstd.pmc (simulated memory).
(3) See encltblstd.pmc


2) Adjust DAC (digital-analog converter) range (Ix69=32767 for 10V before
   amplifier and 24V after it).

3) Set limit switches control on (Ix25=A0C0xx, xx=00,04,08,0C,10,14,18,1C).

4) Possibly invert encoder, if it counts in wrong direction:
Motor 1 2 3 4 5 6 7 8
Variable I900 I905 I910 I915 I920 I925 I930 I935
Clockwise (CW) 3 3 3 3 3 3 3 3
CounterClockwise (CCW) 7 7 7 7 7 7 7 7

See p.5-70 of PMAC Software Reference for more info.

5) Bring:
    - Ixxx18ID.tcl
    - Servo1.adl
    - MtrCommand.adl
    - OpnLp.adl

6) Go to +- Limit Switches (in OpnLp.adl) and check that:
    - positive limit is at expansion.
    - negative limit is at contraction.
   Invert motor wiring and/or encoder setup (I900,I905,I910,I915,I920,
   I925,I930,I935) if incorrect.
HINT: When a limit is reached, disable the limit switchers control:
change Ix25 from $A0.... to $A2....
-- otherwise, the motor will not move away from the limit.

7) Using a ruler, measure roughly the range of motor movement and setup
   the calibration factor.

8) Save PMAC in Command.adl and save calibration parameters in Assembly
   -> Calibration Save/Restore.
ATTENTION: There are 2 kinds of SAVE operations for PMAC software:
   (1) The parameters relevant to the PMAC itself are stored in the PMAC
       ROM. These are various Ixxx variables controlling motor jog and
       home speeds, acceleration time and gain, homing direction and
       flags, etc. To save them bring:
       MOTION -> PMAC -> Command Strings,  or
       MOTION -> PMAC -> 18ID:pmacXX: -> Command String,  or
       MOTION -> PMAC -> 18ID:pmacXX: -> Tcl/Tk Strings,
       -- and enter the SAVE command.

   (2) The parameters of assemblies are stored at the workstation you
       use. These are the calibration parameters (offsets and factors),
       drive ranges and stored positions, the type of PMAC program, etc
       (generally - any EPICS database variables which are listed in
       the backup configuration file). To save them bring:
       MOTION -> Assemblies -> Calibration Save/Restore..., switch to
       the SAVE mode and press the respective assembly button.
       The calibrations are lost after each rebooting of IOC. So, at
       the startup the IOC must be loaded with the data saved at the
       workstation hard drive. To restore, bring:
       MOTION -> Assemblies -> Calibration Save/Restore..., and press
       the respective assembly button.