Updated EuromoveDriver to work with Prologix GPIB-Ethernet
Improved threshold handling on EL737 Minor changes
This commit is contained in:
@@ -5,6 +5,9 @@ USAGE... Motor driver support for the EuroMove motor controller from LLB.
|
||||
This is a driver for the EuroMove motor controller from LLB. This device talks to us either via
|
||||
GPIB or USB. The controller is fairly simple. It can control quite a number of motors.
|
||||
|
||||
Reworked in 06/2021 to work with the Prologix GPIV-Ethernte converter
|
||||
|
||||
mark.koennecke@psi.ch
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,11 +35,14 @@ GPIB or USB. The controller is fairly simple. It can control quite a number of m
|
||||
* \param[in] EuroMovePortName The name of the drvAsynSerialPort that was created previously to connect to the EuroMove controller
|
||||
* \param[in] numAxes The number of axes that this controller supports
|
||||
*/
|
||||
EuroMoveController::EuroMoveController(const char *portName, const char *EuroMovePortName, int numAxis)
|
||||
EuroMoveController::EuroMoveController(const char *portName, const char *EuroMovePortName, int gpibAddr, int numAxis)
|
||||
: SINQController(portName, EuroMovePortName,numAxis+1)
|
||||
{
|
||||
asynStatus status;
|
||||
static const char *functionName = "EuroMoveController::EuroMoveController";
|
||||
size_t out, in;
|
||||
int reason;
|
||||
char command[80], reply[80];
|
||||
|
||||
/* Connect to EuroMove controller */
|
||||
status = pasynOctetSyncIO->connect(EuroMovePortName, 0, &pasynUserController_, NULL);
|
||||
@@ -45,9 +51,27 @@ EuroMoveController::EuroMoveController(const char *portName, const char *EuroMov
|
||||
"%s: cannot connect to EuroMove controller\n",
|
||||
functionName);
|
||||
}
|
||||
const char *terminator = "\r";
|
||||
const char *terminator = "\r\n";
|
||||
pasynOctetSyncIO->setOutputEos(pasynUserController_,terminator,strlen(terminator));
|
||||
pasynOctetSyncIO->setInputEos(pasynUserController_,terminator,strlen(terminator));
|
||||
const char *repTerminator = "\r";
|
||||
pasynOctetSyncIO->setInputEos(pasynUserController_,repTerminator,strlen(repTerminator));
|
||||
|
||||
/* Save gpib address and prepare addr string */
|
||||
this->gpibAddr = gpibAddr;
|
||||
snprintf(addrCommand,strlen(addrCommand), "++addr %d", gpibAddr);
|
||||
|
||||
/*
|
||||
Configure the Prologix interface to our liking
|
||||
The thing sends no response on configuration commands
|
||||
*/
|
||||
strcpy(command,"++mode 1"); /* Make it a controller */
|
||||
status = pasynOctetSyncIO->write(pasynUserController_, command, strlen(command), 2, &out);
|
||||
strcpy(command,"++auto 1"); /* ask for response automatically */
|
||||
status = pasynOctetSyncIO->write(pasynUserController_, command, strlen(command), 2, &out);
|
||||
strcpy(command,"++eos 1"); /* CR */
|
||||
status = pasynOctetSyncIO->write(pasynUserController_, command, strlen(command), 2, &out);
|
||||
|
||||
|
||||
|
||||
for(int i = 0; i < numAxis; i++){
|
||||
new EuroMoveAxis(this, i+1);
|
||||
@@ -59,12 +83,13 @@ EuroMoveController::EuroMoveController(const char *portName, const char *EuroMov
|
||||
/** Creates a new EuroMoveController 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] EuroMovePortName The name of the drvAsynIPPPort that was created previously to connect to the EuroMove controller
|
||||
* \param[in] EuroMovePortName The name of the drvAsynIPPPort that was created previously to connect to the EuroMove controller
|
||||
* \param[in] gpibAddr The address of the controller on the GPIB bus
|
||||
* \param[in] numAxes The number of axes that this controller supports
|
||||
*/
|
||||
extern "C" int EuroMoveCreateController(const char *portName, const char *EuroMovePortName, const int numAxis)
|
||||
extern "C" int EuroMoveCreateController(const char *portName, const char *EuroMovePortName, const int gpibAddr, const int numAxis)
|
||||
{
|
||||
new EuroMoveController(portName, EuroMovePortName, numAxis);
|
||||
new EuroMoveController(portName, EuroMovePortName, gpibAddr, numAxis);
|
||||
return(asynSuccess);
|
||||
}
|
||||
|
||||
@@ -119,7 +144,17 @@ asynStatus EuroMoveController::transactController(int axisNo,char command[COMLEN
|
||||
|
||||
pasynOctetSyncIO->flush(pasynUserController_);
|
||||
|
||||
|
||||
/* set address first */
|
||||
status = pasynOctetSyncIO->write(pasynUserController_, this->addrCommand, strlen(this->addrCommand), 2, &out);
|
||||
if(status != asynSuccess){
|
||||
if(axis!= NULL){
|
||||
axis->updateMsgTxtFromDriver("Lost connection to motor controller");
|
||||
errlogPrintf("Lost connection to motor controller\n");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/* now the actual command */
|
||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||
reply,sizeof(reply), 10.,&out,&in,&reason);
|
||||
if(status != asynSuccess){
|
||||
@@ -606,15 +641,17 @@ static void EuroMoveConfigCallFunc(const iocshArgBuf *args)
|
||||
/** Code for iocsh registration */
|
||||
static const iocshArg EuroMoveCreateControllerArg0 = {"Port name", iocshArgString};
|
||||
static const iocshArg EuroMoveCreateControllerArg1 = {"EuroMove port name", iocshArgString};
|
||||
static const iocshArg EuroMoveCreateControllerArg2 = {"Number of axis", iocshArgInt};
|
||||
static const iocshArg EuroMoveCreateControllerArg2 = {"GPIB Address", iocshArgInt};
|
||||
static const iocshArg EuroMoveCreateControllerArg3 = {"Number of axis", iocshArgInt};
|
||||
static const iocshArg * const EuroMoveCreateControllerArgs[] = {&EuroMoveCreateControllerArg0,
|
||||
&EuroMoveCreateControllerArg1,
|
||||
&EuroMoveCreateControllerArg2
|
||||
&EuroMoveCreateControllerArg2,
|
||||
&EuroMoveCreateControllerArg3
|
||||
};
|
||||
static const iocshFuncDef EuroMoveCreateControllerDef = {"EuroMoveCreateController", 3, EuroMoveCreateControllerArgs};
|
||||
static const iocshFuncDef EuroMoveCreateControllerDef = {"EuroMoveCreateController", 4, EuroMoveCreateControllerArgs};
|
||||
static void EuroMoveCreateControllerCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
EuroMoveCreateController(args[0].sval, args[1].sval, args[2].ival);
|
||||
EuroMoveCreateController(args[0].sval, args[1].sval, args[2].ival, args[3].ival);
|
||||
}
|
||||
|
||||
static void EuroMoveRegister(void)
|
||||
|
||||
Reference in New Issue
Block a user