Hi Eliot,
These are the changes that were made in the drvESP300 and devESP300 between those 3 motor releases:
corvette:motor/motorApp/NewportSrc>svn diff -r 10807:16628 drvESP300.cc devESP300.cc
Index: drvESP300.cc
===================================================================
--- drvESP300.cc (revision 10807)
+++ drvESP300.cc (revision 16628)
@@ -2,9 +2,10 @@
FILENAME... drvESP300.cc
USAGE... Motor record driver level support for Newport ESP300/100.
-Version: $Revision: 1.25 $
-Modified By: $Author: rivers $
-Last Modified: $Date: 2009-09-01 16:17:46 $
+Version: $Revision$
+Modified By: $Author$
+Last Modified: $Date$
+HeadURL: $URL$
*/
/*
@@ -52,12 +53,14 @@
* extern "C" linkage.
* .09 08/07/06 rls - GPIB under ASYN only allows 1 input EOS character.
* No output EOS. Adjustments accordingly.
+ * .10 02/22/13 rls - Scrap driver resolution, use MRES.
*/
#include <string.h>
#include <epicsThread.h>
#include <drvSup.h>
+#include "motorRecord.h"
#include "motor.h"
#include "NewportRegister.h"
#include "drvMMCom.h"
@@ -75,17 +78,19 @@
#define SERIAL_TIMEOUT 5.0 /* Command timeout in sec. */
/*----------------debugging-----------------*/
-#ifdef __GNUG__
- #ifdef DEBUG
- #define Debug(l, f, args...) { if(l<=drvESP300debug) printf(f,## args); }
- #else
- #define Debug(l, f, args...)
- #endif
-#else
- #define Debug()
-#endif
+
volatile int drvESP300debug = 0;
extern "C" {epicsExportAddress(int, drvESP300debug);}
+static inline void Debug(int level, const char *format, ...) {
+ #ifdef DEBUG
+ if (level < drvESP300debug) {
+ va_list pVar;
+ va_start(pVar, format);
+ vprintf(format, pVar);
+ va_end(pVar);
+ }
+ #endif
+}
int ESP300_num_cards = 0;
@@ -213,13 +218,22 @@
char inbuff[BUFF_SIZE], outbuff[BUFF_SIZE];
int rtn_state, charcnt;
long mstatus;
- double motorData;
+ double motorData, MRES;
bool power, plusdir, ls_active = false;
msta_field status;
+ struct motorRecord *mr;
cntrl = (struct MMcontroller *) motor_state[card]->DevicePrivate;
motor_info = &(motor_state[card]->motor_info[signal]);
nodeptr = motor_info->motor_motion;
+ if (nodeptr != NULL)
+ {
+ mr = (struct motorRecord *) nodeptr->mrecord;
+ MRES = mr->mres;
+ }
+ else
+ MRES = 1.0;
+
status.All = motor_info->status.All;
sprintf(outbuff, "%.2dMD", signal + 1);
@@ -256,7 +270,7 @@
send_mess(card, outbuff, (char) NULL);
charcnt = recv_mess(card, inbuff, 1);
- motorData = atof(inbuff) / cntrl->drive_resolution[signal];
+ motorData = atof(inbuff) / MRES;
if (motorData == motor_info->position)
{
@@ -361,7 +375,7 @@
static RTN_STATUS send_mess(int card, char const *com, char *name)
{
struct MMcontroller *cntrl;
- int size;
+ size_t size;
size_t nwrite;
size = strlen(com);
@@ -493,7 +507,7 @@
}
Debug(2, "recv_mess(): message = \"%s\"\n", com);
- return(nread);
+ return((int)nread);
}
@@ -604,11 +618,11 @@
}
success_rtn = pasynOctetSyncIO->setOutputEos(cntrl->pasynUser,
- output_terminator, strlen(output_terminator));
+ output_terminator, (int)strlen(output_terminator));
/* Ignore output EOS error in case this is a GPIB port. */
success_rtn = pasynOctetSyncIO->setInputEos(cntrl->pasynUser,
- input_terminator, strlen(input_terminator));
+ input_terminator, (int)strlen(input_terminator));
if (success_rtn != asynSuccess)
{
errlogPrintf("%s setInputEos error = %d\n", errmsg, (int) success_rtn);
@@ -661,12 +675,6 @@
{
struct mess_info *motor_info = &brdptr->motor_info[motor_index];
- /* Set axis resolution. */
- sprintf(buff, "%.2dSU?", motor_index + 1);
- send_mess(card_index, buff, 0);
- recv_mess(card_index, buff, 1);
- cntrl->drive_resolution[motor_index] = atof(&buff[0]);
-
motor_info->status.All = 0;
motor_info->no_motion_count = 0;
motor_info->encoder_position = 0;
Property changes on: drvESP300.cc
___________________________________________________________________
Added: svn:keywords
+ Date
Revision
Author
HeadURL
Id
Index: devESP300.cc
===================================================================
--- devESP300.cc (revision 10807)
+++ devESP300.cc (revision 16628)
@@ -37,6 +37,7 @@
* -----------------
* .01 05-23-03 rls Converted to R3.14.x.
* .02 10-28-03 rls User must set MRES to drive resolution.
+ * .03 13-22-02 rls Use MRES rather than drive resolution.
*/
#include <string.h>
@@ -147,14 +148,14 @@
struct motor_trans *trans = (struct motor_trans *) mr->dpvt;
struct mess_node *motor_call;
char *msgptr;
- int last;
+ size_t last;
/* Remove trailing ';'s from message. */
motor_call = &(trans->motor_call);
msgptr = motor_call->message;
last = strlen(msgptr) - 1;
if (msgptr[last] == ';')
- msgptr[last] = (char) NULL;
+ msgptr[last] = (char) NULL;
return(motor_end_trans_com(mr, drvtabptr));
}
@@ -169,7 +170,7 @@
struct MMcontroller *cntrl;
char buff[80];
int axis, card;
- unsigned int size;
+ size_t size;
double dval, cntrl_units;
RTN_STATUS rtnval;
@@ -187,7 +188,7 @@
return(rtnval = ERROR);
cntrl = (struct MMcontroller *) brdptr->DevicePrivate;
- cntrl_units = dval * cntrl->drive_resolution[axis - 1];
+ cntrl_units = dval * mr->mres;
if (ESP300_table[command] > motor_call->type)
motor_call->type = ESP300_table[command];
The important change is
.03 13-22-02 rls Use MRES rather than drive resolution.
Note that for the Newport XPS and other controllers that use engineering units my drivers use code like the 6-5 version for the ESP. That way the hardware can be working in one set of units (mm for example) and the motor record can be working in a different set of units (microns, for example). I think this is nice. The way Ron has changed the ESP code the hardware must be configured to use the same units as the motor record.
Mark
________________________________
From: [email protected] [[email protected]] on behalf of Specht, Eliot D. [[email protected]]
Sent: Tuesday, March 18, 2014 2:58 PM
To: [email protected]
Subject: Newport ESP-301 units
I’m using a Newport ESP-301 motor controller. Using the motor-6-5 record, I set MRES to the encoder step size in microns (0.019667) and the VAL and RBV values worked in microns. I’ve had to update to motorR6-8. Now VAL and RBV work in millimeters, regardless of MRES. I’m a novice with EPICS; can anyone tell me whether there is a problem with motorR6-8 or whether I am missing something simple?
Eliot Specht
Oak Ridge National
- References:
- Newport ESP-301 units Specht, Eliot D.
- Navigate by Date:
- Prev:
Newport ESP-301 units Specht, Eliot D.
- Next:
how to ... in CSS BOY? Jemian, Pete R.
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Newport ESP-301 units Specht, Eliot D.
- Next:
how to ... in CSS BOY? Jemian, Pete R.
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|