Major rewite to be compatable with factor default

command response mode (ERRLVL 4). The original driver
was designed to response mode (ERRLVL 1) which was
the mode required for MX.
This commit is contained in:
jsullivan-anl
2006-08-31 15:42:31 +00:00
parent ef8279b0ac
commit ad1e2f3181
10 changed files with 1907 additions and 1715 deletions
+59
View File
@@ -0,0 +1,59 @@
SCLA 1,1,1,1
SCLD 1,1,1,1
SCLV 1,1,1,1
SCALE1
DEL SETUP
DEF SETUP
PORT1
ECHO0
DRIVE0000
FOLMAS 0,0,0,0,0,0,0,0
FOLEN00000000
AXSDEF 0000
DRFLVL 1111
DRFEN 0000
DRES 200,200,200,200
PULSE 0.3,0.3,0.3,0.3
DSTALL 0000
ERES ,,,
EFAIL XXXX
ENCPOL XXXX
ENCSND XXXX
ESTALL XXXX
ESK XXXX
ENCCNT XXXX
LH 3,3,3,3
LHAD 1000,1000,1000,1000
LHADA 1000,1000,1000,1000
LSNEG 0,0,0,0
LSPOS 0,0,0,0
HOMA 400,400,400,400
HOMAA 400,400,400,400
HOMV 200,200,200,200
HOMAD 1000,1000,1000,1000
HOMADA 1000,1000,1000,1000
HOMBAC 0000
HOMZ 0000
HOMDF 0000
HOMVF 0.1,0.1,0.1,0.1
HOMEDG 0000
LIMLVL 000000000000
OPTEN0
NTADDR164,54,200,13
NTMASK255,255,255,128
NTFEN2
COMEXC1
END
DEL MAIN
DEF MAIN
GOSUB SETUP
DRIVE1111
MA0
A800,800,800,800
V400,400,400,400
PSET 0,0,0,0
END
STARTP MAIN
+16
View File
@@ -0,0 +1,16 @@
This version of the driver has been tested against
the following Compumotor 6K Controller (TREV Cmnd).
IMCA-CAT
6K4: 92-016740-01-6.5.0 6K (8/8/06)
6K8: 92-016740-01-5.1.2 6K
SN#99060900593
TNT:
*Ethernet enabled: NTFEN1
*6K IP address: 164.54.9.33
*6K Network Mask: 255.255.252.0
*6K Ethernet address: 0-144-85-0-1-208 (decimal)
*6K Ethernet address: 00-90-55-00-01-D0 (hex)
*6K Ethernet not connected
+22 -22
View File
@@ -1,22 +1,22 @@
# Makefile
TOP = ../..
include $(TOP)/configure/CONFIG
# The following are used for debugging messages.
#USR_CXXFLAGS += -DDEBUG
OPT_CXXFLAGS =
DBD += devPC6K.dbd
LIBRARY_IOC = Parker
# Intelligent Motion Systems driver support.
SRCS += ParkerRegister.cc
SRCS += devPC6K.cc drvPC6K.cc
Parker_LIBS += motor asyn
Parker_LIBS += $(EPICS_BASE_IOC_LIBS)
include $(TOP)/configure/RULES
# Makefile
TOP = ../..
include $(TOP)/configure/CONFIG
# The following are used for debugging messages.
#USR_CXXFLAGS += -DDEBUG
OPT_CXXFLAGS = -g -O0
DBD += devPC6K.dbd
LIBRARY_IOC = Parker
# Intelligent Motion Systems driver support.
SRCS += ParkerRegister.cc
SRCS += devPC6K.cc drvPC6K.cc
Parker_LIBS += motor asyn
Parker_LIBS += $(EPICS_BASE_IOC_LIBS)
include $(TOP)/configure/RULES
+83 -83
View File
@@ -1,83 +1,83 @@
/*
FILENAME... ParkerRegister.cc
USAGE... Register Parker/Compumotor motor device driver shell commands.
Version: $Revision: 1.1 $
Modified By: $Author: rivers $
Last Modified: $Date: 2005-12-21 22:58:24 $
*/
/*****************************************************************
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 "ParkerRegister.h"
#include "epicsExport.h"
extern "C"
{
// Parker Setup arguments
static const iocshArg setupArg0 = {"Max. controller count", iocshArgInt};
static const iocshArg setupArg1 = {"Polling rate", iocshArgInt};
// Parker Config arguments
static const iocshArg configArg0 = {"Card being configured", iocshArgInt};
static const iocshArg configArg1 = {"asyn port name", iocshArgString};
// Parker File Upload Argument */
static const iocshArg upLoadArg0 = {"Controller Card#", iocshArgInt};
static const iocshArg upLoadArg1 = {"Upload File Path", iocshArgString};
static const iocshArg upLoadArg2 = {"Program Name <NULL=Immediate>", iocshArgString};
static const iocshArg * const ParkerSetupArgs[2] = {&setupArg0, &setupArg1};
static const iocshArg * const ParkerConfigArgs[2] = {&configArg0, &configArg1};
static const iocshArg * const ParkerUpLoadArgs[3] = {&upLoadArg0, &upLoadArg1, &upLoadArg2};
static const iocshFuncDef setupPC6K = {"PC6KSetup",2, ParkerSetupArgs};
static const iocshFuncDef configPC6K = {"PC6KConfig", 2, ParkerConfigArgs};
static const iocshFuncDef upLoadPC6K = {"PC6KUpLoad", 3, ParkerUpLoadArgs};
static void setupPC6KCallFunc(const iocshArgBuf *args)
{
PC6KSetup(args[0].ival, args[1].ival);
}
static void configPC6KCallFunc(const iocshArgBuf *args)
{
PC6KConfig(args[0].ival, args[1].sval);
}
static void upLoadPC6KCallFunc(const iocshArgBuf *args)
{
PC6KUpLoad(args[0].ival, args[1].sval, args[2].sval);
}
static void ParkerRegister(void)
{
iocshRegister(&setupPC6K, setupPC6KCallFunc);
iocshRegister(&configPC6K, configPC6KCallFunc);
iocshRegister(&upLoadPC6K, upLoadPC6KCallFunc);
}
epicsExportRegistrar(ParkerRegister);
} // extern "C"
/*
FILENAME... ParkerRegister.cc
USAGE... Register Parker/Compumotor motor device driver shell commands.
Version: $Revision: 1.2 $
Modified By: $Author: sullivan $
Last Modified: $Date: 2006-08-31 15:42:31 $
*/
/*****************************************************************
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 "ParkerRegister.h"
#include "epicsExport.h"
extern "C"
{
// Parker Setup arguments
static const iocshArg setupArg0 = {"Max. controller count", iocshArgInt};
static const iocshArg setupArg1 = {"Polling rate", iocshArgInt};
// Parker Config arguments
static const iocshArg configArg0 = {"Card being configured", iocshArgInt};
static const iocshArg configArg1 = {"asyn port name", iocshArgString};
// Parker File Upload Argument */
static const iocshArg upLoadArg0 = {"Controller Card#", iocshArgInt};
static const iocshArg upLoadArg1 = {"Upload File Path", iocshArgString};
static const iocshArg upLoadArg2 = {"Program Name <NULL=Immediate>", iocshArgString};
static const iocshArg * const ParkerSetupArgs[2] = {&setupArg0, &setupArg1};
static const iocshArg * const ParkerConfigArgs[2] = {&configArg0, &configArg1};
static const iocshArg * const ParkerUpLoadArgs[3] = {&upLoadArg0, &upLoadArg1, &upLoadArg2};
static const iocshFuncDef setupPC6K = {"PC6KSetup",2, ParkerSetupArgs};
static const iocshFuncDef configPC6K = {"PC6KConfig", 2, ParkerConfigArgs};
static const iocshFuncDef upLoadPC6K = {"PC6KUpLoad", 3, ParkerUpLoadArgs};
static void setupPC6KCallFunc(const iocshArgBuf *args)
{
PC6KSetup(args[0].ival, args[1].ival);
}
static void configPC6KCallFunc(const iocshArgBuf *args)
{
PC6KConfig(args[0].ival, args[1].sval);
}
static void upLoadPC6KCallFunc(const iocshArgBuf *args)
{
PC6KUpLoad(args[0].ival, args[1].sval, args[2].sval);
}
static void ParkerRegister(void)
{
iocshRegister(&setupPC6K, setupPC6KCallFunc);
iocshRegister(&configPC6K, configPC6KCallFunc);
iocshRegister(&upLoadPC6K, upLoadPC6KCallFunc);
}
epicsExportRegistrar(ParkerRegister);
} // extern "C"
+47 -47
View File
@@ -1,47 +1,47 @@
/*
FILENAME... ParkerRegister.h
USAGE... This file contains function prototypes for Parker 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 PC6KSetup(int, int);
extern RTN_STATUS PC6KConfig(int, const char *);
extern RTN_STATUS PC6KUpLoad(int, const char *, const char *);
/*
FILENAME... ParkerRegister.h
USAGE... This file contains function prototypes for Parker 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 PC6KSetup(int, int);
extern RTN_STATUS PC6KConfig(int, const char *);
extern RTN_STATUS PC6KUpLoad(int, const char *, const char *);
+226 -212
View File
@@ -1,212 +1,226 @@
Parker 6K8 Motor Controller Series
==============================================================================
Ethernet Configuration
----------------------------------
Default Ethernet Address: 192.168.10.30
Ascii Command Port: 5002
Note: This controller's ethernet port only accepts one server at a
time. If the RS232 is in use then the ethernet port is closed.
Controller Configuration
------------------------------------------
Disable Echo
ECHO0
Enable continuous command mode
COMEXEC1
---------------- Network Commands -------------------
NTADDRxx,xx,xx,xx = network IP
NTMASKxxx,xxx,xxx,xxx = network mask
NTFEN1 = network enable
Commands
------------------------------------------
REVISION
--------
TREV
*TREV92-016740-01-6.4.0 GEM6K GT6K-L8
(60 characters)
CONTINUOUS COMMAND MODE
------------------------
COMEXC1 = set on, required for status updates during motion.
****(No Reply)***
LIMIT SWITCH ENABE
-----------------------
LH3 - enable hardware LS
LH0 - disable hardware LS
ENABLE DRIVE
-------------
DRIVE1 - enable drive (must be renable after a dreset)
*****(No Reply when Set)*********
DRIVE <cr>
*DRIVE<state> 0 or 1
MOTION MODE
-------------
MA<0/1> - Set incremental or absolute mode
0 = incremental
1 = absolute
MC1 - Coninutous Mode (Jog)
MOTION PARAMETERS
------------------
A<accel> - set acceleration units/sec^2
A<cr>
*A#### - prints acceleration
V<vel> - velocity
D<distance> - set distance
GO - start motion
ie: motion
MA1: A20: V25: D25000: GO
Setting absolute postion
<#>PSET<nnnnn>
Velociy Feedback:
<#>TVEL - commanded velocity
<#>TVELA - actual
Position Feedback:
<#>TPC - commanded position
<resp> *1TPC+0
<#>TPE - encoder position
<resp> *1TPE+0
SCALING:
SCALE0/1 - disable/enable
SCLA - acceleration
SCLV - velocity
SCLD - distance
DRES - Drive Resolution (steps/rev) **** Stepper Only *****
ERES - Encoder Resolution (steps/rev)
DRESET - drive reset - enables new scaling factors
STATUS:
<#>TAS
*<#>TAS0000_0000_0000_0000_0000_0000_0000_0000 (32 bits)
^ bit 1 ^bit 32
*** Returns - *0 or *1
TAS.1 - in motion (commanded - will be off during settling time)
TAS.2 - direction is negative
TAS.5 - home successfull
TAS.13 - drive shutdown
TAS.14 - drive fault
TAS.15 - Plus Hardware Travel Limit
TAS.16 - Minus Hardware Travel Limit
TAS.17 - Plus Software TL (LSPOS)
TAS.18 - Minus Software TL (LSNEG)
TAS.24 - In Target Zone
ie.
1TAS
*1TAS0000_0000_0000_0000_0000_0000_000_00000
-------------------- Jog Method --------------
MC1 - Use continuous motion mode for jogging
---------------- Program Handling ------------
TDIR - list downloaded programs
DEL <filename> - delete program
DEF <filname) - create program
<line1>
<line2>
.
.
END - end of program creation
TPROG - transfer program contents
============== Build Info ======================
xxxApp/src
Makefile
--------
xxx_Common_LIBS += Parker
xxCommonInclude.dbd
-------------------
include "devPC6K.dbd"
============= IOC Boot info ======================
iocBoot/iocLinux
serial.cmd
----------
# serial 1 is a RS232 link to a Parker Gemini 6K Controller
drvAsynSerialPortConfigure("serial1", "/dev/ttyUSB0", 0, 0, 0)
asynOctetSetInputEos("serial1",0,">")
asynOctetSetOutputEos("serial1",0,"\r")
asynOctetConnect("serial1", "serial1")
# serial 3 is ETHERNET link to the Parker Gemini 6K Controller
drvAsynIPPortConfigure("serial3", "192.168.10.29:5002", 0, 0, 0)
asynOctetConnect("serial3", "serial3")
asynOctetSetInputEos("serial3",0,">")
asynOctetSetOutputEos("serial3",0,"\r")
.
# Parker/Compumotor - Gemini 6K driver setup parameters:
# (1) maximum number of controllers in system
# (2) motor task polling rate (min=1Hz, max=60Hz)
PC6KSetup(2, 60)
# Parker/Compumotor - Gemini 6K driver configuration parameters:
# (1) controller being configured
# (2) asyn port name (string)
PC6KConfig(0, "serial1")
PC6KConfig(1, "serial3")
motor.substitutions
-------------------
Set the DTYPE column to "PC6K"
============== IOC Runtime Info (Post iocInit) ========================
# PC5KUpLoad(Controller #, <source file name>, <dest. file name (OPTIONAL)>)
### Send setup files to 6K8
PC6KUpLoad(0,"6k_setup","setup")
### Set startup file to setup
PC6KUpLoad(0,"startp")
Parker 6K8 Motor Controller Series
==============================================================================
Ethernet Configuration
----------------------------------
Default Ethernet Address: 192.168.10.30
Ascii Command Port: 5002
Note: This controller's ethernet port only accepts one server at a
time. If the RS232 is in use then the ethernet port is closed.
Controller Configuration
------------------------------------------
Disable Echo
ECHO0
Enable continuous command mode
COMEXEC1
Communication Settings
EOL13,10,0
EOT13,0,0
ERRLVL4
ERRDEF13,10,45,32
ERROK13,10,62,32
ERRBAD13,10,63,32
---------------- Network Commands -------------------
NTADDRxx,xx,xx,xx = network IP
NTMASKxxx,xxx,xxx,xxx = network mask
NTFEN2 = network enable
Workstations cannot link to 6K Controllers without
an explicit arp table entry using the 'arp' command.
arp -s <6K IP addr> <6K MAC addr> <Workstation IP addr>
* Use the 6K 'TNT' command to see the ip and MAC address
Commands
------------------------------------------
REVISION
--------
TREV
*TREV92-016740-01-6.4.0 GEM6K GT6K-L8
(60 characters)
CONTINUOUS COMMAND MODE
------------------------
COMEXC1 = set on, required for status updates during motion.
****(No Reply)***
LIMIT SWITCH ENABE
-----------------------
LH3 - enable hardware LS
LH0 - disable hardware LS
ENABLE DRIVE
-------------
DRIVE1 - enable drive (must be renable after a dreset)
*****(No Reply when Set)*********
DRIVE <cr>
*DRIVE<state> 0 or 1
MOTION MODE
-------------
MA<0/1> - Set incremental or absolute mode
0 = incremental
1 = absolute
MC1 - Coninutous Mode (Jog)
MOTION PARAMETERS
------------------
A<accel> - set acceleration units/sec^2
A<cr>
*A#### - prints acceleration
V<vel> - velocity
D<distance> - set distance
GO - start motion
ie: motion
MA1: A20: V25: D25000: GO
Setting absolute postion
<#>PSET<nnnnn>
Velociy Feedback:
<#>TVEL - commanded velocity
<#>TVELA - actual
Position Feedback:
<#>TPC - commanded position
<resp> *1TPC+0
<#>TPE - encoder position
<resp> *1TPE+0
SCALING:
SCALE0/1 - disable/enable
SCLA - acceleration
SCLV - velocity
SCLD - distance
DRES - Drive Resolution (steps/rev) **** Stepper Only *****
ERES - Encoder Resolution (steps/rev)
DRESET - drive reset - enables new scaling factors
STATUS:
<#>TAS
*<#>TAS0000_0000_0000_0000_0000_0000_0000_0000 (32 bits)
^ bit 1 ^bit 32
*** Returns - *0 or *1
TAS.1 - in motion (commanded - will be off during settling time)
TAS.2 - direction is negative
TAS.5 - home successfull
TAS.13 - drive shutdown
TAS.14 - drive fault
TAS.15 - Plus Hardware Travel Limit
TAS.16 - Minus Hardware Travel Limit
TAS.17 - Plus Software TL (LSPOS)
TAS.18 - Minus Software TL (LSNEG)
TAS.24 - In Target Zone
ie.
1TAS
*1TAS0000_0000_0000_0000_0000_0000_000_00000
-------------------- Jog Method --------------
MC1 - Use continuous motion mode for jogging
---------------- Program Handling ------------
TDIR - list downloaded programs
DEL <filename> - delete program
DEF <filname) - create program
<line1>
<line2>
.
.
END - end of program creation
TPROG - transfer program contents
============== Build Info ======================
xxxApp/src
Makefile
--------
xxx_Common_LIBS += Parker
xxCommonInclude.dbd
-------------------
include "devPC6K.dbd"
============= IOC Boot info ======================
iocBoot/iocLinux
serial.cmd
----------
# serial 1 is a RS232 link to a Parker Gemini 6K Controller
drvAsynSerialPortConfigure("serial1", "/dev/ttyUSB0", 0, 0, 0)
asynOctetSetInputEos("serial1",0,">")
asynOctetSetOutputEos("serial1",0,"\r")
asynOctetConnect("serial1", "serial1")
# serial 3 is ETHERNET link to the Parker Gemini 6K Controller
drvAsynIPPortConfigure("serial3", "192.168.10.29:5002", 0, 0, 0)
asynOctetConnect("serial3", "serial3")
asynOctetSetInputEos("serial3",0,">")
asynOctetSetOutputEos("serial3",0,"\r")
.
# Parker/Compumotor - Gemini 6K driver setup parameters:
# (1) maximum number of controllers in system
# (2) motor task polling rate (min=1Hz, max=60Hz)
PC6KSetup(2, 60)
# Parker/Compumotor - Gemini 6K driver configuration parameters:
# (1) controller being configured
# (2) asyn port name (string)
PC6KConfig(0, "serial1")
PC6KConfig(1, "serial3")
motor.substitutions
-------------------
Set the DTYPE column to "PC6K"
============== IOC Runtime Info (Post iocInit) ========================
# PC5KUpLoad(Controller #, <source file name>, <dest. file name (OPTIONAL)>)
### Send setup files to 6K8
PC6KUpLoad(0,"6k_setup","setup")
### Set startup file to setup
PC6KUpLoad(0,"startp")
+411 -334
View File
@@ -1,334 +1,411 @@
/*
FILENAME... devPC6K.cc
USAGE... Motor record device level support for Parker Compumotor drivers
Version: $Revision: 1.1 $
Modified By: $Author: rivers $
Last Modified: $Date: 2005-12-21 22:58:24 $
*/
/*
* Original Author: Mark Rivers
* Date: 10/20/97
*
* 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 04-07-05 jps initialized from devMM4000.cc
*/
#include <string.h>
#include <math.h>
#include "motorRecord.h"
#include "motor.h"
#include "motordevCom.h"
#include "drvPC6K.h"
#include "epicsExport.h"
#define STATIC static
extern struct driver_table PC6K_access;
/* ----------------Create the dsets for devPC6K----------------- */
STATIC struct driver_table *drvtabptr;
STATIC long PC6K_init(void *);
STATIC long PC6K_init_record(void *);
STATIC long PC6K_start_trans(struct motorRecord *);
STATIC RTN_STATUS PC6K_build_trans(motor_cmnd, double *, struct motorRecord *);
STATIC RTN_STATUS PC6K_end_trans(struct motorRecord *);
struct motor_dset devPC6K =
{
{8, NULL, (DEVSUPFUN) PC6K_init, (DEVSUPFUN) PC6K_init_record, NULL},
motor_update_values,
PC6K_start_trans,
PC6K_build_trans,
PC6K_end_trans
};
extern "C" {epicsExportAddress(dset,devPC6K);}
/* --------------------------- program data --------------------- */
/* This table is used to define the command types */
/* WARNING! this must match "motor_cmnd" in motor.h */
static msg_types PC6K_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 **PC6K_cards;
/* --------------------------- program data --------------------- */
/* initialize device support for PC6K stepper motor */
STATIC long PC6K_init(void *arg)
{
long rtnval;
int after = (int) arg;
if (after == 0)
{
drvtabptr = &PC6K_access;
(drvtabptr->init)();
}
rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr, &PC6K_cards);
return(rtnval);
}
/* initialize a record instance */
STATIC long PC6K_init_record(void *arg)
{
struct motorRecord *mr = (struct motorRecord *) arg;
return(motor_init_record_com(mr, *drvtabptr->cardcnt_ptr, drvtabptr, PC6K_cards));
}
/* start building a transaction */
STATIC long PC6K_start_trans(struct motorRecord *mr)
{
return(motor_start_trans_com(mr, PC6K_cards));
}
/* end building a transaction */
STATIC RTN_STATUS PC6K_end_trans(struct motorRecord *mr)
{
return(motor_end_trans_com(mr, drvtabptr));
}
/* add a part to the transaction */
STATIC RTN_STATUS PC6K_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 controller *brdptr;
struct mess_info *motor_info;
struct PC6KController *cntrl;
char buff[110];
int signal, axis, card, intval;
int maxdigits;
double dval, cntrl_units;
unsigned int size;
RTN_STATUS rtnval;
rtnval = OK;
buff[0] = '\0';
/* Protect against NULL pointer with WRTITE_MSG(GO/STOP_AXIS/GET_INFO, NULL). */
intval = (parms == NULL) ? 0 : NINT(parms[0]);
dval = (parms == NULL) ? 0 : *parms;
motor_call = &(trans->motor_call);
card = motor_call->card;
signal = motor_call->signal;
axis = signal+1; /* Motors start at 1 */
brdptr = (*trans->tabptr->card_array)[card];
if (brdptr == NULL)
return(rtnval = ERROR);
cntrl = (struct PC6KController *) brdptr->DevicePrivate;
cntrl_units = dval * cntrl->drive_resolution[signal];
maxdigits = cntrl->res_decpts[signal];
if (PC6K_table[command] > motor_call->type)
motor_call->type = PC6K_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);
strcat(motor_call->message, PC6K_OUT_EOS);
}
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);
strcat(motor_call->message, ":");
}
if (strlen(mr->post) != 0)
motor_call->postmsgptr = (char *) &mr->post;
break;
default:
break;
}
switch (command)
{
case MOVE_ABS:
sprintf(buff, "%dMA1:%dMC0:%dD%d:", axis, axis, axis, intval);
break;
case MOVE_REL:
sprintf(buff, "%dMA0:%dMC0:%dD%d:", axis, axis, axis, intval);
break;
case HOME_FOR:
sprintf(buff, "%dHOM0:", axis);
break;
case HOME_REV:
sprintf(buff, "%dHOM1:", axis);
break;
case LOAD_POS:
/* The Feedback position follows the Reference set position */
sprintf(buff, "%dPSET%d:", axis, intval);
break;
case SET_VEL_BASE:
break; /* PC6K does not use base velocity */
case SET_VELOCITY:
sprintf(buff, "%dV%.*f:", axis, maxdigits, cntrl_units);
break;
case SET_ACCEL:
/* Set Accel, Avg Accel, Decel, Avg Decel - assume avg to be 1/2 accel */
sprintf(buff, "%dA%.*f:%dAA%.*f:%dAD%.*f:%dADA%.*f:",
axis, maxdigits, cntrl_units,
axis, maxdigits, cntrl_units/2,
axis, maxdigits, cntrl_units,
axis, maxdigits, cntrl_units/2);
break;
case GO:
sprintf(buff, "%dGO:", axis);
break;
case SET_ENC_RATIO:
// sprintf(buff, "%dERES%d:%dDRESET:", axis, intval, axis);
break;
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, "!%dK:", axis);
break;
case JOG:
if (intval > 0)
sprintf(buff, "%dMC1:%dV%.*f:%dD+:%dGO:", axis, axis, maxdigits, cntrl_units, axis, axis);
else
sprintf(buff, "%dMC1:%dV%.*f:%dD-:%dGO:", axis, axis, maxdigits, cntrl_units, axis, axis);
break;
case SET_PGAIN:
sprintf(buff, "%dSGP%d:", axis, intval);
break;
case SET_IGAIN:
sprintf(buff, "%dSGI%d:", axis, intval);
break;
case SET_DGAIN:
sprintf(buff, "%dSGV%d:", axis, intval); /* Velocity Gain */
break;
case ENABLE_TORQUE:
sprintf(buff, "%dDRIVE1:", axis);
break;
case DISABL_TORQUE:
sprintf(buff, "%dDRIVE0:", axis);
break;
case SET_HIGH_LIMIT:
motor_info = &(*trans->tabptr->card_array)[card]->motor_info[signal];
trans->state = IDLE_STATE; /* No command sent to the controller. */
if (motor_info->high_limit > motor_info->low_limit &&
intval > motor_info->high_limit)
{
mr->dhlm = motor_info->high_limit * mr->mres;
rtnval = ERROR;
}
break;
case SET_LOW_LIMIT:
motor_info = &(*trans->tabptr->card_array)[card]->motor_info[signal];
trans->state = IDLE_STATE; /* No command sent to the controller. */
if (motor_info->low_limit < motor_info->high_limit &&
intval < motor_info->low_limit)
{
mr->dllm = motor_info->low_limit * mr->mres;
rtnval = ERROR;
}
break;
default:
rtnval = ERROR;
}
size = strlen(buff);
if (size > sizeof(buff) || (strlen(motor_call->message) + size) > MAX_MSG_SIZE)
errlogMessage("PC6K_build_trans(): buffer overflow.\n");
else
strcat(motor_call->message, buff);
return(rtnval);
}
/*
FILENAME... devPC6K.cc
USAGE... Motor record device level support for Parker Compumotor drivers
Version: $Revision: 1.2 $
Modified By: $Author: sullivan $
Last Modified: $Date: 2006-08-31 15:42:30 $
*/
/*
* Original Author: Mark Rivers
* Date: 10/20/97
*
* 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 04-07-05 jps initialized from devMM4000.cc
*/
#include <string.h>
#include <math.h>
#include "motorRecord.h"
#include "motor.h"
#include "motordevCom.h"
#include "drvPC6K.h"
#include "epicsExport.h"
#define STATIC static
extern struct driver_table PC6K_access;
/* ----------------Create the dsets for devPC6K----------------- */
STATIC struct driver_table *drvtabptr;
STATIC long PC6K_init(void *);
STATIC long PC6K_init_record(void *);
STATIC long PC6K_start_trans(struct motorRecord *);
STATIC RTN_STATUS PC6K_build_trans(motor_cmnd, double *, struct motorRecord *);
STATIC RTN_STATUS PC6K_end_trans(struct motorRecord *);
struct motor_dset devPC6K =
{
{8, NULL, (DEVSUPFUN) PC6K_init, (DEVSUPFUN) PC6K_init_record, NULL},
motor_update_values,
PC6K_start_trans,
PC6K_build_trans,
PC6K_end_trans
};
extern "C" {epicsExportAddress(dset,devPC6K);}
/* --------------------------- program data --------------------- */
/* This table is used to define the command types */
/* WARNING! this must match "motor_cmnd" in motor.h */
static msg_types PC6K_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 **PC6K_cards;
/* --------------------------- program data --------------------- */
/* initialize device support for PC6K stepper motor */
STATIC long PC6K_init(void *arg)
{
long rtnval;
int after = (int) arg;
if (after == 0)
{
drvtabptr = &PC6K_access;
(drvtabptr->init)();
}
rtnval = motor_init_com(after, *drvtabptr->cardcnt_ptr, drvtabptr, &PC6K_cards);
return(rtnval);
}
/* initialize a record instance */
STATIC long PC6K_init_record(void *arg)
{
struct motorRecord *mr = (struct motorRecord *) arg;
return(motor_init_record_com(mr, *drvtabptr->cardcnt_ptr, drvtabptr, PC6K_cards));
}
/* start building a transaction */
STATIC long PC6K_start_trans(struct motorRecord *mr)
{
return(motor_start_trans_com(mr, PC6K_cards));
}
/* end building a transaction */
STATIC RTN_STATUS PC6K_end_trans(struct motorRecord *mr)
{
return(motor_end_trans_com(mr, drvtabptr));
}
/* add a part to the transaction */
STATIC RTN_STATUS PC6K_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 controller *brdptr;
struct mess_info *motor_info;
struct PC6KController *cntrl;
char buff[110];
int signal, axis, card, intval;
int maxdigits;
int cmndArg;
double dval, cntrl_units;
unsigned int size;
bool sendMsg;
RTN_STATUS rtnval;
rtnval = OK;
buff[0] = '\0';
sendMsg = true;
/* Protect against NULL pointer with WRTITE_MSG(GO/STOP_AXIS/GET_INFO, NULL). */
intval = (parms == NULL) ? 0 : NINT(parms[0]);
dval = (parms == NULL) ? 0 : *parms;
motor_start_trans_com(mr, PC6K_cards);
motor_call = &(trans->motor_call);
card = motor_call->card;
signal = motor_call->signal;
axis = signal+1; /* Motors start at 1 */
motor_call->type = PC6K_table[command];
brdptr = (*trans->tabptr->card_array)[card];
if (brdptr == NULL)
return(rtnval = ERROR);
cntrl = (struct PC6KController *) brdptr->DevicePrivate;
/* 6K Controllers expect Velocity and Acceleration settings in Revs/sec/sec */
cntrl_units = dval * cntrl->drive_resolution[signal];
maxdigits = cntrl->res_decpts[signal];
if (PC6K_table[command] > motor_call->type)
motor_call->type = PC6K_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);
strcat(motor_call->message, PC6K_OUT_EOS);
}
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, PC6K_cards);
motor_call->type = PC6K_table[command];
}
if (strlen(mr->post) != 0)
motor_call->postmsgptr = (char *) &mr->post;
break;
default:
break;
}
/* Parker 6K controllers do not support multiple commands per line */
switch (command)
{
case MOVE_ABS:
case MOVE_REL:
{
cmndArg = (command == MOVE_ABS) ? 1 : 0;
sprintf(buff, "%dMA%d", axis, cmndArg);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
sprintf(buff, "%dMC0", axis);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
sprintf(buff, "%dD%d", axis, intval);
}
break;
case HOME_FOR:
sprintf(buff, "%dHOM0", axis);
break;
case HOME_REV:
sprintf(buff, "%dHOM1", axis);
break;
case LOAD_POS:
/* The Feedback position follows the Reference set position */
sprintf(buff, "%dPSET%d", axis, intval);
break;
case SET_VEL_BASE:
sendMsg = false;
break; /* PC6K does not use base velocity */
case SET_VELOCITY:
// sprintf(buff, "%dV%.*f", axis, maxdigits, cntrl_units);
sprintf(buff, "%dV%d", axis, intval);
break;
case SET_ACCEL:
/* Set Accel, Avg Accel, Decel, Avg Decel - assume avg to be 1/2 accel */
// sprintf(buff, "%dA%.*f", axis, maxdigits, cntrl_units);
sprintf(buff, "%dA%d", axis, intval);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
// sprintf(buff, "%dAA%.*f", axis, maxdigits, cntrl_units/2);
sprintf(buff, "%dAA%d", axis, intval/2);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
// sprintf(buff, "%dAD%.*f", axis, maxdigits, cntrl_units);
sprintf(buff, "%dAD%d", axis, intval);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
// sprintf(buff, "%dADA%.*f", axis, maxdigits, cntrl_units/2);
sprintf(buff, "%dADA%d", axis, intval/2);
break;
case GO:
sprintf(buff, "%dGO", axis);
break;
case SET_ENC_RATIO:
// sprintf(buff, "%dERES%d:%dDRESET:", axis, intval, axis);
sendMsg = false;
break;
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 */
sendMsg = false;
break;
case STOP_AXIS:
sprintf(buff, "!%dS", axis);
break;
case JOG:
sprintf(buff, "%dMC1", axis);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
// sprintf(buff, "%dV%.*f", axis, maxdigits, cntrl_units);
sprintf(buff, "%dV%d", axis, intval);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
if (intval >= 0)
sprintf(buff, "%dD+", axis);
else
sprintf(buff, "%dD-", axis);
strcat(motor_call->message, buff);
rtnval = motor_end_trans_com(mr, drvtabptr);
rtnval = (RTN_STATUS) motor_start_trans_com(mr, PC6K_cards);
motor_call->type = PC6K_table[command];
sprintf(buff, "%dGO", axis);
break;
case SET_PGAIN:
sprintf(buff, "%dSGP%d", axis, intval);
break;
case SET_IGAIN:
sprintf(buff, "%dSGI%d", axis, intval);
break;
case SET_DGAIN:
sprintf(buff, "%dSGV%d", axis, intval); /* Velocity Gain */
break;
case ENABLE_TORQUE:
sprintf(buff, "%dDRIVE1", axis);
break;
case DISABL_TORQUE:
sprintf(buff, "%dDRIVE0", axis);
break;
case SET_HIGH_LIMIT:
motor_info = &(*trans->tabptr->card_array)[card]->motor_info[signal];
trans->state = IDLE_STATE; /* No command sent to the controller. */
if (motor_info->high_limit > motor_info->low_limit &&
intval > motor_info->high_limit)
{
mr->dhlm = motor_info->high_limit * mr->mres;
rtnval = ERROR;
}
sendMsg = false;
break;
case SET_LOW_LIMIT:
motor_info = &(*trans->tabptr->card_array)[card]->motor_info[signal];
trans->state = IDLE_STATE; /* No command sent to the controller. */
if (motor_info->low_limit < motor_info->high_limit &&
intval < motor_info->low_limit)
{
mr->dllm = motor_info->low_limit * mr->mres;
rtnval = ERROR;
}
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("PC6K_build_trans(): buffer overflow.\n");
else
{
strcat(motor_call->message, buff);
motor_end_trans_com(mr, drvtabptr);
}
}
return(rtnval);
}
+5 -7
View File
@@ -1,7 +1,5 @@
# Parker/Compumotor Device Driver support.
device(motor,VME_IO,devPC6K,"PC6K")
driver(drvPC6K)
registrar(ParkerRegister)
#variable(drvPC6Kdebug)
# Parker/Compumtor Device Driver support.
device(motor,VME_IO,devPC6K,"PC6K")
driver(drvPC6K)
registrar(ParkerRegister)
variable(drvPC6Kdebug)
File diff suppressed because it is too large Load Diff
+125 -122
View File
@@ -1,122 +1,125 @@
/*
FILENAME... drvPC6K.h
USAGE... This file contains Parker Compumotor driver "include"
information that is specific to the 6K series serial controller
Version: $Revision: 1.1 $
Modified By: $Author: rivers $
Last Modified: $Date: 2005-12-21 22:58:25 $
*/
/*
* Original Author: Mark Rivers
* Current Author: J. Sullivan
* Date: 10/16/97
*
* 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 06-20-05 jps initialized from drvSPiiPlus.h
*/
#ifndef INCdrvPC6Kh
#define INCdrvPC6Kh 1
#include "motor.h"
#include "motordrvCom.h"
#include "asynDriver.h"
#include "asynOctetSyncIO.h"
#define PC6K_MSG_SIZE 120
#define PC6K_STATUS_RETRY 10
/* End-of-string defines */
#define PC6K_OUT_EOS "\n" /* Command */
#define PC6K_IN_EOS "\n" /* Reply */
enum PC6K_query_types {QSTATUS, QPOS, QEA_POS, QVEL, QDRIVE};
enum PC6K_model
{
PC6K8,
PCGem6K
};
enum PC6K_motor_type
{
UNUSED,
STEPPER,
DC
};
#ifndef __cplusplus
typedef enum PC6K_model PC6K_model;
typedef enum PC6K_motor_type PC6K_motor_type;
#endif
/* Motion Master specific data is stored in this structure. */
struct PC6KController
{
asynUser *pasynUser; /* For RS-232 */
int asyn_address; /* Use for GPIB or other address with asyn */
char asyn_port[80]; /* asyn port name */
char recv_string[sizeof(PC6K_query_types)][PC6K_MSG_SIZE]; /* Query result strings */
double home_preset[MAX_AXIS]; /* Controller's home preset position (XF command). */
PC6K_model model; /* Motion Master Model. */
PC6K_motor_type type[8]; /* For 6K8 only; Motor type array. */
/* Controller resolution array
* Units are in [Controller EGU's / Record RAW units].
*/
double drive_resolution[MAX_AXIS];
int res_decpts[MAX_AXIS]; /* Drive resolution significant dec. pts. */
CommStatus status; /* Controller communication status. */
int status_retry; /* This controller needs multiple retry after GO */
};
/* Motor status bits for PC6K - TAS command.
*
* cmd: <#>TAS
* rsp: *<#>TAS0000_0000_0000_0000_0000_0000_0000_0000 (32 bits)
* ^ bit 1 ^bit 32
*/
/* Adjusted bit number (-1) from manual - start counting from 0) */
#define TAS_INMOTION 0
#define TAS_NEG 1
#define TAS_HOME 4+1 /* Home Sucessfull */
#define TAS_DRIVEDOWN 12+3 /* Drive Shutdown */
#define TAS_DRIVEFAULT 13+3 /* Drive Fault Occurred */
#define TAS_HPLUSTL 14+3 /* Hardware Plus Travel Limit */
#define TAS_HMINUSTL 15+3 /* Hardware Minus Travel Limit */
#define TAS_SPLUSTL 16+4 /* Software Plus Travel Limit */
#define TAS_SMINUSTL 17+4 /* Software Minus Travel Limit */
#define TAS_POSERROR 22+5 /* Position Error */
#define TAS_INTARGET 23+5 /* In Target Zone */
#endif /* INCdrvPC6Kh */
/*
FILENAME... drvPC6K.h
USAGE... This file contains Parker Compumotor driver "include"
information that is specific to the 6K series serial controller
Version: $Revision: 1.2 $
Modified By: $Author: sullivan $
Last Modified: $Date: 2006-08-31 15:42:31 $
*/
/*
* Original Author: Mark Rivers
* Current Author: J. Sullivan
* Date: 10/16/97
*
* 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 06-20-05 jps initialized from drvSPiiPlus.h
*/
#ifndef INCdrvPC6Kh
#define INCdrvPC6Kh 1
#include "motor.h"
#include "motordrvCom.h"
#include "asynDriver.h"
#include "asynOctetSyncIO.h"
#define PC6K_MSG_SIZE 120
#define PC6K_STATUS_RETRY 10
/* End-of-string defines */
#define PC6K_OUT_EOS "\n" /* Command */
// #define PC6K_IN_EOS "\n" /* Reply */
#define PC6K_IN_EOS ">" /* Reply */
#define PC6K_QUERY_CNT 5
enum PC6K_query_types {QSTATUS, QPOS, QEA_POS, QVEL, QDRIVE};
enum PC6K_model
{
PC6K8,
PCGem6K
};
enum PC6K_motor_type
{
UNUSED,
STEPPER,
DC
};
#ifndef __cplusplus
typedef enum PC6K_model PC6K_model;
typedef enum PC6K_motor_type PC6K_motor_type;
#endif
/* Motion Master specific data is stored in this structure. */
struct PC6KController
{
asynUser *pasynUser; /* For RS-232 */
int asyn_address; /* Use for GPIB or other address with asyn */
char asyn_port[80]; /* asyn port name */
char recv_string[PC6K_QUERY_CNT][PC6K_MSG_SIZE]; /* Query result strings */
double home_preset[MAX_AXIS]; /* Controller's home preset position (XF command). */
PC6K_model model; /* Motion Master Model. */
PC6K_motor_type type[8]; /* For 6K8 only; Motor type array. */
/* Controller resolution array
* Units are in [Controller EGU's / Record RAW units].
*/
double drive_resolution[MAX_AXIS];
int res_decpts[MAX_AXIS]; /* Drive resolution significant dec. pts. */
CommStatus status; /* Controller communication status. */
int status_retry; /* This controller needs multiple retry after GO */
};
/* Motor status bits for PC6K - TAS command.
*
* cmd: <#>TAS
* rsp: *<#>TAS0000_0000_0000_0000_0000_0000_0000_0000 (32 bits)
* ^ bit 1 ^bit 32
*/
/* Adjusted bit number (-1) from manual - start counting from 0) */
#define TAS_INMOTION 0
#define TAS_NEG 1
#define TAS_HOME 4+1 /* Home Sucessfull */
#define TAS_DRIVEDOWN 12+3 /* Drive Shutdown */
#define TAS_DRIVEFAULT 13+3 /* Drive Fault Occurred */
#define TAS_HPLUSTL 14+3 /* Hardware Plus Travel Limit */
#define TAS_HMINUSTL 15+3 /* Hardware Minus Travel Limit */
#define TAS_SPLUSTL 16+4 /* Software Plus Travel Limit */
#define TAS_SMINUSTL 17+4 /* Software Minus Travel Limit */
#define TAS_POSERROR 22+5 /* Position Error */
#define TAS_INTARGET 23+5 /* In Target Zone */
#endif /* INCdrvPC6Kh */