spec

Software for Diffraction

phymotion

Phytron phyMOTION Motor Controllers

DESCRIPTION

The Phytron phyMOTION controllers are a modular series of motor controllers. The modules fit into crates of various capacities that also accept digital and analog I/O modules along with various modules for interfacing and providing power. Software control uses a instruction set dubbed phyLOGIC that is an extension of the programming syntax used in earlier generations of Phytron motor controllers.

spec currently supports communication with the phyMOTION modules over socket and USB interfaces. The USB interface appears as a serial USB device to spec.

spec recognizes and supports the following phyMOTION modules:

I1AM01 1-axis stepper drive 3.5A
I1AM02 1-axis stepper drive 5A
DIOM01 Digital I/O
AIOM01 Analog I/O
AIM01 Analog In
AOM01 Analog Out
IDXM01 4-axis Indexer module

CONFIGURATION

Configure the motor controllers on the Devices screen of the configuration editor as follows, choosing the socket or serial entry, as appropriate:

Motor and Counter Device Configuration (Not CAMAC)

MOTORS         DEVICE ADDR <>MODE NUM                     <>TYPE
   YES /dev/phymotion   <> 115200  10 Phytron Phymotion (Serial)
   YES  192.168.1.100              10 Phytron Phymotion (Socket)

If using the USB/serial interface, the recommended baud rate is 115200.

On Linux platforms, the spec udev rules file, /etc/udev/rules.d/10-spec_usb.rules, includes a rule to create a special device node, /dev/phymotion, for one connected system. (The current phyMOTION USB descriptor does not contain sufficient information to create unique device nodes for multiple systems.) On older Linux distributions, particularly Fedora 15 through 18, a bug in the udev facility results in failure of the spec udev rules in creating /dev/phymotion. In that case use /dev/ttyUSB0, /dev/ttyUSB1, etc., as appropriate, for the DEVICE name. Note, though, that assignment of the ttyUSB nodes to particular devices depends on the order in which the USB devices are connected to the computer.

For the socket interface, specify the IP address or a resolvable host name for the controller. An optional TCP port number can be specified by following the name with a colon and the port number. If not specified, the default port number, 22222, will be used.

On the Motors screen, choose PHYMO or PHYMO_E as the controller type. The latter specifies an encoder is present. If using an encoder, one must also configure the encoder-steps-per-deg/mm parameter on the second optional-motor-parameter screen. When an axis is configured with an encoder, spec reads the position from phyMOTION parameter P22. Otherwise the position is read from parameter P20.

As a default, spec will use relative rather than absolute moves for motors configured with an encoder. Absolute positioning can be selected by setting the nonstandard optional motor parameter "encoder_move_mode" to the string "absolute" (as of spec release 6.04.01). To set the parameter, go the associated motor column on the Motor screen of the configuration editor and type p to reach the custom parameter screen. Then enter strings for the parameter name and value:

Custom Parameters for Motor 10 "Two Theta" (tth)

NAME                      VALUE
encoder_move_mode         absolute

For the "Unit/[Module/]/Channel" motor numbering, the unit numbers start at zero and corresponds to the unit numbers on the Devices screen. The module numbers start at one and count only motor modules from left to right in the phyMOTION crate. Channel numbers also start from one. If the field is left blank, unit, module and channel numbers will be assigned consecutively, assuming one-motor per module.

PARAMETERS

The phyMOTION controller has a number of parameters associated with each axis. spec programs some of those parameters, as described below. Other parameters can be programmed using motor_par() command pass through. See FUNCTIONS below.

spec programs the base rate (P04), slew rate (P14) and acceleration (P15). spec also programs the home base rate (P10), home slew rate (P08) and home acceleration (P09). The controllers have a function to automatically perform back correction. spec programs that parameter (P25) with the backlash value from the config file.

HOME SEARCHES

For home searches, spec uses the commands RCW and RCCW for positive and negatives searches ("home+" and "home-"). The commands R+ and R- are used with limit searches ("lim+" and "lim-"). If the standard optional motor parameter "home_method" is set to a home command, spec will send that command with the "home" search. Home searches are initiated with the home macro which invokes the chg_dial() function. See chg_dial() in the motors help file.

