forked from epics_driver_modules/motorBase
Removed NewFocusSrc; Added motorNewFocus submodule
This commit is contained in:
@@ -55,3 +55,6 @@
|
||||
[submodule "modules/motorMicos"]
|
||||
path = modules/motorMicos
|
||||
url = https://github.com/epics-motor/motorMicos.git
|
||||
[submodule "modules/motorNewFocus"]
|
||||
path = modules/motorNewFocus
|
||||
url = https://github.com/epics-motor/motorNewFocus.git
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
TOP = ../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
ARCH = linux-x86_64
|
||||
TARGETS += envPaths
|
||||
include $(TOP)/configure/RULES.ioc
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
file "$(MOTOR)/db/basic_asyn_motor.db"
|
||||
{
|
||||
pattern
|
||||
{P, N, M, DTYP, PORT, ADDR, C, S, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
|
||||
{IOC:, 1, "X", "asynMotor", M0, 1, 0, 0, "X", counts, Pos, 100, 25, 1, 0, 0, 50, 1, 0, 0, 0, ""}
|
||||
{IOC:, 2, "Y", "asynMotor", M0, 2, 0, 0, "Y", counts, Pos, 100, 25, 1, 0, 0, 50, 1, 0, 0, 0, ""}
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#!../../bin/linux-x86_64/picoctl
|
||||
|
||||
## You may have to change picoctl to something else
|
||||
## everywhere it appears in this file
|
||||
|
||||
< envPaths
|
||||
|
||||
epicsEnvSet("EPICS_CA_AUTO_ADDR_LIST", "NO")
|
||||
epicsEnvSet("EPICS_CA_ADDR_LIST", "10.28.0.255")
|
||||
|
||||
epicsEnvSet("Sys", "Sys")
|
||||
epicsEnvSet("Port", "P0")
|
||||
epicsEnvSet("ControllerPort", "M0")
|
||||
epicsEnvSet("MC", "MC:10")
|
||||
epicsEnvSet("CT", "CT")
|
||||
epicsEnvSet("IOC_PREFIX", "$(CT){IOC:MC10}")
|
||||
epicsEnvSet("MC_PREFIX", "$(CT){$(MC)}")
|
||||
|
||||
cd ${TOP}
|
||||
|
||||
## Register all support components
|
||||
dbLoadDatabase "dbd/picoctl.dbd"
|
||||
picoctl_registerRecordDeviceDriver pdbbase
|
||||
|
||||
# Setup IP port for 8742
|
||||
drvAsynIPPortConfigure("$(Port)", "10.28.2.111:23")
|
||||
asynOctetSetInputEos("$(Port)",0,"\r\n")
|
||||
asynOctetSetOutputEos("$(Port)",0,"\r")
|
||||
|
||||
#db asyn debug traces
|
||||
asynSetTraceMask("$(Port)",-1,0x1)
|
||||
asynSetTraceIOMask("$(Port)",-1,0x1)
|
||||
|
||||
|
||||
# New Focus Picomotor Network Controller (model 87xx) configuration parameters:
|
||||
# (1) IP asyn port name (string)
|
||||
# (2) Controller asyn port name (string)
|
||||
# (3) Number of axes
|
||||
# (4) Moving poll period (ms)
|
||||
# (5) Idle poll period (ms)
|
||||
nf874xCreateController("$(ControllerPort)", "$(Port)", 4, 200, 1000)
|
||||
|
||||
## Load record instances
|
||||
dbLoadTemplate("iocBoot/iocNewFocus874x/newfocus8742.asyn.motor.substitutions")
|
||||
|
||||
dbLoadRecords("${ASYN}/db/asynRecord.db", "P=$(MC_PREFIX),R=Asyn,PORT=$(Port),ADDR=,OMAX=80,IMAX=80")
|
||||
|
||||
## autosave/restore machinery
|
||||
save_restoreSet_Debug(0)
|
||||
save_restoreSet_IncompleteSetsOk(1)
|
||||
save_restoreSet_DatedBackupFiles(1)
|
||||
|
||||
set_savefile_path("${TOP}/as","/save")
|
||||
set_requestfile_path("${TOP}/as","/req")
|
||||
|
||||
set_pass0_restoreFile("info_positions.sav")
|
||||
set_pass0_restoreFile("info_settings.sav")
|
||||
set_pass1_restoreFile("info_settings.sav")
|
||||
|
||||
iocInit()
|
||||
|
||||
## more autosave/restore machinery
|
||||
cd ${TOP}/as/req
|
||||
makeAutosaveFiles()
|
||||
create_monitor_set("info_positions.req", 5 , "")
|
||||
create_monitor_set("info_settings.req", 15 , "")
|
||||
|
||||
@@ -44,18 +44,6 @@ dbLoadRecords("$(MOTOR)/db/motorUtil.db", "P=IOC:")
|
||||
#!IM483PLConfig(0, "a-Serial[0]")
|
||||
#!drvIM483PLdebug=4
|
||||
|
||||
# New Focus Picomotor Network Controller (model 8750/2) (setup parameters:
|
||||
# (1) maximum number of controllers in system
|
||||
# (2) maximum number of drivers per controller (1 - 3)
|
||||
# (3) motor task polling rate (min=1Hz,max=60Hz)
|
||||
#!PMNC87xxSetup(1, 2, 10)
|
||||
|
||||
# New Focuc Picomotor Network Controller (model 8750/2) configuration parameters:
|
||||
# (1) controller# being configured,
|
||||
# (2) asyn port name (string)
|
||||
#!PMNC87xxConfig(0, "serial2")
|
||||
#!drvPMNC87xxdebug=4
|
||||
|
||||
|
||||
# IMS MDrive driver setup parameters:
|
||||
# (1) maximum number of controllers in system
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# ### Newfocus_PMNC87xx.iocsh ###
|
||||
|
||||
#- ###################################################
|
||||
#- PORT - Serial port for communications
|
||||
#- CONTROLLER - Optional: Which controller is being configured
|
||||
#- Default: 0
|
||||
#-
|
||||
#- NUM_AXES - Optional: Number of axes on this controller
|
||||
#- Default: 1
|
||||
#-
|
||||
#- MAX_CONTROLLERS - Optional: Max number of controllers that will be configured
|
||||
#- Default: 1
|
||||
#-
|
||||
#- MAX_DRIVES - Optional: Max number of drives per controller
|
||||
#- Default: 1
|
||||
#-
|
||||
#- POLL_RATE - Optional: Controller poll rate in hertz
|
||||
#- Default: 10
|
||||
#- ###################################################
|
||||
|
||||
#- NewFocus Picomotor driver setup parameters:
|
||||
#- (1) maximum number of controllers in system
|
||||
#- (2) maximum drives per controller
|
||||
#- (3) motor task polling rate (min=1Hz, max=60Hz)
|
||||
$(PMNC87XX_INIT_COMPLETE="") PMNC87xxSetup($(MAX_CONTROLLERS=1), $(MAX_DRIVES=1), $(POLL_RATE=10))
|
||||
|
||||
#- Serial port configuration
|
||||
iocshLoad("$(IP)/iocsh/setSerialParams.iocsh", "PORT=$(PORT), BAUD=19200, BITS=8, STOP=1, PARITY=none")
|
||||
asynOctetSetInputEos( "$(PORT)", -1, "\r")
|
||||
asynOctetSetOutputEos("$(PORT)", -1, "\r")
|
||||
|
||||
#- NewFocus Picomotor driver configuration parameters:
|
||||
#- (1) controller being configured
|
||||
#- (2) asyn port name (string)
|
||||
PMNC87xxConfig($(CONTROLLER=0), "$(PORT)")
|
||||
|
||||
epicsEnvSet("PMNC87XX_INIT_COMPLETE", "#")
|
||||
@@ -18,6 +18,7 @@ SUBMODULES += motorMclennan
|
||||
SUBMODULES += motorMicos
|
||||
SUBMODULES += motorMicroMo
|
||||
SUBMODULES += motorMicronix
|
||||
SUBMODULES += motorNewFocus
|
||||
SUBMODULES += motorNPoint
|
||||
SUBMODULES += motorOriel
|
||||
SUBMODULES += motorPiJena
|
||||
|
||||
Submodule
+1
Submodule modules/motorNewFocus added at eb6d3f5938
@@ -30,9 +30,6 @@ PIGCS2Src_DEPEND_DIRS = MotorSrc
|
||||
DIRS += PC6KSrc
|
||||
PC6KSrc_DEPEND_DIRS = MotorSrc
|
||||
|
||||
DIRS += NewFocusSrc
|
||||
NewFocusSrc_DEPEND_DIRS = MotorSrc
|
||||
|
||||
DIRS += AerotechSrc
|
||||
AerotechSrc_DEPEND_DIRS = MotorSrc
|
||||
|
||||
|
||||
@@ -1,349 +0,0 @@
|
||||
/*
|
||||
FILENAME... 874xMotorDriver.cpp
|
||||
USAGE... Motor driver support for the NewFocus 874x series motor controller
|
||||
|
||||
Based on ACRMotorDriver.cpp by:
|
||||
Mark Rivers
|
||||
March 4, 2011
|
||||
|
||||
== Modifications ==
|
||||
2015-12-01 - Wayne Lewis - Modify for NewFocus 874x series
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO: Extend for 8743 closed loop functionality
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <iocsh.h>
|
||||
#include <epicsThread.h>
|
||||
|
||||
#include <asynOctetSyncIO.h>
|
||||
|
||||
#include "asynMotorController.h"
|
||||
#include "asynMotorAxis.h"
|
||||
|
||||
#include <epicsExport.h>
|
||||
#include "874xMotorDriver.h"
|
||||
|
||||
static const char *driverName = "nf874xMotorDriver";
|
||||
|
||||
/** Creates a new nf874xController object.
|
||||
* \param[in] portName The name of the asyn port that will be created for this driver
|
||||
* \param[in] nf874xPortName The name of the drvAsynIPPPort that was created previously to connect to the nf874x controller
|
||||
* \param[in] numAxes The number of axes that this controller supports. Create one extra axis to allow for base 1 indexing of NewFocus controllers.
|
||||
* \param[in] movingPollPeriod The time between polls when any axis is moving
|
||||
* \param[in] idlePollPeriod The time between polls when no axis is moving
|
||||
*/
|
||||
nf874xController::nf874xController(const char *portName, const char *nf874xPortName, int numAxes,
|
||||
double movingPollPeriod, double idlePollPeriod)
|
||||
//: asynMotorController(portName, numAxes, NUM_nf874x_PARAMS,
|
||||
: asynMotorController(portName, numAxes+1, 0,
|
||||
asynUInt32DigitalMask,
|
||||
asynUInt32DigitalMask,
|
||||
ASYN_CANBLOCK | ASYN_MULTIDEVICE,
|
||||
1, // autoconnect
|
||||
0, 0) // Default priority and stack size
|
||||
{
|
||||
int axis;
|
||||
asynStatus status;
|
||||
static const char *functionName = "nf874xController";
|
||||
|
||||
/* Connect to nf874x controller */
|
||||
status = pasynOctetSyncIO->connect(nf874xPortName, 0, &pasynUserController_, NULL);
|
||||
if (status) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"%s:%s: cannot connect to nf874x controller\n",
|
||||
driverName, functionName);
|
||||
}
|
||||
epicsThreadSleep(0.5);
|
||||
// Create the axis objects
|
||||
// Axis 0 will remain unused. This allows consistent axis numbering with
|
||||
// NewFocus convention.
|
||||
for (axis=1; axis<=numAxes; axis++) {
|
||||
new nf874xAxis(this, axis);
|
||||
}
|
||||
|
||||
startPoller(movingPollPeriod, idlePollPeriod, 2);
|
||||
}
|
||||
|
||||
|
||||
/** Creates a new nf874xController object.
|
||||
* Configuration command, called directly or from iocsh
|
||||
* \param[in] portName The name of the asyn port that will be created for this driver
|
||||
* \param[in] nf874xPortName The name of the drvAsynIPPPort that was created previously to connect to the nf874x controller
|
||||
* \param[in] numAxes The number of axes that this controller supports.
|
||||
* \param[in] movingPollPeriod The time in ms between polls when any axis is moving
|
||||
* \param[in] idlePollPeriod The time in ms between polls when no axis is moving
|
||||
*/
|
||||
extern "C" int nf874xCreateController(const char *portName, const char *nf874xPortName, int numAxes,
|
||||
int movingPollPeriod, int idlePollPeriod)
|
||||
{
|
||||
new nf874xController(portName, nf874xPortName, numAxes, movingPollPeriod/1000., idlePollPeriod/1000.);
|
||||
return(asynSuccess);
|
||||
}
|
||||
|
||||
/** Reports on status of the driver
|
||||
* \param[in] fp The file pointer on which report information will be written
|
||||
* \param[in] level The level of report detail desired
|
||||
*
|
||||
* If details > 0 then information is printed about each axis.
|
||||
* After printing controller-specific information calls asynMotorController::report()
|
||||
*/
|
||||
void nf874xController::report(FILE *fp, int level)
|
||||
{
|
||||
fprintf(fp, "nf874x motor driver %s, numAxes=%d, moving poll period=%f, idle poll period=%f\n",
|
||||
this->portName, numAxes_, movingPollPeriod_, idlePollPeriod_);
|
||||
|
||||
// Call the base class method
|
||||
asynMotorController::report(fp, level);
|
||||
}
|
||||
|
||||
/** Returns a pointer to an nf874xMotorAxis object.
|
||||
* Returns NULL if the axis number encoded in pasynUser is invalid.
|
||||
* \param[in] pasynUser asynUser structure that encodes the axis index number. */
|
||||
nf874xAxis* nf874xController::getAxis(asynUser *pasynUser)
|
||||
{
|
||||
return static_cast<nf874xAxis*>(asynMotorController::getAxis(pasynUser));
|
||||
}
|
||||
|
||||
/** Returns a pointer to an nf874xMotorAxis object.
|
||||
* Returns NULL if the axis number encoded in pasynUser is invalid.
|
||||
* \param[in] axisNo Axis index number. */
|
||||
nf874xAxis* nf874xController::getAxis(int axisNo)
|
||||
{
|
||||
return static_cast<nf874xAxis*>(asynMotorController::getAxis(axisNo));
|
||||
}
|
||||
|
||||
|
||||
/** Called when asyn clients call pasynInt32->write().
|
||||
* Extracts the function and axis number from pasynUser.
|
||||
* Sets the value in the parameter library.
|
||||
* For all other functions it calls asynMotorController::writeInt32.
|
||||
* Calls any registered callbacks for this pasynUser->reason and address.
|
||||
* \param[in] pasynUser asynUser structure that encodes the reason and address.
|
||||
* \param[in] value Value to write. */
|
||||
asynStatus nf874xController::writeInt32(asynUser *pasynUser, epicsInt32 value)
|
||||
{
|
||||
int function = pasynUser->reason;
|
||||
asynStatus status = asynSuccess;
|
||||
nf874xAxis *pAxis = getAxis(pasynUser);
|
||||
static const char *functionName = "writeInt32";
|
||||
|
||||
/* Set the parameter and readback in the parameter library. This may be overwritten when we read back the
|
||||
* status at the end, but that's OK */
|
||||
status = setIntegerParam(pAxis->axisNo_, function, value);
|
||||
|
||||
status = asynMotorController::writeInt32(pasynUser, value);
|
||||
|
||||
/* Do callbacks so higher layers see any changes */
|
||||
callParamCallbacks(pAxis->axisNo_);
|
||||
if (status)
|
||||
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
||||
"%s:%s: error, status=%d function=%d, value=%d\n",
|
||||
driverName, functionName, status, function, value);
|
||||
else
|
||||
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
|
||||
"%s:%s: function=%d, value=%d\n",
|
||||
driverName, functionName, function, value);
|
||||
return status;
|
||||
}
|
||||
|
||||
/** Called when asyn clients call pasynFloat64->write().
|
||||
* Extracts the function and axis number from pasynUser.
|
||||
* Sets the value in the parameter library.
|
||||
* Calls any registered callbacks for this pasynUser->reason and address.
|
||||
* For all other functions it calls asynMotorController::writeFloat64.
|
||||
* \param[in] pasynUser asynUser structure that encodes the reason and address.
|
||||
* \param[in] value Value to write. */
|
||||
asynStatus nf874xController::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
|
||||
{
|
||||
int function = pasynUser->reason;
|
||||
asynStatus status = asynSuccess;
|
||||
nf874xAxis *pAxis = getAxis(pasynUser);
|
||||
static const char *functionName = "writeFloat64";
|
||||
|
||||
|
||||
/* Set the parameter and readback in the parameter library. */
|
||||
status = setDoubleParam(pAxis->axisNo_, function, value);
|
||||
|
||||
status = asynMotorController::writeFloat64(pasynUser, value);
|
||||
|
||||
/* Do callbacks so higher layers see any changes */
|
||||
pAxis->callParamCallbacks();
|
||||
if (status)
|
||||
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
||||
"%s:%s: error, status=%d function=%d, value=%f\n",
|
||||
driverName, functionName, status, function, value);
|
||||
else
|
||||
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
|
||||
"%s:%s: function=%d, value=%f\n",
|
||||
driverName, functionName, function, value);
|
||||
return status;
|
||||
}
|
||||
|
||||
// These are the nf874xAxis methods
|
||||
|
||||
/** Creates a new nf874xAxis object.
|
||||
* \param[in] pC Pointer to the nf874xController to which this axis belongs.
|
||||
* \param[in] axisNo Index number of this axis, range 0 to pC->numAxes_-1.
|
||||
*
|
||||
* Initializes register numbers, etc.
|
||||
*/
|
||||
nf874xAxis::nf874xAxis(nf874xController *pC, int axisNo)
|
||||
: asynMotorAxis(pC, axisNo),
|
||||
pC_(pC)
|
||||
{
|
||||
sprintf(axisName_, "%d", axisNo);
|
||||
}
|
||||
|
||||
/** Reports on status of the driver
|
||||
* \param[in] fp The file pointer on which report information will be written
|
||||
* \param[in] level The level of report detail desired
|
||||
*
|
||||
* If details > 0 then information is printed about each axis.
|
||||
* After printing controller-specific information calls asynMotorController::report()
|
||||
*/
|
||||
void nf874xAxis::report(FILE *fp, int level)
|
||||
{
|
||||
if (level > 0) {
|
||||
fprintf(fp, " axis %d\n", axisNo_ );
|
||||
}
|
||||
|
||||
// Call the base class method
|
||||
asynMotorAxis::report(fp, level);
|
||||
}
|
||||
|
||||
|
||||
asynStatus nf874xAxis::move(double position, int relative, double minVelocity, double maxVelocity, double acceleration)
|
||||
{
|
||||
asynStatus status;
|
||||
|
||||
sprintf(pC_->outString_, "%s AC %f", axisName_, acceleration);
|
||||
status = pC_->writeController();
|
||||
sprintf(pC_->outString_, "%s VA %f", axisName_, maxVelocity);
|
||||
status = pC_->writeController();
|
||||
if (relative) {
|
||||
sprintf(pC_->outString_, "%s PR %f", axisName_, position);
|
||||
status = pC_->writeController();
|
||||
} else {
|
||||
sprintf(pC_->outString_, "%s PA %f", axisName_, position);
|
||||
status = pC_->writeController();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus nf874xAxis::home(double minVelocity, double maxVelocity, double acceleration, int forwards)
|
||||
{
|
||||
asynStatus status;
|
||||
|
||||
sprintf(pC_->outString_, "%s AC %f", axisName_, acceleration);
|
||||
status = pC_->writeController();
|
||||
sprintf(pC_->outString_, "%s VA %f", axisName_, acceleration);
|
||||
status = pC_->writeController();
|
||||
sprintf(pC_->outString_, "%s DH", axisName_);
|
||||
status = pC_->writeController();
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus nf874xAxis::moveVelocity(double minVelocity, double maxVelocity, double acceleration)
|
||||
{
|
||||
asynStatus status;
|
||||
double speed=maxVelocity;
|
||||
int forwards=1;
|
||||
|
||||
if (speed < 0) {
|
||||
speed = -speed;
|
||||
forwards = 0;
|
||||
}
|
||||
sprintf(pC_->outString_, "%s AC %f", axisName_, acceleration);
|
||||
status = pC_->writeController();
|
||||
sprintf(pC_->outString_, "%s VA %f", axisName_, speed);
|
||||
status = pC_->writeController();
|
||||
sprintf(pC_->outString_, "%s MV %s", axisName_, forwards ? "+" : "-");
|
||||
status = pC_->writeController();
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus nf874xAxis::stop(double acceleration )
|
||||
{
|
||||
asynStatus status;
|
||||
|
||||
sprintf(pC_->outString_, "%s ST", axisName_);
|
||||
status = pC_->writeController();
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus nf874xAxis::setPosition(double position)
|
||||
{
|
||||
asynStatus status;
|
||||
|
||||
sprintf(pC_->outString_, "%s DH %f", axisName_, position);
|
||||
status = pC_->writeController();
|
||||
return status;
|
||||
}
|
||||
|
||||
/** Polls the axis.
|
||||
* This function reads the controller position, encoder position, the limit status, the moving status,
|
||||
* and the drive power-on status. It does not current detect following error, etc. but this could be
|
||||
* added.
|
||||
* It calls setIntegerParam() and setDoubleParam() for each item that it polls,
|
||||
* and then calls callParamCallbacks() at the end.
|
||||
* \param[out] moving A flag that is set indicating that the axis is moving (1) or done (0). */
|
||||
asynStatus nf874xAxis::poll(bool *moving)
|
||||
{
|
||||
int done;
|
||||
asynStatus comStatus;
|
||||
|
||||
// Read the current encoder position
|
||||
sprintf(pC_->outString_, "%s TP?", axisName_);
|
||||
comStatus = pC_->writeReadController();
|
||||
if (comStatus) goto skip;
|
||||
encoderPosition_ = atof(pC_->inString_);
|
||||
setDoubleParam(pC_->motorEncoderPosition_,encoderPosition_);
|
||||
|
||||
// Read the current theoretical position
|
||||
setDoubleParam(pC_->motorPosition_, encoderPosition_);
|
||||
|
||||
// Read the current moving status
|
||||
sprintf(pC_->outString_, "%s MD?", axisName_);
|
||||
comStatus = pC_->writeReadController();
|
||||
if (comStatus) goto skip;
|
||||
done = atoi(pC_->inString_);
|
||||
setIntegerParam(pC_->motorStatusDone_, done);
|
||||
*moving = done ? false:true;
|
||||
|
||||
skip:
|
||||
setIntegerParam(pC_->motorStatusProblem_, comStatus ? 1:0);
|
||||
callParamCallbacks();
|
||||
return comStatus ? asynError : asynSuccess;
|
||||
}
|
||||
|
||||
/** Code for iocsh registration */
|
||||
static const iocshArg nf874xCreateControllerArg0 = {"Port name", iocshArgString};
|
||||
static const iocshArg nf874xCreateControllerArg1 = {"nf874x port name", iocshArgString};
|
||||
static const iocshArg nf874xCreateControllerArg2 = {"Number of axes", iocshArgInt};
|
||||
static const iocshArg nf874xCreateControllerArg3 = {"Moving poll period (ms)", iocshArgInt};
|
||||
static const iocshArg nf874xCreateControllerArg4 = {"Idle poll period (ms)", iocshArgInt};
|
||||
static const iocshArg * const nf874xCreateControllerArgs[] = {&nf874xCreateControllerArg0,
|
||||
&nf874xCreateControllerArg1,
|
||||
&nf874xCreateControllerArg2,
|
||||
&nf874xCreateControllerArg3,
|
||||
&nf874xCreateControllerArg4};
|
||||
static const iocshFuncDef nf874xCreateControllerDef = {"nf874xCreateController", 5, nf874xCreateControllerArgs};
|
||||
static void nf874xCreateContollerCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
nf874xCreateController(args[0].sval, args[1].sval, args[2].ival, args[3].ival, args[4].ival);
|
||||
}
|
||||
|
||||
static void nf874xMotorRegister(void)
|
||||
{
|
||||
iocshRegister(&nf874xCreateControllerDef, nf874xCreateContollerCallFunc);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
epicsExportRegistrar(nf874xMotorRegister);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
FILENAME... 874xMotorDriver.h
|
||||
USAGE... Motor driver support for the NewFocus 874x series of controllers
|
||||
|
||||
Based on ACRMotorDriver.h by:
|
||||
Mark Rivers
|
||||
March 28, 2011
|
||||
|
||||
== Modifications ==
|
||||
2015-12-01 - Wayne Lewis - Modify for NewFocus 874x controllers
|
||||
*/
|
||||
|
||||
#include "asynMotorController.h"
|
||||
#include "asynMotorAxis.h"
|
||||
|
||||
class epicsShareClass nf874xAxis : public asynMotorAxis
|
||||
{
|
||||
public:
|
||||
/* These are the methods we override from the base class */
|
||||
nf874xAxis(class nf874xController *pC, int axis);
|
||||
void report(FILE *fp, int level);
|
||||
asynStatus move(double position, int relative, double min_velocity, double max_velocity, double acceleration);
|
||||
asynStatus moveVelocity(double min_velocity, double max_velocity, double acceleration);
|
||||
asynStatus home(double min_velocity, double max_velocity, double acceleration, int forwards);
|
||||
asynStatus stop(double acceleration);
|
||||
asynStatus poll(bool *moving);
|
||||
asynStatus setPosition(double position);
|
||||
|
||||
private:
|
||||
nf874xController *pC_; /**< Pointer to the asynMotorController to which this axis belongs.
|
||||
* Abbreviated because it is used very frequently */
|
||||
char axisName_[10]; /**< Name of each axis, used in commands to nf874x controller */
|
||||
double encoderPosition_; /**< Cached copy of the encoder position */
|
||||
|
||||
friend class nf874xController;
|
||||
};
|
||||
|
||||
class epicsShareClass nf874xController : public asynMotorController {
|
||||
public:
|
||||
nf874xController(const char *portName, const char *nf874xPortName, int numAxes, double movingPollPeriod, double idlePollPeriod);
|
||||
|
||||
/* These are the methods that we override from asynMotorDriver */
|
||||
asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
|
||||
asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
|
||||
void report(FILE *fp, int level);
|
||||
nf874xAxis* getAxis(asynUser *pasynUser);
|
||||
nf874xAxis* getAxis(int axisNo);
|
||||
|
||||
friend class nf874xAxis;
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
# Makefile
|
||||
TOP = ../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
|
||||
# Both the following line, and a line in the *.dbd file,
|
||||
# must be uncommented to use diagnostic debugging messages.
|
||||
# USR_CXXFLAGS += -DDEBUG
|
||||
# OPT_CXXFLAGS = -g -O0
|
||||
|
||||
DBD += devNewFocus.dbd
|
||||
|
||||
LIBRARY_IOC = NewFocus
|
||||
|
||||
NewFocus_SRCS += NewFocusRegister.cc
|
||||
|
||||
# PMNC87xx (i.e., PMNC87xx) device driver.
|
||||
NewFocus_SRCS += devPMNC87xx.cc drvPMNC87xx.cc
|
||||
|
||||
# NewFocus 874x driver
|
||||
NewFocus_SRCS += 874xMotorDriver.cpp
|
||||
|
||||
NewFocus_LIBS += motor asyn
|
||||
NewFocus_LIBS += $(EPICS_BASE_IOC_LIBS)
|
||||
|
||||
include $(TOP)/configure/RULES
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
FILENAME... NewFocusRegister.cc
|
||||
USAGE... Register NewFocus motor device driver shell commands.
|
||||
|
||||
Version: 1.6
|
||||
Modified By: rivers
|
||||
Last Modified: 2004/07/28 20:24:01
|
||||
*/
|
||||
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
This software was developed under a United States Government license
|
||||
described on the COPYRIGHT_UniversityOfChicago file included as part
|
||||
of this distribution.
|
||||
**********************************************************************/
|
||||
|
||||
#include <iocsh.h>
|
||||
#include "NewFocusRegister.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
// NewFocus Setup arguments
|
||||
static const iocshArg setupArg0 = {"Max. controller count", iocshArgInt};
|
||||
static const iocshArg setupArg1 = {"Max. drivers per controller count", iocshArgInt};
|
||||
static const iocshArg setupArg2 = {"Polling rate", iocshArgInt};
|
||||
// NewFocus Config arguments
|
||||
static const iocshArg configArg0 = {"Card being configured", iocshArgInt};
|
||||
static const iocshArg configArg1 = {"asyn port name", iocshArgString};
|
||||
static const iocshArg configArg2 = {"asyn address (GPIB)", iocshArgInt};
|
||||
|
||||
static const iocshArg * const NewFocusSetupArgs[3] = {&setupArg0,
|
||||
&setupArg1,
|
||||
&setupArg2};
|
||||
static const iocshArg * const NewFocusConfigArgs[3] = {&configArg0,
|
||||
&configArg1,
|
||||
&configArg2};
|
||||
|
||||
static const iocshFuncDef setupPMNC87xx = {"PMNC87xxSetup", 3, NewFocusSetupArgs};
|
||||
|
||||
static const iocshFuncDef configPMNC87xx = {"PMNC87xxConfig", 3, NewFocusConfigArgs};
|
||||
|
||||
|
||||
static void setupPMNC87xxCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
PMNC87xxSetup(args[0].ival, args[1].ival, args[2].ival);
|
||||
}
|
||||
|
||||
static void configPMNC87xxCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
PMNC87xxConfig(args[0].ival, args[1].sval, args[2].ival);
|
||||
}
|
||||
|
||||
static void NewFocusRegister(void)
|
||||
{
|
||||
iocshRegister(&setupPMNC87xx, setupPMNC87xxCallFunc);
|
||||
|
||||
iocshRegister(&configPMNC87xx, configPMNC87xxCallFunc);
|
||||
}
|
||||
|
||||
epicsExportRegistrar(NewFocusRegister);
|
||||
|
||||
} // extern "C"
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
FILENAME... NewportRegister.h
|
||||
USAGE... This file contains function prototypes for Newport IOC shell commands.
|
||||
|
||||
Version: 1.4
|
||||
Modified By: rivers
|
||||
Last Modified: 2004/07/28 18:45:16
|
||||
*/
|
||||
|
||||
/*
|
||||
* Original Author: Ron Sluiter
|
||||
* Date: 05/19/03
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
#include "motor.h"
|
||||
#include "motordrvCom.h"
|
||||
|
||||
/* Function prototypes. */
|
||||
extern RTN_STATUS PMNC87xxSetup(int, int, int);
|
||||
extern RTN_STATUS PMNC87xxConfig(int, const char *, int);
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
NewFocus PicoMotor Controller (87xx)
|
||||
===================================
|
||||
|
||||
|
||||
This motorRecord driver supports the NewFocus 8750 and 8752
|
||||
PicoMotor Network Controllers.
|
||||
8750 - RS232 @ 19200Baud (8data, No Parity, 1stop)
|
||||
8752 - RS232 @ 19200Baud or Ethernet (port 23)
|
||||
|
||||
Support Motor Drivers (daisychained)
|
||||
8753 - 3 Channel Open-loop
|
||||
8751 - 1 Channel Closed-loop
|
||||
|
||||
Motor Resolution:
|
||||
Standard Picomotor - ~30nm
|
||||
Tiny Picomotor - ~100nm
|
||||
|
||||
|
||||
Serial Port Config
|
||||
===================
|
||||
DB9: Male
|
||||
Tx - Pin 2
|
||||
Rx - Pin 3
|
||||
|
||||
Null-Modem (swap 2-3) required for IP-Octal breakout module
|
||||
|
||||
Baud: 19200 (eight data bits, one stop bit, and no parity)
|
||||
|
||||
|
||||
**** EXAMPLE CONFIGURATION FOR VXWORKS TARGETS ****
|
||||
|
||||
Ethernet Config (8752 Only)
|
||||
============================
|
||||
Commands sent using RS232 port
|
||||
|
||||
EHCO ComA ON Turn echo on RS232 port (Computer)
|
||||
|
||||
IPMODE (STAT, DHCP) - IP Mode (Static IP, Use DHCP Server)
|
||||
IPADDR IP Setting
|
||||
NETMASK Network Mask
|
||||
MACADDR MAC Address
|
||||
GATEWAY Network Gateway
|
||||
SAV Save Configuration Settings
|
||||
|
||||
After setting up ethernet parameters and SAV(ing) reset the controller.
|
||||
The IPMODE and IPADDR do not take effect untill after a reboot.
|
||||
|
||||
Example:
|
||||
>IPMODE=STAT
|
||||
>IPADDR=164.54.9.33
|
||||
>NETMASK=255.255.252.0
|
||||
>GATEWAY=164.54.8.1
|
||||
>SAV
|
||||
<power cycle>
|
||||
|
||||
|
||||
Other Info
|
||||
===================================
|
||||
Test Versions:
|
||||
VER<cmnd>
|
||||
8750 - Version 1.0.13
|
||||
8752 - Version 1.5.0, 1.6.0
|
||||
8752 - Version 1.5.4 (NO '>' on STA command - use '/n' for input EOS)
|
||||
|
||||
|
||||
Detect driver types
|
||||
DRT Driver Type (8752 Only)
|
||||
1 = 3 channel open loop (8753)
|
||||
2 = 1 channel closed loop (8751)
|
||||
|
||||
|
||||
|
||||
EPICS SETUP
|
||||
============
|
||||
|
||||
|
||||
xxxApp/src/Makefile
|
||||
-------------------
|
||||
xxx_vxWorks_LIBS += NewFocus
|
||||
|
||||
xxxApp/src/xxxCommonInclude.dbd
|
||||
--------------------------------
|
||||
include "devNewFocus.dbd"
|
||||
|
||||
|
||||
iocBoot/iocxxx/serial.cmd
|
||||
---------------------------
|
||||
tyGSAsynInit("serial1", "UART_0", 1, 19200,'N',1,8,'N',">","\r") /* NewFocus Pico Motor */
|
||||
|
||||
.
|
||||
# Setup IP port for 8752
|
||||
drvAsynIPPortConfigure("serial3", "164.54.9.33:23", 0, 0, 0)
|
||||
asynOctetSetInputEos("serial3",0,">")
|
||||
asynOctetSetOutputEos("serial3",0,"\r")
|
||||
.
|
||||
.
|
||||
|
||||
# New Focus Picomotor Network Controller (model 87xx) (setup parameters:
|
||||
# (1) maximum number of controllers in system
|
||||
# (2) maximum number of drivers per controller (1 - 3)
|
||||
# (3) motor task polling rate (min=1Hz,max=60Hz)
|
||||
#drvPMNC87xxdebug=0
|
||||
PMNC87xxSetup(1, 2, 10)
|
||||
|
||||
# New Focuc Picomotor Network Controller (model 87xx) configuration parameters:
|
||||
# (1) controller# being configured,
|
||||
# (2) asyn port name (string)
|
||||
PMNC87xxConfig(0, "serial1")
|
||||
|
||||
|
||||
iocBoot/iocxxx/motor.substitutions
|
||||
----------------------------------
|
||||
{xxx:, 1, m$(N), "PMNC87xx", 0, 0, "motor $(N)", degrees, Pos, 10, 0., 1., 0, 1, .2, 1e-3, 3, 100, -100, ""}
|
||||
{xxx:, 2 m$(N), "PMNC87xx", 0, 1, "motor $(N)", degrees, Pos, 60, 0., 1.5, 0, 1, .2, 1e-3, 3, 100, -100, ""}
|
||||
{xxx:, 3, m$(N), "PMNC87xx", 0, 2, "motor $(N)", degrees, Pos, 60, 0., 1., 0, 1, .2, 1e-3, 3, 100, -100, ""}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# NewFocus PicoMotor Network Controller (PMNC) Device Driver support.
|
||||
device(motor,VME_IO,devPMNC87xx,"PMNC87xx")
|
||||
driver(drvPMNC87xx)
|
||||
registrar(NewFocusRegister)
|
||||
variable(drvPMNC87xxdebug)
|
||||
|
||||
# NewFocus 874x controller support
|
||||
registrar(nf874xMotorRegister)
|
||||
|
||||
@@ -1,427 +0,0 @@
|
||||
/*
|
||||
FILENAME... devPMNC87xx.cc
|
||||
USAGE... Motor record device level support for NewFocus 8750 and 8752 Controller .
|
||||
|
||||
Version: 1.3
|
||||
Modified By: sluiter
|
||||
Last Modified: 2004/12/20 21:10:53
|
||||
*/
|
||||
|
||||
/*
|
||||
* Original Author: Mark Rivers
|
||||
* Date: 10/16/97
|
||||
* Current Author: Joe Sullivan
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .00 10-16-97 mlr initialized from devOms58
|
||||
* .01 07-19-99 rls initialized from drvMM4000
|
||||
* .02 04-21-01 rls Added jog velocity motor command.
|
||||
* .03 05-22-03 rls Converted to R3.14.x.
|
||||
* .04 06-20-06 jps initialized from drvPMNC8750
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errlog.h>
|
||||
#include "motorRecord.h"
|
||||
#include "motor.h"
|
||||
#include "motordevCom.h"
|
||||
#include "drvPMNCCom.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
#define STATIC static
|
||||
|
||||
extern struct driver_table PMNC87xx_access;
|
||||
|
||||
/* ----------------Create the dsets for devPMNC87xx----------------- */
|
||||
/* static long report(); */
|
||||
STATIC struct driver_table *drvtabptr;
|
||||
STATIC long PMNC87xx_init(int);
|
||||
STATIC long PMNC87xx_init_record(void *);
|
||||
STATIC long PMNC87xx_start_trans(struct motorRecord *);
|
||||
STATIC RTN_STATUS PMNC87xx_build_trans(motor_cmnd, double *, struct motorRecord *);
|
||||
STATIC RTN_STATUS PMNC87xx_end_trans(struct motorRecord *);
|
||||
|
||||
struct motor_dset devPMNC87xx =
|
||||
{
|
||||
{8, NULL, (DEVSUPFUN) PMNC87xx_init, (DEVSUPFUN) PMNC87xx_init_record, NULL},
|
||||
motor_update_values,
|
||||
PMNC87xx_start_trans,
|
||||
PMNC87xx_build_trans,
|
||||
PMNC87xx_end_trans
|
||||
};
|
||||
|
||||
extern "C" {epicsExportAddress(dset,devPMNC87xx);}
|
||||
|
||||
/* --------------------------- program data --------------------- */
|
||||
|
||||
/* This table is used to define the command types */
|
||||
/* WARNING! this must match "motor_cmnd" in motor.h */
|
||||
|
||||
static msg_types PMNC87xx_table[] = {
|
||||
MOTION, /* MOVE_ABS */
|
||||
MOTION, /* MOVE_REL */
|
||||
MOTION, /* HOME_FOR */
|
||||
MOTION, /* HOME_REV */
|
||||
IMMEDIATE, /* LOAD_POS */
|
||||
IMMEDIATE, /* SET_VEL_BASE */
|
||||
IMMEDIATE, /* SET_VELOCITY */
|
||||
IMMEDIATE, /* SET_ACCEL */
|
||||
IMMEDIATE, /* GO */
|
||||
IMMEDIATE, /* SET_ENC_RATIO */
|
||||
INFO, /* GET_INFO */
|
||||
MOVE_TERM, /* STOP_AXIS */
|
||||
VELOCITY, /* JOG */
|
||||
IMMEDIATE, /* SET_PGAIN */
|
||||
IMMEDIATE, /* SET_IGAIN */
|
||||
IMMEDIATE, /* SET_DGAIN */
|
||||
IMMEDIATE, /* ENABLE_TORQUE */
|
||||
IMMEDIATE, /* DISABL_TORQUE */
|
||||
IMMEDIATE, /* PRIMITIVE */
|
||||
IMMEDIATE, /* SET_HIGH_LIMIT */
|
||||
IMMEDIATE, /* SET_LOW_LIMIT */
|
||||
VELOCITY /* JOG_VELOCITY */
|
||||
};
|
||||
|
||||
|
||||
static struct board_stat **PMNC87xx_cards;
|
||||
|
||||
/* --------------------------- program data --------------------- */
|
||||
|
||||
|
||||
/* initialize device support for PMNC87xx stepper motor */
|
||||
STATIC long PMNC87xx_init(int after)
|
||||
{
|
||||
long rtnval;
|
||||
|
||||
if (!after)
|
||||
{
|
||||
drvtabptr = &PMNC87xx_access;
|
||||
(drvtabptr->init)();
|
||||
}
|
||||
|
||||
rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr, &PMNC87xx_cards);
|
||||
return(rtnval);
|
||||
}
|
||||
|
||||
|
||||
/* initialize a record instance */
|
||||
STATIC long PMNC87xx_init_record(void *arg)
|
||||
{
|
||||
struct motorRecord *mr = (struct motorRecord *) arg;
|
||||
return(motor_init_record_com(mr, *drvtabptr->cardcnt_ptr, drvtabptr, PMNC87xx_cards));
|
||||
}
|
||||
|
||||
|
||||
/* start building a transaction */
|
||||
STATIC long PMNC87xx_start_trans(struct motorRecord *mr)
|
||||
{
|
||||
return(motor_start_trans_com(mr, PMNC87xx_cards));
|
||||
}
|
||||
|
||||
|
||||
/* end building a transaction */
|
||||
STATIC RTN_STATUS PMNC87xx_end_trans(struct motorRecord *mr)
|
||||
{
|
||||
return(motor_end_trans_com(mr, drvtabptr));
|
||||
}
|
||||
|
||||
|
||||
/* add a part to the transaction */
|
||||
STATIC RTN_STATUS PMNC87xx_build_trans(motor_cmnd command, double *parms, struct motorRecord *mr)
|
||||
{
|
||||
struct motor_trans *trans = (struct motor_trans *) mr->dpvt;
|
||||
struct mess_node *motor_call;
|
||||
struct mess_info *motor_info;
|
||||
struct controller *brdptr;
|
||||
struct PMNCcontroller *cntrl;
|
||||
struct PMD_axis *paxisDef;
|
||||
PMD_model dType;
|
||||
|
||||
char buff[110];
|
||||
int axis, card;
|
||||
int drive, motor;
|
||||
unsigned int size;
|
||||
int intval, velval;
|
||||
RTN_STATUS rtnval;
|
||||
bool sendMsg;
|
||||
|
||||
rtnval = OK;
|
||||
buff[0] = '\0';
|
||||
sendMsg = true;
|
||||
|
||||
motor_start_trans_com(mr, PMNC87xx_cards);
|
||||
|
||||
motor_call = &(trans->motor_call);
|
||||
card = motor_call->card;
|
||||
axis = motor_call->signal;
|
||||
|
||||
motor_call->type = PMNC87xx_table[command];
|
||||
brdptr = (*trans->tabptr->card_array)[card];
|
||||
if (brdptr == NULL)
|
||||
return(rtnval = ERROR);
|
||||
cntrl = (struct PMNCcontroller *) brdptr->DevicePrivate;
|
||||
|
||||
|
||||
paxisDef = &cntrl->axisDef[axis];
|
||||
drive = paxisDef->driverNum;
|
||||
motor = paxisDef->motorNum;
|
||||
dType = paxisDef->driverType;
|
||||
|
||||
if (PMNC87xx_table[command] > motor_call->type)
|
||||
motor_call->type = PMNC87xx_table[command];
|
||||
|
||||
if (trans->state != BUILD_STATE)
|
||||
return(rtnval = ERROR);
|
||||
|
||||
if (command == PRIMITIVE && mr->init != NULL && strlen(mr->init) != 0)
|
||||
strcat(motor_call->message, mr->init);
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case MOVE_ABS:
|
||||
case MOVE_REL:
|
||||
case HOME_FOR:
|
||||
case HOME_REV:
|
||||
case JOG:
|
||||
if (strlen(mr->prem) != 0)
|
||||
{
|
||||
strcat(motor_call->message, mr->prem);
|
||||
rtnval = motor_end_trans_com(mr, drvtabptr);
|
||||
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PMNC87xx_cards);
|
||||
motor_call->type = PMNC87xx_table[command];
|
||||
|
||||
}
|
||||
if (strlen(mr->post) != 0)
|
||||
motor_call->postmsgptr = (char *) &mr->post;
|
||||
default:
|
||||
/* Protect against NULL pointer with WRTITE_MSG(GO/STOP_AXIS/GET_INFO, NULL). */
|
||||
intval = (parms == NULL) ? 0 : NINT(parms[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
motor_info = &((*drvtabptr->card_array)[card]->motor_info[axis]);
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case MOVE_ABS:
|
||||
if (dType == PMD8753)
|
||||
sprintf(buff, "REL A%d=%d", drive, intval-motor_info->position);
|
||||
else
|
||||
sprintf(buff, "ABS A%d=%d", drive, intval);
|
||||
break;
|
||||
case MOVE_REL:
|
||||
sprintf(buff, "REL A%d=%d", drive, intval);
|
||||
break;
|
||||
case HOME_FOR:
|
||||
// if (dType == PMD8751)
|
||||
// sprintf(buff, "FIN A%d", drive);
|
||||
// else
|
||||
// trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
break;
|
||||
case HOME_REV:
|
||||
// if (dType == PMD8751)
|
||||
// sprintf(buff, "RIN A%d", drive);
|
||||
// else
|
||||
// trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
break;
|
||||
case LOAD_POS:
|
||||
|
||||
if (dType == PMD8753)
|
||||
{
|
||||
/* Setting local driver position because the controller cannot be set */
|
||||
sprintf(buff, "CHL A%d=%d", drive, motor);
|
||||
motor_info->position = intval;
|
||||
motor_info->encoder_position = intval;
|
||||
cntrl->last_position[axis] = 0; // Used to accumulate position history
|
||||
}
|
||||
else if (dType == PMD8751)
|
||||
{
|
||||
/* Closed loop driver - able to set position */
|
||||
sprintf(buff, "POS %d=%d", drive, intval);
|
||||
}
|
||||
else
|
||||
{
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
}
|
||||
|
||||
break;
|
||||
case SET_VEL_BASE:
|
||||
if (dType == PMD8753)
|
||||
{
|
||||
if (abs(intval) >= MAX_VELOCITY)
|
||||
intval = MAX_VELOCITY-1;
|
||||
/* Set VEL to maximum to eliminate MPV out-of-range error */
|
||||
sprintf(buff, "VEL A%d %d=%d", drive, motor, MAX_VELOCITY);
|
||||
strcpy(motor_call->message, buff);
|
||||
|
||||
rtnval = motor_end_trans_com(mr, drvtabptr);
|
||||
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PMNC87xx_cards);
|
||||
motor_call->type = PMNC87xx_table[command];
|
||||
|
||||
|
||||
sprintf(buff, "MPV A%d %d=%d", drive, motor, abs(intval));
|
||||
}
|
||||
else // if (dType == PMD8751)
|
||||
{
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
}
|
||||
|
||||
break;
|
||||
case SET_VELOCITY:
|
||||
if (abs(intval) > MAX_VELOCITY)
|
||||
intval = MAX_VELOCITY;
|
||||
sprintf(buff, "VEL A%d %d=%d", drive, motor, abs(intval));
|
||||
break;
|
||||
case SET_ACCEL:
|
||||
/*
|
||||
* The value passed is in steps/sec/sec.
|
||||
*/
|
||||
if (intval < MIN_ACCEL)
|
||||
intval = MIN_ACCEL;
|
||||
else if (intval > MAX_ACCEL)
|
||||
intval = MAX_ACCEL;
|
||||
|
||||
sprintf(buff, "ACC A%d %d=%d", drive, motor, intval);
|
||||
break;
|
||||
case GO:
|
||||
sprintf(buff, "GO A%d", drive);
|
||||
break;
|
||||
case SET_ENC_RATIO:
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
break;
|
||||
case PRIMITIVE:
|
||||
case GET_INFO:
|
||||
/* These commands are not actually done by sending a message, but
|
||||
rather they will indirectly cause the driver to read the status
|
||||
of all motors */
|
||||
break;
|
||||
case STOP_AXIS:
|
||||
sprintf(buff, "HAL A%d", drive); /* Using the smooth stop command */
|
||||
break;
|
||||
case JOG:
|
||||
if (abs(intval) > MAX_VELOCITY)
|
||||
velval = MAX_VELOCITY;
|
||||
else
|
||||
velval = abs(intval);
|
||||
|
||||
if (dType == PMD8753)
|
||||
{
|
||||
if (intval >= 0)
|
||||
sprintf(buff, "FOR A%d=%d", drive, velval);
|
||||
else
|
||||
sprintf(buff, "REV A%d=%d", drive, velval);
|
||||
}
|
||||
else if (dType == PMD8751)
|
||||
{
|
||||
sprintf(buff, "VEL A%d %d=%d", drive, motor, velval);
|
||||
|
||||
strcpy(motor_call->message, buff);
|
||||
rtnval = motor_end_trans_com(mr, drvtabptr);
|
||||
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PMNC87xx_cards);
|
||||
motor_call->type = PMNC87xx_table[command];
|
||||
|
||||
// Use Relative Move command for jogging
|
||||
// because the 8751 does not indicate motion with (FOR and REV)
|
||||
// ** BUG? **
|
||||
if (intval >= 0)
|
||||
sprintf(buff, "REL A%d=1000000",drive);
|
||||
else
|
||||
sprintf(buff, "REL A%d=-1000000",drive);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMsg = false;
|
||||
break;
|
||||
}
|
||||
|
||||
strcpy(motor_call->message, buff);
|
||||
rtnval = motor_end_trans_com(mr, drvtabptr);
|
||||
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PMNC87xx_cards);
|
||||
motor_call->type = PMNC87xx_table[command];
|
||||
|
||||
sprintf(buff, "GO A%d", drive);
|
||||
break;
|
||||
case SET_PGAIN:
|
||||
case SET_IGAIN:
|
||||
case SET_DGAIN:
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
break;
|
||||
case ENABLE_TORQUE:
|
||||
if (dType == PMD8751)
|
||||
sprintf(buff, "SER A%d", drive);
|
||||
else if (dType == PMD8753)
|
||||
sprintf(buff, "MON A%d", drive);
|
||||
else
|
||||
{
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
}
|
||||
|
||||
break;
|
||||
case DISABL_TORQUE:
|
||||
if (dType == PMD8751)
|
||||
sprintf(buff, "NOS A%d", drive);
|
||||
else if (dType == PMD8753)
|
||||
sprintf(buff, "MOF A%d", drive);
|
||||
else
|
||||
{
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
}
|
||||
break;
|
||||
case SET_HIGH_LIMIT:
|
||||
case SET_LOW_LIMIT:
|
||||
trans->state = IDLE_STATE; /* No command sent to the controller. */
|
||||
sendMsg = false;
|
||||
break;
|
||||
default:
|
||||
sendMsg = false;
|
||||
rtnval = ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (sendMsg == true)
|
||||
{
|
||||
size = strlen(buff);
|
||||
|
||||
if (size > sizeof(buff) || (strlen(motor_call->message) + size) > MAX_MSG_SIZE)
|
||||
errlogMessage("PMNC87xx_build_trans(): buffer overflow.\n");
|
||||
else
|
||||
{
|
||||
strcat(motor_call->message, buff);
|
||||
motor_end_trans_com(mr, drvtabptr);
|
||||
}
|
||||
}
|
||||
|
||||
return(rtnval);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
||||
/*
|
||||
FILENAME... drvPMNCCom.h
|
||||
USAGE... This file contains Newport Motion Master (MM) driver "include"
|
||||
information that is specific to Motion Master models 3000/4000.
|
||||
|
||||
Version: 1.10
|
||||
Modified By: sullivan
|
||||
Last Modified: 2004/08/17 21:28:22
|
||||
*/
|
||||
|
||||
/*
|
||||
* Original Author: Mark Rivers
|
||||
* Current Author: Joe Sullivan
|
||||
* Date: 06/28/06
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 01-18-93 mlr initialized from drvOms58
|
||||
* .02 06-16-03 rls Converted to R3.14.x.
|
||||
*/
|
||||
|
||||
#ifndef INCdrvPMNCComh
|
||||
#define INCdrvPMNCComh 1
|
||||
|
||||
#include "motordrvCom.h"
|
||||
#include "asynDriver.h"
|
||||
#include "asynOctetSyncIO.h"
|
||||
|
||||
/* Motor Characteristics - in steps */
|
||||
#define MAX_VELOCITY 2000
|
||||
#define MIN_ACCEL 16
|
||||
#define MAX_ACCEL 32000
|
||||
|
||||
/* Picomotor Network Controllers */
|
||||
enum PMNC_model
|
||||
{
|
||||
PMNC8750,
|
||||
PMNC8752
|
||||
};
|
||||
|
||||
|
||||
/* Picomotor Drivers - use DRT Command to determine */
|
||||
enum PMD_model
|
||||
{
|
||||
PMD8753=1, // 3 channel open-loop
|
||||
PMD8751=2 // 1 channel closed-loop
|
||||
};
|
||||
|
||||
|
||||
/* Picomotor Driver 8751 Fault Codes (POWER OFF) */
|
||||
enum PMD8751_FAULTS
|
||||
{
|
||||
ENCODER=2,
|
||||
MOTORSHORT=1,
|
||||
NOMOTOR=0,
|
||||
OVERHEAT=3
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum PMNC_model PMNC_model;
|
||||
typedef enum PMD_model PMD_model;
|
||||
#endif
|
||||
|
||||
#define PMNC87xx_NUM_CARDS 10 /* Maximum number of controllers */
|
||||
#define PMNC87xx_NUM_DRIVERS 10 /* Maximum number of drivers per controller */
|
||||
#define PMNC8753_NUM_MOTORS 3 /* Maximum number of motors per driver */
|
||||
#define PMNC8751_NUM_MOTORS 1 /* Maximum number of motors per driver */
|
||||
|
||||
/* Per axis definition */
|
||||
struct PMD_axis
|
||||
{
|
||||
PMD_model driverType;
|
||||
int driverNum;
|
||||
int motorNum;
|
||||
};
|
||||
|
||||
/* Motion Master specific data is stored in this structure. */
|
||||
struct PMNCcontroller
|
||||
{
|
||||
asynUser *pasynUser; /* For RS-232 */
|
||||
int asyn_address; /* Use for GPIB or other address with asyn */
|
||||
char asyn_port[80]; /* asyn port name */
|
||||
|
||||
char aux_status_string[PMNC87xx_NUM_DRIVERS+1][25];
|
||||
char status_string[PMNC87xx_NUM_DRIVERS+1][25];
|
||||
char position_string[PMNC87xx_NUM_DRIVERS+1][25];
|
||||
char chan_select_string[PMNC87xx_NUM_DRIVERS+1][25];
|
||||
|
||||
PMNC_model pmnc; /* Controller Type */
|
||||
bool changeEOS; /* Flag for controller version that does not terminate the
|
||||
* STA command correctly */
|
||||
struct PMD_axis axisDef[MAX_AXIS]; /* Axis definition - New Focus Driver Model and Number */
|
||||
long last_position[MAX_AXIS]; /* Track last incremtal position to noMotion status */
|
||||
int total_drivers; /* Count number of drivers connected to controller */
|
||||
CommStatus status; /* Controller communication status. */
|
||||
};
|
||||
|
||||
|
||||
/* Motor status response for PMNC. */
|
||||
typedef union
|
||||
{
|
||||
epicsUInt8 All;
|
||||
/* 8753 Driver Status */
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_First
|
||||
bool bit7 :1; /* Bit #7 N/A. */
|
||||
bool positionMode :1; /* Set if moving in position mode */
|
||||
bool velocityMode :1; /* Set if moving in velocity mode */
|
||||
bool atVelocity :1; /* Set if commanded velocity is reached */
|
||||
bool motorSelected :1; /* Set if valid motor selected */
|
||||
bool powerOn :1; /* Motor power 1 - ON; 0 - OFF. */
|
||||
bool chksumError :1; /* CheckSum Error */
|
||||
bool inMotion :1; /* In-motion indicator. */
|
||||
|
||||
#else
|
||||
bool inMotion :1; /* In-motion indicator. */
|
||||
bool cksumError :1; /* CheckSum Error */
|
||||
bool powerOn :1; /* Motor power 1 - ON; 0 - OFF. */
|
||||
bool motorSelected :1; /* Set if valid motor selected */
|
||||
bool atVelocity :1; /* Set if commanded velocity is reached */
|
||||
bool velocityMode :1; /* Set if moving in velocity mode */
|
||||
bool positionMode :1; /* Set if moving in position mode */
|
||||
bool bit7 :1; /* Bit #7 N/A. */
|
||||
#endif
|
||||
} Bits_8753;
|
||||
/* 8751 Driver Status - SERVO ON and POWER ON */
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_First
|
||||
bool homing :1; /* Set ON if homing in progress (FIN, RIN) */
|
||||
bool forLimit :1; /* Set OFF if forward limit reached */
|
||||
bool revLimit :1; /* Set OFF if reverse limit reached */
|
||||
bool posError :1; /* Set ON if position error limit exceeded */
|
||||
bool powerOn :1; /* Motor Power Indicator */
|
||||
bool noMotor :1; /* Set ON if Missing Motor. */
|
||||
bool cksumError :1; /* CheckSum Error */
|
||||
bool moveDone :1; /* Set ON if Done. */
|
||||
|
||||
#else
|
||||
bool moveDone :1; /* In-motion indicator. */
|
||||
bool chksumError :1; /* CheckSum Error */
|
||||
bool noMotor :1; /* Set ON if Missing Motor. */
|
||||
bool powerOn :1; /* Motor power indicator 1 - ON; 0 - OFF. */
|
||||
bool posError :1; /* Set ON if position error limit exceeded */
|
||||
bool revLimit :1; /* Set OFF if reverse limit reached */
|
||||
bool forLimit :1; /* Set OFF if forward limit reached */
|
||||
bool homing :1; /* Set ON if homing in progress (FIN, RIN) */
|
||||
#endif
|
||||
} Bits_8751;
|
||||
/* 8751 Driver Status - SERVO OFF */
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_First
|
||||
bool homing :1; /* Set ON if homing in progress (FIN, RIN) */
|
||||
bool overheat :1; /* Set OFF if motor overheated */
|
||||
bool stopIN :1; /* Set OFF if External STOP input ACTIVE */
|
||||
bool posError :1; /* Set ON if position error limit exceeded */
|
||||
bool powerOn :1; /* Set ON if valid motor selected */
|
||||
bool noMotor :1; /* Set ON if Missing Motor. */
|
||||
bool cksumError :1; /* CheckSum Error */
|
||||
bool moveDone :1; /* Set ON if Done. */
|
||||
|
||||
#else
|
||||
bool moveDone :1; /* In-motion indicator. */
|
||||
bool chksumError :1; /* CheckSum Error */
|
||||
bool noMotor :1; /* Set ON if Missing Motor. */
|
||||
bool powerOn :1; /* Motor power indicator */
|
||||
bool posError :1; /* Set ON if position error limit exceeded */
|
||||
bool stopIN :1; /* Set OFF if External STOP input ACTIVE */
|
||||
bool overheat :1; /* Set OFF if motor overheated */
|
||||
bool homing :1; /* Set ON if homing in progress (FIN, RIN) */
|
||||
#endif
|
||||
} Bits_8751_NOS;
|
||||
/* 8751 Driver Status - SERVO ON and POWER OFF */
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_First
|
||||
bool homing :1; /* Set ON if homing in progress (FIN, RIN) */
|
||||
bool fault :2; /* Driver Power Faults - See PMD8751_FAULTS */
|
||||
bool posError :1; /* Set ON if position error limit exceeded */
|
||||
bool powerOn :1; /* Set ON if valid motor selected */
|
||||
bool noMotor :1; /* Set ON if Missing Motor. */
|
||||
bool cksumError :1; /* CheckSum Error */
|
||||
bool moveDone :1; /* Set ON if Done. */
|
||||
|
||||
#else
|
||||
bool moveDone :1; /* In-motion indicator. */
|
||||
bool chksumError :1; /* CheckSum Error */
|
||||
bool noMotor :1; /* Set ON if Missing Motor. */
|
||||
bool powerOn :1; /* Motor power indicator */
|
||||
bool posError :1; /* Set ON if position error limit exceeded */
|
||||
bool fault :2; /* Driver Power Faults - See PMD8751_FAULTS */
|
||||
bool homing :1; /* Set ON if homing in progress (FIN, RIN) */
|
||||
#endif
|
||||
} Bits_8751_FAULT;
|
||||
|
||||
} MOTOR_STATUS;
|
||||
|
||||
|
||||
/* Driver Aux Status response for PMNC. */
|
||||
typedef union
|
||||
{
|
||||
epicsUInt8 All;
|
||||
/* 8751 Driver Aux Status - DIAG Command */
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_First
|
||||
bool bit7 :1; /* Bit #7 N/A. */
|
||||
bool bit6 :1; /* Bit #6 N/A. */
|
||||
bool servoOverRun :1; /* Set if servo process time overrun (>.512msec) */
|
||||
bool slewDone :1; /* Set when trapesoidal slew time over */
|
||||
bool accelDone :1; /* Set when trapesoidal accell time over */
|
||||
bool servoOn :1; /* Set if servo mode ON - else OpenLoop */
|
||||
bool posWrap :1; /* Set on 32 bit overflow (position) */
|
||||
bool diagBit :1; /* Used to encode error diagnostics */
|
||||
|
||||
#else
|
||||
bool diagBit :1; /* Used to encode error diagnostics */
|
||||
bool posWrap :1; /* Set on 32 bit overflow (position) */
|
||||
bool servoOn :1; /* Set if servo mode ON - else OpenLoop */
|
||||
bool accelDone :1; /* Set when trapesoidal accell time over */
|
||||
bool slewDone :1; /* Set when trapesoidal slew time over */
|
||||
bool servoOverRun :1; /* Set if servo process time overrun (>.512msec) */
|
||||
bool bit6 :1; /* Bit #6 N/A. */
|
||||
bool bit7 :1; /* Bit #7 N/A. */
|
||||
#endif
|
||||
} Bits_8751;
|
||||
} MOTOR_AUX_STATUS;
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INCdrvPMNCComh */
|
||||
|
||||
Reference in New Issue
Block a user