Use MRES rather than controller resolution to do EGUtoRAWbacktoEGU conversion.

This commit is contained in:
Ron Sluiter
2013-04-24 16:33:08 +00:00
parent 5bb714768c
commit 369f866a4d
3 changed files with 20 additions and 59 deletions
+5 -50
View File
@@ -21,56 +21,11 @@ The correct jumpering for the ESP300 is; 1-5, 2-6, 9-13, 10-11, 15-16.
Setting the motor resolution (MRES) field.
------------------------------------------
For DC motors, set MRES to the ESP300's response to the SU? command.
If there is no other mechanism (e.g., generic serial record, dumb terminal,
etc.) to communicate to the ESP300, the response to the SU? command can be
determined by following this procedure;
1 - uncomment the "USR_CFLAGS += -DDEBUG" line in the NewportSrc/Makefile.Vx
file (This selects the diagnostic messages to be compiled).
2 - "cd <motor>/motorApp/NewportSrc; gnumake clean; gnumake"; this re-compiles
the device drivers with the diagnostic messages selected.
3 - Rebuild your IOC; "cd <IOC>; gnumake".
4 - Add "drvESP300debug = 4" to the IOC's st.cmd file before "iocInit".
5 - Connect to the VxWorks shell and reboot the IOC.
The VxWorks shell output should contain lines like the following;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Starting iocInit
recv_mess(): message = ""
send_mess(): message = VE?
recv_mess(): message = "ESP300 Version 3.03 04/13/00"
send_mess(): message = ZU
recv_mess(): message = "0H"
send_mess(): message = 01ST
send_mess(): message = 02ST
send_mess(): message = 03ST
send_mess(): message = 01SU?
recv_mess(): message = "0.00005101"
send_mess(): message = 01MD
recv_mess(): message = "1"
send_mess(): message = 01TP
recv_mess(): message = "0.00000"
send_mess(): message = 01PH
recv_mess(): message = "18000000H, 7H"
send_mess(): message = 01MO?
recv_mess(): message = "0"
send_mess(): message = 02SU?
recv_mess(): message = "0.00005101"
send_mess(): message = 02MD
recv_mess(): message = "1"
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Note the response to the SU? commands and set MRES to that value.
6 - Turn off diagnostic messages. Either set drvESP300debug = 0 in the st.cmd
file (there is a very small amount of CPU overhead associated with leaving
the diagnostic messages loaded), or go to step #1, and reverse the steps;
comment out the "USR_CFLAGS += -DDEBUG" line in the NewportSrc/Makefile.Vx,
etc., etc.,
Set the MRES like any other motor; i.e., to the precision of the stage.
(Prior to motor module R6.8, the driver used the controllers resolution
to scale the EGUtoRAWbacktoEGU conversion done between motor record and
device driver support. With R6.8 the driver uses the motor record's MRES
to scale the conversion).
Newport ESP100
==============
+2 -1
View File
@@ -37,6 +37,7 @@ Last Modified: $Date: 2008-03-14 20:17:14 $
* -----------------
* .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>
@@ -187,7 +188,7 @@ static RTN_STATUS ESP300_build_trans(motor_cmnd command, double *parms, struct m
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];
+13 -8
View File
@@ -53,12 +53,14 @@ HeadURL: $URL$
* 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"
@@ -216,13 +218,22 @@ static int set_status(int card, int signal)
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);
@@ -259,7 +270,7 @@ static int set_status(int card, int signal)
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)
{
@@ -664,12 +675,6 @@ errexit:
{
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;