#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "paramLib.h"
#include "epicsFindSymbol.h"
#include "epicsTime.h"
#include "epicsThread.h"
#include "epicsEvent.h"
#include "epicsMutex.h"
#include "ellLib.h"
#include "drvSup.h"
#include "epicsExport.h"
#include "motor_interface.h"
#include "asynDriver.h"
#include "asynOctetSyncIO.h"
#include "pmacAsynCoord.h"
Go to the source code of this file.
Classes | |
struct | drvPmac |
struct | motorAxisHandle |
Defines | |
#define | DEFINE_MOTOR_PROTOTYPES 1 |
#define | TRACE_FLOW motorAxisTraceFlow |
#define | TRACE_DRIVER motorAxisTraceIODriver |
#define | TRACE_ERROR motorAxisTraceError |
#define | MAX(a, b) ((a)>(b)? (a): (b)) |
#define | MIN(a, b) ((a)<(b)? (a): (b)) |
#define | NAXES 9 |
#define | NAME(pAxis) (axisName[(pAxis->axis)]) |
#define | CSVAR(pAxis) (pAxis->coord_system + 50) |
#define | DEMAND "Q7%d" |
#define | READBACK "Q8%d" |
Typedefs | |
typedef struct drvPmac * | PMACDRV_ID |
typedef struct drvPmac | drvPmac_t |
typedef struct motorAxisHandle | motorAxis |
Functions | |
epicsExportAddress (drvet, pmacAsynCoord) | |
int | asynMatch (asynUser *pasynUser, char *checkport, int checkaddr) |
int | pmacAsynCoordCreate (char *port, int addr, int cs, int ref, int program) |
int | pmacSetDefaultCoordSteps (double defaultSteps) |
int | pmacSetCoordStepsPerUnit (int ref, int axis, double stepsPerUnit) |
int | pmacSetCoordMovingPollPeriod (int ref, int movingPollPeriod) |
int | pmacSetCoordIdlePollPeriod (int ref, int idlePollPeriod) |
Variables | |
motorAxisDrvSET_t | pmacAsynCoord |
const char | axisName [] = {' ', 'A','B','C','U','V','W','X','Y','Z'} |
This is a driver for Delta-Tau PMAC Coordinate Systems, designed to interface with the "motor API" style interface that allows drivers to be used with the standard asyn device and driver support for the motor record
To use this driver, you should create a co-ordinate system with kinematics and a position reporting PLC as detailed in the Delta Tau Turbo PMAC User Manual, along with a position reporting PLC. You should follow the conventions set out in the DLS PMAC Programming Standards
The driver uses the following interface:
The following code will open an IP Port to an ethernet PMAC, then wrap CS2 in a driver with ref 0 running prog 10, polling for position every 0.5s when the motors aren't moving, and every 0.1s when they are, and set the scale factor for X on CS2 to 100000.0, so the relevant motor record will need an MRES of 1.0/100000.0
# Create IP Port (IPPort, IPAddr) # This function lives in tpmac pmacAsynIPConfigure("BRICK1port", "172.23.243.156:1025") # Create CS (ControllerPort, Addr, CSNumber, CSRef, Prog) pmacAsynCoordCreate("BRICK1port", 0, 2, 0, 10) # Configure CS (PortName, DriverName, CSRef, NAxes) drvAsynMotorConfigure("BRICK1CS2", "pmacAsynCoord", 0, 9) # Set scale factor (CS_Ref, axis, stepsPerUnit) pmacSetCoordStepsPerUnit(0, 6, 100000.0) # Set Idle and Moving poll periods (CS_Ref, PeriodMilliSeconds) pmacSetCoordIdlePollPeriod(0, 500) pmacSetCoordMovingPollPeriod(0, 100)
Definition in file pmacAsynCoord.c.
#define CSVAR | ( | pAxis | ) | (pAxis->coord_system + 50) |
Definition at line 158 of file pmacAsynCoord.c.
#define DEFINE_MOTOR_PROTOTYPES 1 |
Definition at line 77 of file pmacAsynCoord.c.
#define DEMAND "Q7%d" |
Definition at line 160 of file pmacAsynCoord.c.
#define MAX | ( | a, | ||
b | ||||
) | ((a)>(b)? (a): (b)) |
Definition at line 152 of file pmacAsynCoord.c.
#define MIN | ( | a, | ||
b | ||||
) | ((a)<(b)? (a): (b)) |
Definition at line 153 of file pmacAsynCoord.c.
#define NAME | ( | pAxis | ) | (axisName[(pAxis->axis)]) |
Definition at line 157 of file pmacAsynCoord.c.
#define NAXES 9 |
Definition at line 156 of file pmacAsynCoord.c.
#define READBACK "Q8%d" |
Definition at line 162 of file pmacAsynCoord.c.
#define TRACE_DRIVER motorAxisTraceIODriver |
Definition at line 149 of file pmacAsynCoord.c.
#define TRACE_ERROR motorAxisTraceError |
Definition at line 150 of file pmacAsynCoord.c.
#define TRACE_FLOW motorAxisTraceFlow |
Definition at line 148 of file pmacAsynCoord.c.
typedef struct motorAxisHandle motorAxis |
typedef struct drvPmac* PMACDRV_ID |
Definition at line 104 of file pmacAsynCoord.c.
int asynMatch | ( | asynUser * | pasynUser, | |
char * | checkport, | |||
int | checkaddr | |||
) |
Test if a connected pasynUser matches a given port and address
Definition at line 738 of file pmacAsynCoord.c.
epicsExportAddress | ( | drvet | , | |
pmacAsynCoord | ||||
) |
int pmacAsynCoordCreate | ( | char * | port, | |
int | addr, | |||
int | cs, | |||
int | ref, | |||
int | program | |||
) |
Create a driver instance to communicate with a given coordinate system
port | The Asyn port used to communicate with the PMAC card | |
addr | The Asyn address of the PMAC (usually 0) | |
cs | The co-ordinate system to connect to | |
ref | A unique reference, used by the higher layer software to reference this C.S. | |
program | The PMAC program number to run to move the C.S. |
Definition at line 760 of file pmacAsynCoord.c.
int pmacSetCoordIdlePollPeriod | ( | int | ref, | |
int | idlePollPeriod | |||
) |
Function to set the idlePollPeriod time to use when polling the controller when there is no motion.
ref | Numerical ID of the coordinate system. | |
idlePollPeriod | The period in miliseconds. |
Definition at line 1013 of file pmacAsynCoord.c.
int pmacSetCoordMovingPollPeriod | ( | int | ref, | |
int | movingPollPeriod | |||
) |
Function to set the movingPollPeriod time to use when polling the controller during a move.
ref | Numerical ID of the coordinate system. | |
movingPollPeriod | The period in miliseconds. |
Definition at line 981 of file pmacAsynCoord.c.
int pmacSetCoordStepsPerUnit | ( | int | ref, | |
int | axis, | |||
double | stepsPerUnit | |||
) |
Function to set the step size per user unit for a coordinate system. This enables us to work in user units on the controller. Call this function at IOC shell optionally after pmacAsynCoordCreate(), and any call of pmacSetDefaultCoordSteps().
ref | The CS ref | |
axis | The axis number (0 based). | |
stepsPerUnit | Number of motor steps per real user unit |
Definition at line 918 of file pmacAsynCoord.c.
int pmacSetDefaultCoordSteps | ( | double | defaultSteps | ) |
Function to set default axis scaling factor on all coordinate systems and axes. Call this optionally after calling all the pmacAsynCoordCreate() functions.
defaultSteps |
Definition at line 876 of file pmacAsynCoord.c.
const char axisName[] = {' ', 'A','B','C','U','V','W','X','Y','Z'} |
Definition at line 140 of file pmacAsynCoord.c.
motorAxisDrvSET_t pmacAsynCoord |
{ 15, motorAxisReport, motorAxisInit, motorAxisSetLog, motorAxisOpen, motorAxisClose, motorAxisSetCallback, motorAxisSetDouble, motorAxisSetInteger, motorAxisGetDouble, motorAxisGetInteger, motorAxisHome, motorAxisMove, motorAxisVelocityMove, motorAxisStop, motorAxisforceCallback, }
Definition at line 83 of file pmacAsynCoord.c.