spec

Software for Diffraction

pi_gcs

Physik Instrumente GCS2 Motor Controllers

The Physik Instrumente (PI) protocol and syntax for motor controllers is called GCS (General Command Set). GCS has more than one release and the versions are not entirely compatible. spec release 6.11.05 includes general support for GCS version 2 (GCS2).

Even among controllers that support GCS2, there is variation as to which commands are available. spec release 6.11.04 has been tested with the C-663.12 and C-863.11 controllers. spec release 6.12.01 added support for the E-727.3SDA controller. Other models may work with the code, but it is expected the code will need tweaking.

spec also supports many older models of PI motor controllers that uses either GCS version 1 or a pre-GCS syntax and protocol. The older models with spec support include C-804, C-844, C-860, C-630, C-663, C-862, C-863, E-516, E-710, E-712 and E-816.

Support for GCS version 3 will be added in a future spec release.

CONFIGURATION

On the Devices screen of the edconf configuration editor, invoked using the config macro, choose "PI GCS2 Piezo Controller (Serial)" as the controller. On the Motor screen, choose PI_GCS as controller type. If using unit/channel numbering, channel numbers start from 1. If controllers are daisy chained, use unit/module/channel numbering, with the module number corresponding to the address selected via DIP switches on the associated controller. Note, there must be a module with address 1.

The GCS controllers use natural units for communicating position, speed and acceleration. The "steps per degree/mm" parameter determines the resolution with which spec will report motor positions and program motor positions on the controller. The value does not need to correspond to the steps per unit of the physical device, but should probably be at or greater than that value. The next higher power of ten is a good choice. If the units of the controller are millimeters, a parameter value of 1e7 will have spec round motor positions to the nearest 0.1 nm, which corresponds closely to the resolution of position commands for a controller such as the C-663. Note, the "steady-state rate" parameter needs to be scaled by the same factor as the "steps per degree/mm" parameter to maintain the same speed with the new resolution.

The GCS controllers do not use the base rate parameter. The standard optional "deceleration" parameter is recognized. If not set, the deceleration on the controller will be programmed to the same value as the acceleration parameter.

If needed, the DC dead band ("dc_dead_band") and DC settle time ("dc_settle_time") standard optional parameters are recognized by the spec support. A move is not considered finished until the position is within the dead band and the settle time has elapsed.

DETAILS

If there are multiple axes on the same controller, spec will attempt to start all axes involved in the same move simultaneously using the MOV GCS command with multiple axis/position pairs of arguments.

If a move or home command generates error 5, "Unallowable move attempted on unreferenced axis, or move attempted with servo off", spec will send the SVO 1 to enable the motor, then try the move or home command again.

The set_dial command works by using the POS GCS command, after temporarily setting reference mode to zero, if necessary, with the RON 0 command.

If the standard optional parameter "home_method" is set, spec uses that command for starting a home search.

For models that support the reference search commands, expected values are FNL, FPL or FRF, corresponding to fast reference moves to negative limit, positive limit or reference switch. If not set, the "home", "home+" and "home-" arguments to chg_dial() will send the FRF commands. The "lim+" and "lim-" arguments will send FPL and FNL respectively.

For models that support the automatic zero-point adjustment command ATZ, spec sends that command for all varieties of home search. The string NAN is appended, which instructs the controller to use the saved autozero low voltage parameter (ID 0x07000A00).

If the standard optional parameter "home_position" is set, spec will set the dial position to that value at the conclusion of a successful home search. Alternatively, the home macro can be used with an optional argument that specifies the dial value to be set at the home position.

PARAMETERS

Note, with the motor_par() commands below, the parameter name is case insensitive.

Each axis on a GCS2 controller is accessed through an axis ID. The default axis IDs are numbers starting from 1. However, up to eight-character axis IDs can be assigned from a character set of digits, numbers, the underscore and the hyphen. spec queries the controller as to the current axis IDs during configuration. The following command can be used to set or retrieve the ID for motor mne:

motor_par(mne, "axisID" [, newID])
Gets or sets the axis ID in volatile memory.

GCS2 controllers have a large number of parameters accessed via a numerical parameter ID. PI lists the parameter IDs using hexadecimal notation. Parameters values may be set from spec using motor_par() along with the parameter ID value.

motor_par(mne, parID [, value])
Gets or sets the parameter identified by the numeric value parID for motor mne. Returns an error if no such parameter ID or if the controller rejects the value.
motor_par(mne, "pars", parID [, value])
Gets or sets a parameter as above.