FUNCTIONS

The following motor_par() options are available for the phyMOTION controllers. Most are associated with the controller unit, rather than a particular motor channel. For those commands, mne is any motor mnemonic associated with the particular controller.

Digital Input/Output Modules

Commands for the digital input/output (DIO) modules follow. Although Phytron labels the input and output pins from 1 to 8, spec uses bit numbers 0 to 7 to maintain a consistent syntax with the other devices spec supports that have digital I/O functionality.

If there is more than one DIO module, the value argument is a string of the form "mod:val", where mod is the DIO module number starting from one (not the slot number in the crate). That is, the first DIO module is number 1, the second DIO module is number 2 and so on. If there is more than one module and mod is missing, module number 1 is assumed.

motor_par(mne, "set_bit", val)
Turn on the output pin corresponding to bit number val. Bits numbers 0 to 7 correspond to output pins 1 to 8. If there is more than one DIO module, use "mod:val".
motor_par(mne, "clr_bit", val)
Turn off the output pin corresponding to bit number val. Bits numbers 0 to 7 correspond to output pins 1 to 8. If there is more than one DIO module, use "mod:val".
motor_par(mne, "set_bits"|"put_bits"|"put_byte" [, val])

Turn on output pins corresponding to the bits set in val and turn off output pins corresponding to the bits not set in val. For example,

motor_par(mne, "set_bits", 0x13)

would turn on pins 1, 2 and 5. If there is more than one DIO module, use "mod:val".

motor_par(mne, "get_obits" [, mod])
Returns an 8-bit value that reflects the current setting of all eight output pins. If there is more than one DIO module, specify which with the argument mod.
motor_par(mne, "get_bit", val)
Returns 0 or 1 based on whether the input pin corresponding to bit number val is high or low. Bit numbers 0 to 7 correspond to output pins 1 to 8. If there is more than one DIO module, use "mod:val".
motor_par(mne, "get_bits"|"get_byte" [, mod])
Returns an 8-bit value that reflects the setting of all eight input pins. If there is more than one DIO module, specify which with the argument mod.

Analog Input/Output Modules

Commands for the analog input and output (AIO) modules follow. Channels are numbered 1 to 4.

If there is more than one AIO module, the argument is a string of the form "mod:chan", where mod is the AIO module number starting from one, not the slot number in the crate. That is, the first AIO module is number 1, the second is number 2 and so on. If there is more than one module and mod is missing, module number 1 is assumed.

motor_par(mne, "get_adc_mode", chan)

Returns a value of 0, 1 or 2 for the ADC mode for the designated channel as follows:

0 unipolar voltage
1 bipolar voltage
2 unipolar current
motor_par(mne, "set_adc_mode", chan, mode)
Sets the ADC mode for the designated channel, where mode has a value of 0, 1 or 2 corresponding to the table above.
motor_par(mne, "get_adc", chan)
Returns the current analog reading from the designated channel. Values are from 0 to 10 Volts in unipolar voltage mode, from -10 to 10 Volts in bipolar voltage mode and from 0 to 20 milliamps in unipolar current mode.
motor_par(mne, "get_dac_mode", chan)
Returns the DAC mode for the designated channel with values according to the above table.
motor_par(mne, "set_dac_mode", chan, mode)
Sets the DAC mode for the designated channel, where mode has a value of 0, 1 or 2 corresponding to the table above.
motor_par(mne, "set_dac", chan, val)

Sets the DAC value of the for designated channel to the specified value. Values are from 0 to 10 Volts in unipolar voltage mode, from -10 to 10 Volts in bipolar voltage mode and from 0 to 20 milliamps in unipolar current mode. For example:

SPEC> motor_par(0, "set_dac", 2, 3.33)
SPEC> p motor_par(0, "get_dac", 2)
3.32998
motor_par(mne, "get_dac", chan)
Returns the programmed value for the designated DAC channel.

Command Pass Through

The following commands can be used to send arbitrary ASCII messages to the controller and read the response.

