\subsection{Delta Tau PMAC}
%
\textit{Platform: All}
\newline

The PMAC series of motor controllers is manufactured by
%\Link[http://www.deltatau.com/]{}{}\ Delta Tau Data Systems\EndLink\ 
\MxLink{http://www.deltatau.com/}{Delta Tau Data Systems}
of Chatsworth, CA.  PMAC motor controllers are definitely the most powerful
motor controllers supported by MX.  However, they are also the most
complicated to setup and program of all the controllers supported by MX,
so they may not be the best choice for simple applications.

The MX PMAC drivers are designed to be easily adaptable to any model of
PMAC motor controller.  However, the drivers have been tested mainly
with the Turbo PMAC series of controllers.  There is also limited support
for the Power PMAC series and lightly tested support for the original
legacy PMAC 1 series.

\textbf{Note:} If you are using a Power PMAC controller, you will be better
off using the MX \textit{powerpmac} series of drivers described in the
next section of this manual.  The \textit{powerpmac} drivers support a much
larger amount of the total functionality of a Power PMAC.

The drivers listed below
currently all operate via PMAC ASCII communication interfaces of various
types.

MX has a large number of drivers for interacting with PMAC motor controllers:

\begin{tabular}{lp{9.5cm}}
    \textit{pmac} &
      Interface driver for controlling one or more PMAC motor controllers
      connected to an ASCII serial interface. \\
  
    \textit{pmac\_motor} &
      Motor driver for controlling a single motor of a PMAC controller. \\
  
    \textit{pmac\_cs\_axis} &
      Motor driver for controlling a coordinate system axis belonging to
      a PMAC motor controller. \\
  
    \textit{pmac\_mce} &
      Multichannel encoder (MCE) driver for reading out any motor belonging
      to a given PMAC motor controller. \\
  
    \textit{pmac\_ainput} &
      Analog input driver for reading a floating point value from
      a PMAC variable. \\
  
    \textit{pmac\_aoutput} &
      Analog output driver for writing a floating point value to
      a PMAC variable. \\
  
    \textit{pmac\_dinput} &
      Digital input driver for reading an integer value from a PMAC variable. \\
  
    \textit{pmac\_doutput} &
      Digital output driver for writing an integer value to a PMAC variable. \\
  
    \textit{pmac\_long} &
      Variable driver for reading and writing signed integer values
      to and from a PMAC variable. \\
  
    \textit{pmac\_ulong} &
      Variable driver for reading and writing unsigned integer values
      to and from a PMAC variable. \\
  
    \textit{pmac\_double} &
      Variable driver for reading and writing floating point values
      to and from a PMAC variable. \\
\end{tabular}

\subsubsection{MX PMAC drivers}
%
% "pmac" interface records
%
\textbf{pmac} driver

        \textit{Pmac} interface records are used to control one or more
	PMAC motor controllers attached to a given external interface.
	An example \textit{pmac} record looks like
\begin{verbatim}
pmac1 interface controller pmac "" "" rs232 pmac1_rs232 1
\end{verbatim}
	which describes a single PMAC motor controller attached to 
	MX RS-232 record \textbf{pmac1\_rs232}.

	The driver-specific record fields are
	\newline
	%
	\newcommand{\MxFieldPmacPortZtypeZname}
	{A string such as \textit{rs232} that describes the type of
	PMAC interface this is.  See below for more information.}
	%
	\newcommand{\MxFieldPmacPortZargs}
	{This contains port type specific information such as the name
	of an RS-232 port record.  See below for more information.}
	%
	\newcommand{\MxFieldPmacNumZcards}
	{The number of individual PMAC controllers attached to this
	interface.  In most cases this will be 1.  However, for a 
	controller attached to a multidrop connection such as RS-485,
	this will be the number of controllers attached to the multidrop.}
	%
	\MxPmacDriverFields

	\ \newline
	PMAC ASCII command interfaces are accessible via a variety
	of different mechanisms such as RS-422, Ethernet, USB, VME, etc.
	Since the information needed to describe the interface can vary
	widely from interface type to interface type, the information
	needed to the interface is specified in a string called
	\textit{port\_args}.  The currently defined port types are:

	\begin{tabular}{|c|p{122mm}|}
	\hline
	\textit{port\_type\_name} & \textit{port\_args} \\
	\hline
	\textbf{rs232} & The name of the MX RS-232/422/485 record that
			this PMAC interface is attached to,
			such as \textit{pmac1\_rs232} in the example below.\\
	\hline
	\textbf{tcp} & The network hostname of the PMAC.

			The network protocol
			for this port type is described in the
			``PMAC ETHERNET PROTOCOL''
			section of the manual for the
			Delta Tau Acc-54E UMAC board.
			The TCP port number is not specified since the protocol
			requires it to always be 1025.

			\textbf{Note:}  Only TCP connections are supported.
			Currently USB and UDP connections are \textbf{not}
			supported.
			\\
	\hline
	\textbf{gpascii} &
			This case is for a Power PMAC that is being controlled
			over a Telnet connection using Delta Tau's
			\textbf{gpascii} command.

			The port\_args string for this case
			looks like
			\texttt{"pmac1\_socket root deltatau"}.

			The first field in this string is the name of the
			MX RS-232 record used to communicate with the
			Power PMAC.  This record \textbf{must} be of
			type \textit{telnet}, since the Power PMAC will
			perform Telnet negotiation with the MX client.
			Records of type \textit{tcp232} will \textbf{not}
			work since the \textit{tcp232} driver does not
			know how to handle Telnet negotiation.

			The second field is the name of
			the account used to login to the Power PMAC.
			The default is \textit{root}.  The \textit{gpascii}
			interface has not been tested with non-root accounts.

			The third field is the password of the account
			used to login to the Power PMAC.  The default
			is \textit{deltatau}.
			\\
	\hline
	\textbf{gplib} &
			This is for the special case of an MX server that
			is running on the Power PMAC itself with the MX
			library linked to the Delta Tau provided libraries.
			For this case, the \textit{port\_args} string is
			empty.

			\textbf{Warning:} It is \textbf{strongly} recommended
			that you use the MX \textit{powerpmac} series of
			drivers rather than the MX \textit{pmac} drivers,
			since the \textit{powerpmac} drivers exports a 
			much larger fraction of the total functionality
			of a Power PMAC.
			\\
	\hline
	\textbf{epics\_ect} & This port type uses the string command and
			response interfaces provided with the EPICS PMAC
			software written by Tom Coleman of the 
			Argonne National Laboratory ECT group.
			This port type uses EPICS process variable names
			that are constructed by appending ``StrCmd''
			or ``StrRsp'' to the names.  Thus, if the port
			args were ``S18ID'', then the EPICS process
			variables used by this interface would be
			\textit{S18IDStrCmd.VAL} and
			\textit{S18IDStrRsp.VAL}.
			\\
	&		Note: There is an alternate set of MX EPICS drivers
			called
			\textit{pmac\_tc\_motor} and \textit{pmac\_bio\_motor}
			that is described elsewhere in this manual.
			\\
	\hline
	\end{tabular}
	\newline
	\newline
%
%\ \newline

	Here are some examples of MX database records for each port type:
	\ \newline\newline
%
	Port type \textit{rs232}:
	\newline\newline
	\mbox{\ \ \ \ } Via a Linux tty port:
\begin{verbatim}
pmac1_rs232 interface rs232 tty "" "" 38400 8 N 1 H 0xd 0xd -1 0x0 /dev/ttyS5
pmac1 interface controller pmac "" "" rs232 pmac1_rs232 1
\end{verbatim}
	\mbox{\ \ \ \ } Via a network socket:
\begin{verbatim}
pmac1_rs232 interface rs232 tcp232 "" "" 38400 8 N 1 H 0xd 0xd -1 0x0 w11 3001 0x0
pmac1 interface controller pmac "" "" rs232 pmac1_rs232 1
\end{verbatim}
%
	Port type \textit{tcp}:
\begin{verbatim}
pmac1 interface controller pmac "" "" tcp 192.168.0.1 1
\end{verbatim}
%
	Port type \textit{gpascii}:
\begin{verbatim}
pmac1_socket interface rs232 telnet "" "" 38400 8 N 1 H 0x0d0a 0x0d0a -1 0x0 powerpmac 23 0x0
pmac1 interface controller pmac "" "" gpascii "pmac1_socket root deltatau" 1
\end{verbatim}
%
	Port type \textit{gplib}:
\begin{verbatim}
pmac1 interface controller pmac "" "" gplib "" 1
\end{verbatim}

%
% "pmac_motor" motor records
%
\ \newline
\textbf{pmac\_motor} driver

    	A \textit{pmac\_motor} record refers to one particular motor
	in a PMAC motor controller.  The motor is controlled mostly via
	PMAC ``jog'' mode commands except for certain features not available
	via jog commands.
	
	An example \textit{pmac\_motor} record looks like
\begin{verbatim}
x1 device motor pmac_motor "" "" 0 0 -10000000 10000000 0 -1 -1   0.05 0 um pmac1 0 4
\end{verbatim}
	which describes a motor called \textbf{x1} which belongs to
	controller 0, axis 4 of PMAC interface \textbf{pmac1}.
	The example motor uses a scale factor of 0.05 $\mu$-meters per step
	and raw motion limits of $\pm$ 10000000 steps.
%
	\newline
	\newcommand{\MxFieldPmacZmotorPmacZrecord}
	{Name of the PMAC interface record that controls this motor.}
	\newcommand{\MxFieldPmacZmotorCardZnumber}
	{Card number of the PMAC card that controls this motor.
	For PMACs that are not in a multi-drop configuration, the
	card number will normally be 0.}
	\newcommand{\MxFieldPmacZmotorMotorZnumber}
	{The PMAC motor number for this specific motor.}
	%
	\MxPmacZmotorDriverFields
	\newline
%
% "pmac_cs_axis" motor records
%

\ \newline
\textbf{pmac\_cs\_axis} driver

	\textit{ Note: This driver does not support Power PMAC
	controllers at all.  For Power PMAC controllers, use the
	powerpmac\_cs\_axis driver instead.}

    	A \textit{pmac\_cs\_axis} record makes use of a specified 
	coordinate system axis for a coordinate system defined in a
	PMAC controller.  PMAC coordinate systems can be thought of
	as a way of defining ``pseudomotors'' inside a PMAC controller
	in a manner that is analogous to the way MX defines pseudomotors.
	However, PMAC coordinate system axes are more powerful than
	MX pseudomotors, since for a coordinate system, the PMAC controller
	is able to ensure that all of the raw motors are able to maintain
	their correct relative relationship even while the motors are moving.
	Ordinary MX pseudomotors make sure that the real motors are
	at the correct positions at the beginning and end of motor
	moves, but they cannot do this while a move is in progress.

	\textit{Pmac\_cs\_axis} motor records require that some preliminary
	setup be done in the PMAC before they may be used.  There are three
	primary steps in this process:
	\begin{itemize}
	\item The coordinate system that this axis is to be part of must
		be set up before this record may be used.
	\item You must write a motion program that will be run every time
		a move of this axis is commanded.  The motion program
		\textbf{must} define the move destination, the feedrate
		(\textit{reciprocal of the speed}), the acceleration time,
		and the S curve acceleration times in terms of PMAC
		motion variables so that the \textit{pmac\_cs\_axis}
		driver can set them.  I recommend that you use Q-variables
		so that variables used by this coordinate system will not
		interfer with other coordinate systems used by your PMAC.
	\item You must arrange for the current position of the coordinate
		system axis to be continuously updated to a PMAC variable
		that you specify.  The most obvious way to do this is
		with a constantly running PMAC PLC program which is set
		up to calculate the coordinate system axis position from
		the real motor positions at all times.  I would recommend
		that you use a Q-variable for this too.  Of course, the
		kinematic calculation logic of the PLC program must match
		the logic of the PMAC motion program mentioned above.

	\end{itemize}

	An example \textit{pmac\_cs\_axis} record looks like
\begin{verbatim}
det_distance motor pmac_cs_axis "" "" 0 0 200 1000 0 -1 -1 1 0 mm pmac1 0 2 Z 3 Q50 Q51 Q52 Q53 Q54
\end{verbatim}
	This describes a motor called \textbf{det\_distance} which
	corresponds to axis Z of coordinate system 2 running in card 0
	of PMAC interface \textbf{pmac1}.  The axis performs moves using
	motion program 3 with position, destination, feedrate,
	acceleration time, and S-curve acceleration time managed by
	PMAC coordinate system variables Q50 through Q54.
	\newline
	\newcommand{\MxFieldPmacZcsZaxisPmacZrecord}
	{Name of the interface record for the PMAC that runs this
	coordinate system.}
	%
	\newcommand{\MxFieldPmacZcsZaxisCardZnumber}
	{Card number of the PMAC card that controls this axis.
	For PMACs that are not in a multi-drop configuration,
	the card number will normally be 0.}
	%
	\newcommand{\MxFieldPmacZcsZaxisCoordinateZsystem}
	{The PMAC coordinate system number.}
	%
	\newcommand{\MxFieldPmacZcsZaxisAxisZname}
	{The name of the coordinate system axis used by this motor.
	The possible names are X, Y, Z, A, B, and C.}
	%
	\newcommand{\MxFieldPmacZcsZaxisMoveZprogramZnumber}
	{The number of the motion program that is used to move this
	axis as part of the coordinate system.}
	%
	\newcommand{\MxFieldPmacZcsZaxisPositionZvariable}
	{Name of the PMAC variable that the MX driver uses to 
	read the current position of the axis from.}
	%
	\newcommand{\MxFieldPmacZcsZaxisDestinationZvariable}
	{The MX driver writes the new axis destination to this PMAC
	variable before starting the motion program to perform the move.}
	%
	\newcommand{\MxFieldPmacZcsZaxisFeedrateZvariable}
	{The MX driver sets the axis speed by writing to the specified
	PMAC feedrate variable.}
	%
	\newcommand{\MxFieldPmacZcsZaxisAccelerationZtimeZvariable}
	{The MX driver sets the axis acceleration time by writing to
	this variable.}
	%
	\newcommand{\MxFieldPmacZcsZaxisSZcurveZaccelerationZtimeZvar}
	{The MX driver sets the axis acceleration time by writing to
	this variable.}
	%
	\MxPmacZcsZaxisDriverFields
	\newline

	\textit{Note:}
	If all you want is basic control of the individual motors belonging
	to a PMAC controller, then it is not necessary to create MX
	\textit{pmac\_cs\_axis} motor records or coordinate systems in
	the PMAC.  You can get basic control of the motors with just
	the \textit{pmac\_motor} records, with much less setup required.
	You only need \textit{pmac\_cs\_axis} records if you want to make
	use of the special abilities of PMAC coordinate systems.

%
% "pmac_mce" multichannel encoder records
%
\ \newline
\textbf{pmac\_mce} driver
\newline
    	A \textit{pmac\_mce} record is used to save the positions of
	the moving PMAC motor during an MX quick scan, so that they can
	be read out at the end of the scan.
	\textit{MCE} stands for multichannel encoder; a term that is
	thought to have been originated by the author.
	This feature is implemented
	by permanently assigning one of the motors in the PMAC to be 
	a slave motor, not connected to a real motor axis.  Instead,
	it is slaved at run time to the primary real motor axis of
	the move.
	The slave motor is programmed to always generate step and direction
	output, which is converted by a small amount of electronic login
	into clockwise (CW) and counterclockwise (CCW) pulse trains which
	can be fed into two channels of a multichannel scaler.

	\textit{*** A figure here might help. ***}

	For more information, read the section on Multichannel encoders
	further on in this document and also read the chapter about MX scans.
	\newline
	%
	\newcommand{\MxFieldPmacZmcePmacZrecord}
	{This field specifies the name of the PMAC controller that
	contains the slave axis for this particular PMAC.}
	%
	\newcommand{\MxFieldPmacZmceCardZnumber}
	{Card number of the PMAC controller that contains the slave axis
	for this particular PMAC.}
	%
	\newcommand{\MxFieldPmacZmceMcsZrecord}
	{Name of the multichannel scaler (MCS) record that the 
	clockwise (CW) and counterclockwise (CCW) pulse trains are
	sent to.}
	%
	\newcommand{\MxFieldPmacZmceDownZchannel}
	{Number of the MCS channel that receives the counterclockwise pulses.}
	%
	\newcommand{\MxFieldPmacZmceUpZchannel}
	{Number of the MCS channel that receives the clockwise pulses.}
	%
	\newcommand{\MxFieldPmacZmcePlcZprogramZnumber}
	{Number of the PMAC PLC program that is run when the assignment
	of the slave axis to a master is changed.
	If you specify a negative number for this field, the driver uses
	the absolute value of it as the slave motor axis number and does
	not use a PLC program.}
	%
	\MxPmacZmceDriverFields

\begin{center}
\textbf{PMAC Analog and Digital I/O Drivers}
\end{center}
%
\textbf{pmac\_ainput} driver

	This is an MX analog input driver that reads a floating point
	value from a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZainputPmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZainputCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZainputPmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZainputDriverFields

\ \newline
\textbf{pmac\_aoutput} driver

	This is an MX analog output driver that writes a floating point
	value to a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZaoutputPmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZaoutputCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZaoutputPmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZaoutputDriverFields

\ \newline
\textbf{pmac\_dinput} driver

	This is an MX digital input driver that reads an integer
	value from a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZdinputPmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZdinputCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZdinputPmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZdinputDriverFields

\ \newline
\textbf{pmac\_doutput} driver

	This is an MX analog output driver that writes an integer
	value to a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZdoutputPmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZdoutputCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZdoutputPmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZdoutputDriverFields

\begin{center}
\textbf{PMAC Variable Drivers}
\end{center}
%
\textbf{pmac\_long} driver

	This is an MX variable driver for reading and writing signed
	integer values to and from a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZlongPmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZlongCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZlongPmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZlongDriverFields

\ \newline
\textbf{pmac\_ulong} driver

	This is an MX variable driver for reading and writing unsigned
	integer values to and from a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZulongPmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZulongCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZulongPmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZulongDriverFields

\ \newline
\textbf{pmac\_double} driver

	This is an MX variable driver for reading and writing unsigned
	integer values to and from a PMAC variable.
	%
	\newline
	%
	\newcommand{\MxFieldPmacZdoublePmacZrecord}
	{The name of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZdoubleCardZnumber}
	{The card number of the PMAC that contains this PMAC variable.}
	%
	\newcommand{\MxFieldPmacZdoublePmacZvariableZname}
	{The name of the PMAC variable.}
	%
	\MxPmacZdoubleDriverFields