spec uses the SPA command, which operates on volatile memory, to get and set parameters. Consult the controller manual on use of the WPA command to save parameters to nonvolatile memory. Such commands can be sent using motor_par() with "send" as described below. The number of write cycles is limited, so spec does not include routine write support to nonvolatile memory.

Both the "axisID" parameter and the number-valued parameters can be set as non-standard optional parameters in the spec hardware config file. Access the non-standard optional parameter screen from the configuration editor by typing a p from the main Motor screen. The controller will be programmed with these values on start up and after a reconfig.

motor_par(mne, "pars" [, pattern])

With no argument, displays all the available parameters for motor mne, giving the parameter ID in hexadecimal and the parameter description. If an argument is present, only parameters that have a description that matches the pattern are shown. The pattern search is case insensitive.

As usual, the pattern may contain the *, ? and [] metacharacters. A * matches any string, while a ? matches any single character. With the [...] pattern, any string that contains the characters within the square brackets is matched. Two characters separated by a hyphen specify a range of characters that will match. An initial ^ negates the enclosed character set.

motor_par(mne, "pars+" [, pattern])
As above, but also reads the current value for each matching parameter from the controller and displays the description and value.

The GCS2 controllers return a list of the complete parameter set including IDs, descriptions and other information with the HPA? command. The first time the "pars" or "pars+" parameter is used without a numerical parameter ID, spec reads that list of parameters from the controller. The process takes several seconds. As long as the controller doesn't change, spec will remember and reuse the list of parameter descriptions across reconfig calls.

With no pattern argument, the "pars" and "pars+" options organize the parameters into the functional groups assigned by PI. With a pattern argument, the parameters are listed sorted by ID value. In addition, when there is no pattern argument, possible values for parameters are shown when the controller provides that information.

For example, to display the IDs, descriptions and values for the parameters associated with "reference" moves, one could use:

SPEC> motor_par(0, "pars+", "ref")
    0x14:  Has Reference? = 1
    0x16:  Value At Reference Position (Phys. Unit) = 12.2000001
    0x17:  Distance From Negative Limit To Reference Position (Phys. Unit) = 12.2000001
    0x2f:  Distance From Reference Position To Positive Limit (Phys. Unit) = 13.8000001
    0x31:  Invert Reference? = 0
    0x47:  Reference Travel Direction = 0
    0x50:  Velocity For Reference Moves (Phys. Unit/s) = 0.4000000
    0x5c:  Source Of Reference Signal = 0
    0x70:  Reference Signal Mode = 0
    0x77:  Use Limit Switches Only For Referencing = 0
    0x78:  Distance From Limit To Start Of Ref Search (Phys. Unit) = 0.0000000
    0x79:  Distance For Reference Search (Phys. Unit) = 0.0000000

spec provides command pass through to send and receive all possible commands and responses from the GCS2 controllers. All the following commands will prepend the module address if using daisy-chained controllers if the module address is greater than 1.

motor_par(mne, "send", cmd)
Sends the string cmd to motor mne, inserting the axis ID and a adding a terminating newline.
motor_par(mne, "read", cmd)
As above, but will return the controller's response.
motor_par(mne, "usend", cmd)
Sends the string cmd to the controller unit associated with motor mne adding a terminating newline. No axis ID is inserted.
motor_par(mne, "uread", cmd)
As above, but will return the controller's response.

For example, to copy a parameter from volatile to nonvolatile memory, one could use:

motor_par(mne, 0x15, 20)
motor_par(mne, "usend", "WPA 100 1 0x15")

Here 100 is the WPA "password", the 1 argument is the axis ID, and 0x15 is "Maximum Travel In Positive Direction" parameter. The "unit" version of the send command is used because the WPA command requires the password argument, and with the axis version of the command, spec would insert the axis ID directly after the three-letter GCS command.

Use spec debug mode 128 to see the exact dialog between spec and the GCS controller. For example, to display the current value of parameter 0x40 "Holding Current", with DEBUG=128 one would see:

SPEC> p motor_par(0, 0x40)
PI GCS send: SPA? 1 0x40
PI GCS read: 1 0X40=125\n
PI GCS send: ERR?
PI GCS read: 0\n
125

For all the motor_par() commands above, spec checks whether the controller generated an error using the command ERR?. A zero response means no error. If there is an error, spec displays the associated error message as given by the GCS documentation.

Note, spec also checks for controller errors after move, home and set dial commands, and if the status word indicates an error condition.