diff --git a/motorApp/NewportSrc/README b/motorApp/NewportSrc/README index f5abdffd..dc98c04f 100644 --- a/motorApp/NewportSrc/README +++ b/motorApp/NewportSrc/README @@ -18,14 +18,82 @@ Octal I/O manual is jumpered as follows; 1-5, 2-6, 9-13, 10-14. The correct jumpering for the ESP300 is; 1-5, 2-6, 9-13, 10-11, 15-16. -Setting the motor resolution (MRES) field. ------------------------------------------- +Setting the motor resolution (MRES) and Engineering Units fields to the +SAME values as the controller's. +------------------------------------------------------------------------- -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). +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 /motorApp/NewportSrc; gnumake clean; gnumake"; this re-compiles + the device drivers with the diagnostic messages selected. +3 - Rebuild your IOC; "cd ; 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 +send_mess(): message = VE? +recv_mess(): message = "ESP300 Version 3.08 09/09/02" +send_mess(): message = ZU +recv_mess(): message = "0H" +send_mess(): message = 01ST +send_mess(): message = 02ST +send_mess(): message = 03ST +send_mess(): message = 01SN? +recv_mess(): message = "2" +send_mess(): message = 01SU? +recv_mess(): message = "0.00003539317" +send_mess(): message = 01MD +recv_mess(): message = "1" +send_mess(): message = 01TP +recv_mess(): message = "0.00000" +send_mess(): message = 01PH +recv_mess(): message = "18000606H, 6H" +send_mess(): message = 01MO? +recv_mess(): message = "0" +send_mess(): message = 01TE? +recv_mess(): message = "0" +send_mess(): message = 02SN? +recv_mess(): message = "2" +send_mess(): message = 02SU? +recv_mess(): message = "0.00009765625" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +Note the response to the SU? and SN? commands and set MRES to that value. + +All three supported controllers (ESP100/300/301) have the same response +to the SN? command; 0 to 10 where +0 = encoder count 6 = micro-inches +1 = motor step 7 = degree +2 = millimeter 8 = gradian +3 = micrometer 9 = radian +4 = inches 10 = milliradian +5 = milli-inches 11 = microradian + +5 - Set the motor record's EGU field to "mm" (based on SN-2) and the MRES field + to 3.539317E-5 (based on SU = 0.00003539317). +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., + +Setting the motor record's Engineering Units field (EGU) to a value DIFFERENT +from the controller's EGU. +------------------------------------------------------------------------------- +In the above example the controller returned SU = "0.00003539317" and SN = "2" +for axis #1. If the user prefers the motor record EGU to be in inches rather +than millimeters, then set EGU = "inch" and, +MRES = (3.539317E-5 mm / 1 encoder tick) X (1 inch / 25.4 mm) + = 1.39343189E-6 inch / 1 encoder tick Newport ESP100 ============== diff --git a/motorApp/NewportSrc/devESP300.cc b/motorApp/NewportSrc/devESP300.cc index 18eb9ef2..b50fc5ab 100644 --- a/motorApp/NewportSrc/devESP300.cc +++ b/motorApp/NewportSrc/devESP300.cc @@ -2,9 +2,10 @@ FILENAME... devESP300.cc USAGE... Motor record device level support for Newport ESP300. -Version: $Revision: 1.4 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2008-03-14 20:17:14 $ +Version: $Revision$ +Modified By: $Author$ +Last Modified: $Date$ +HeadURL: $URL$ */ /* @@ -37,7 +38,6 @@ 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 @@ -188,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 * mr->mres; + cntrl_units = dval * cntrl->drive_resolution[axis - 1]; if (ESP300_table[command] > motor_call->type) motor_call->type = ESP300_table[command]; diff --git a/motorApp/NewportSrc/drvESP300.cc b/motorApp/NewportSrc/drvESP300.cc index a66a0c7b..a1369bad 100644 --- a/motorApp/NewportSrc/drvESP300.cc +++ b/motorApp/NewportSrc/drvESP300.cc @@ -53,14 +53,13 @@ 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. + * .10 05/19/14 rls - Print controller's error code and set RA_PROBLEM. */ #include #include #include -#include "motorRecord.h" #include "motor.h" #include "NewportRegister.h" #include "drvMMCom.h" @@ -216,24 +215,15 @@ static int set_status(int card, int signal) /* Message parsing variables */ char *cptr, *tok_save; char inbuff[BUFF_SIZE], outbuff[BUFF_SIZE]; - int rtn_state, charcnt; + int rtn_state, charcnt, errcode; long mstatus; - double motorData, MRES; + double motorData; 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); @@ -270,7 +260,7 @@ static int set_status(int card, int signal) send_mess(card, outbuff, (char) NULL); charcnt = recv_mess(card, inbuff, 1); - motorData = atof(inbuff) / MRES; + motorData = atof(inbuff) / cntrl->drive_resolution[signal]; if (motorData == motor_info->position) { @@ -340,7 +330,19 @@ static int set_status(int card, int signal) status.Bits.EA_SLIP = 0; status.Bits.EA_SLIP_STALL = 0; status.Bits.EA_HOME = 0; - status.Bits.RA_PROBLEM = 0; + + /* Get error code. */ + sprintf(outbuff, "%.2dTE?", signal + 1); + send_mess(card, outbuff, (char) NULL); + charcnt = recv_mess(card, inbuff, 1); + errcode = atoi(inbuff); + if (errcode != 0) + { + status.Bits.RA_PROBLEM = 1; + printf("ESP300 controller error = %d.\n", errcode); + } + else + status.Bits.RA_PROBLEM = 0; /* Parse motor velocity? */ /* NEEDS WORK */ @@ -675,6 +677,17 @@ errexit: { struct mess_info *motor_info = &brdptr->motor_info[motor_index]; + /* Get controller's EGU for the user (see README). */ + sprintf(buff, "%.2dSN?", motor_index + 1); + send_mess(card_index, buff, 0); + recv_mess(card_index, buff, 1); + + /* 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;