motor_par(mne, "send", cmd)
Sends the command string cmd to the motor channel mne. The module and axis address will be added to the command.
motor_par(mne, "read", cmd)

Sends a command as above and returns the reply. For example:

SPEC> p motor_par(0, "read", "P20R")
2000
motor_par(mne, "usend", cmd)
Sends the command string cmd to the controller associated with motor mne, but does not add module and axis addressing to the command.
motor_par(mne, "uread", cmd)

Sends a command as above and returns the reply. For example:

SPEC> p motor_par(0, "uread", "IVM")
V1.1.05 (MCM01 Minilog System)

Status Commands

motor_par(mne, "show")

Displays the module configuration of the phyMOTION unit associated with motor mne along these lines:

slot   0:  MCM01  (CPU and bus module)
slot   1: I1AM02  (1-axis stepper drive 5A)
slot   2: I1AM02  (1-axis stepper drive 5A)
slot   3: I1AM02  (1-axis stepper drive 5A)
slot   4: I1AM02  (1-axis stepper drive 5A)
slot   5: I1AM02  (1-axis stepper drive 5A)
slot   6: I1AM02  (1-axis stepper drive 5A)
slot   7: I1AM02  (1-axis stepper drive 5A)
slot   8: I1AM02  (1-axis stepper drive 5A)
slot   9: I1AM02  (1-axis stepper drive 5A)
slot  10: I1AM02  (1-axis stepper drive 5A)
slot  11: IDXM01  (4-axis Indexer module)
slot  12: DIOM01  (Digital I/O)
    input  = 00000000 (0x00, 0)
    output = 00000000 (0x00, 0)
slot  13: AIOM01  (Analog I/O)
    ADC chan 1: unipolar voltage at 0V
    ADC chan 2: unipolar voltage at 0V
    ADC chan 3: unipolar voltage at 0V
    ADC chan 4: unipolar voltage at 0V
    DAC chan 1: unipolar voltage at 0V
    DAC chan 2: unipolar voltage at 0V
    DAC chan 3: unipolar voltage at 0V
    DAC chan 4: unipolar voltage at 0V

In addition to displaying the module type, current settings for digital input and output bits are shown along with current parameters and values for analog input and output channels on the analog modules.

motor_par(mne, "dump")

Displays parameters associated with specified motor axis formatted as follows:

P01 = 0 (movement type)
P02 = 1 (units)
P03 = 1 (conversion factor)
P04 = 400 (base rate)
P07 = 20000 (emergency-stop acceleration)
P08 = 2000 (home-search speed)
P09 = 10000 (home-search acceleration)
P10 = 400 (home-search low speed)
P11 = 0 (offset between zero and +limit)
P12 = 0 (offset between zero and -limit)
P13 = 20 (recovery time after homing)
P14 = 400 (slew rate)
P15 = 10000 (acceleration)
P16 = 20 (recovery time after move)
P17 = 2 (boost)
P19 = 0 (encoder deviation)
P20 = 2000 (mechanical zero counter)
P21 = 2000 (absolute counter)
P22 = 0 (encoder counter)
P23 = 0 (software +limit)
P24 = 0 (software -limit)
P25 = 0 (backlash compensation)
P26 = 10 (encoder data transfer rate)
P27 = 7 (limit switch type)
P28 = 1 (axis options)
P30 = 0 (frequency band setting)
P31 = 3 (frequency and ramp predivider)
P34 = 0 (encoder type)
P35 = 10 (encoder resolution)
P36 = 0 (encoder function)
P37 = 0 (encoder tolerance)
P38 = 0 (encoder preferential direction)
P39 = 1 (encoder conversion factor)
P40 = 20 (stop current)
P41 = 90 (run current)
P42 = 180 (boost current)
P43 = 20 (current hold time)
P44 = 0 (control pulse origin)
P45 = 0 (step resolution)
P49 = 400 (power stage temperature)
P50 = 0 (divider for control pulses)
P51 = 19 (pulse width)
P53 = 1 (power stage monitoring)
P54 = -999999 (motor temperature)