Commit 4da35889 authored by kpetersn's avatar kpetersn
Browse files

Added vacuum controls

parent f0d456d0
......@@ -119,6 +119,51 @@ record(ai, "$(P)$(T):lnpSpeed_RBV")
field(SCAN, "Passive")
}
record(bo, "$(P)$(T):vacuum")
{
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),$(ADDR))VACUUM_OUT_VALUE")
field(PINI, "YES")
field(ZNAM, "Off")
field(ONAM, "On")
field(VAL, 0)
}
record(ao, "$(P)$(T):vacuumLimit")
{
field(DTYP, "asynFloat64")
field(OUT, "@asyn($(PORT),$(ADDR))VACUUM_LIMIT_OUT_VALUE")
field(PINI, "YES")
field(LINR, "NO CONVERSION")
field(PREC, "4")
field(EGU, "mBar")
field(SCAN, "Passive")
field(VAL, "1013.25")
field(FLNK, "$(P)$(T):vacuumLimit_RBV")
}
record(ai, "$(P)$(T):vacuumLimit_RBV")
{
field(DTYP, "asynFloat64")
field(INP, "@asyn($(PORT),$(ADDR))VACUUM_LIMIT_IN_VALUE")
field(PINI, "YES")
field(LINR, "NO CONVERSION")
field(PREC, "4")
field(EGU, "mBar")
field(SCAN, "Passive")
}
record(ai, "$(P)$(T):pressure_RBV")
{
field(DTYP, "asynFloat64")
field(INP, "@asyn($(PORT),$(ADDR))PRESSURE_IN_VALUE")
field(PINI, "YES")
field(LINR, "NO CONVERSION")
field(PREC, "4")
field(EGU, "mBar")
field(SCAN, "Passive")
}
record(longin, "$(P)$(T):controllerConfig_RBV")
{
field(DTYP, "asynInt32")
......
......@@ -3,6 +3,9 @@ $(P)$(T):rampRate
$(P)$(T):heating
$(P)$(T):lnpMode
$(P)$(T):lnpSpeed
$(P)$(T):vacuum
$(P)$(T):vacuumLimit
$(P)$(T):temperature_RBV.SCAN
$(P)$(T):heaterPower_RBV.SCAN
$(P)$(T):lnpSpeed_RBV.SCAN
$(P)$(T):pressure_RBV.SCAN
......@@ -26,6 +26,7 @@ Linkam::Linkam(const char *portName, const epicsUInt32 commType, const epicsUInt
commType_ = commType;
commPort_ = commPort;
//
createParam(temperatureInValueString, asynParamFloat64, &temperatureInValue_);
createParam(rampLimitOutValueString, asynParamFloat64, &rampLimitOutValue_);
createParam(rampLimitInValueString, asynParamFloat64, &rampLimitInValue_);
......@@ -33,13 +34,20 @@ Linkam::Linkam(const char *portName, const epicsUInt32 commType, const epicsUInt
createParam(rampRateInValueString, asynParamFloat64, &rampRateInValue_);
createParam(heaterPowerInValueString, asynParamFloat64, &heaterPowerInValue_);
createParam(heatingOutValueString, asynParamInt32, &heatingOutValue_);
//
createParam(lnpModeOutValueString, asynParamInt32, &lnpModeOutValue_);
createParam(lnpSpeedOutValueString, asynParamInt32, &lnpSpeedOutValue_);
createParam(lnpSpeedInValueString, asynParamFloat64, &lnpSpeedInValue_);
createParam(controllerConfigInValueString, asynParamInt32, &controllerConfigInValue_);
//
createParam(vacuumOutValueString, asynParamInt32, &vacuumOutValue_);
createParam(vacuumLimitOutValueString, asynParamFloat64, &vacuumLimitOutValue_);
createParam(vacuumLimitInValueString, asynParamFloat64, &vacuumLimitInValue_);
createParam(pressureInValueString, asynParamFloat64, &pressureInValue_);
//
createParam(controllerConfigInValueString, asynParamInt32, &controllerConfigInValue_);
createParam(controllerErrorInValueString, asynParamInt32, &controllerErrorInValue_);
createParam(controllerStatusInValueString, asynParamInt32, &controllerStatusInValue_);
createParam(stageConfigInValueString, asynParamInt32, &stageConfigInValue_);
createParam(controllerStatusInValueString, asynParamInt32, &controllerStatusInValue_);
createParam(stageConfigInValueString, asynParamInt32, &stageConfigInValue_);
// Must be in the directory with the DLL when this line is executed
//LoadMonoLibrary("LinkamCommsDll.dll");
......@@ -181,6 +189,16 @@ asynStatus Linkam::readFloat64(asynUser *pasynUser, epicsFloat64 *value)
// Read the LN Pump speed from the controller (0-100%)
status = readLnpSpeed(value);
} else if (function == vacuumLimitInValue_) {
// Read the vacuum limit from the controller (mBar)
status = readVacuumLimit(value);
} else if (function == pressureInValue_) {
// Read the vacuum pressure from the controller (mBar)
status = readPressure(value);
} else {
status = asynPortDriver::readFloat64(pasynUser,value);
}
......@@ -271,6 +289,36 @@ asynStatus Linkam::readLnpSpeed(epicsFloat64 *value)
return asynSuccess;
}
asynStatus Linkam::readVacuumLimit(epicsFloat64 *value)
{
static const char *functionName = "readVacuumLimit";
this->lock();
*value = GetValue(u32VacuumLimitRW);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n",
driverName, functionName, this->portName, *value);
return asynSuccess;
}
asynStatus Linkam::readPressure(epicsFloat64 *value)
{
static const char *functionName = "readPressure";
this->lock();
*value = GetValue(u32VacuumR);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n",
driverName, functionName, this->portName, *value);
return asynSuccess;
}
asynStatus Linkam::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
{
......@@ -287,14 +335,19 @@ asynStatus Linkam::writeFloat64(asynUser *pasynUser, epicsFloat64 value)
if (function == rampLimitOutValue_) {
// Read the temperature from the controller
// set the desired temperature
status = setRampLimit(value);
} else if (function == rampRateOutValue_) {
// Read the temperature from the controller
// set the desired ramp rate
status = setRampRate(value);
} else if (function == vacuumLimitOutValue_) {
// set the desired pressure
status = setVacuumLimit(value);
} else {
status = asynPortDriver::writeFloat64(pasynUser,value);
}
......@@ -326,8 +379,7 @@ asynStatus Linkam::setRampLimit(epicsFloat64 value)
* Returns true if set successfully, false otherwise.
*/
this->lock();
//status = SetValue(u32Heater1LimitRW, (float) value);
status = SetValue(2, (float) value);
status = SetValue(u32Heater1LimitRW, (float) value);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
......@@ -343,8 +395,48 @@ asynStatus Linkam::setRampRate(epicsFloat64 value)
static const char *functionName = "setRampRate";
this->lock();
//status = SetValue(u32Heater1RateRW, (float) value);
status = SetValue(1, (float) value);
status = SetValue(u32Heater1RateRW, (float) value);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n",
driverName, functionName, this->portName, value);
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::setVacuumLimit(epicsFloat64 value)
{
bool status;
static const char *functionName = "setVacuumLimit";
this->lock();
if (controllerVacuumReady_)
{
if (stageVacuum_)
{
// Vacuum control is supported and ready
status = SetValue(u32VacuumLimitRW, (float) value);
}
else
{
status = false;
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting vacuum limit: stageVacuum_ = %d\n",
driverName, functionName, this->portName, stageVacuum_);
}
}
else
{
status = false;
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting vacuum limit: controllerVacuumReady_ = %d\n",
driverName, functionName, this->portName, controllerVacuumReady_);
}
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
......@@ -383,7 +475,13 @@ asynStatus Linkam::writeInt32(asynUser *pasynUser, epicsInt32 value)
// Set LN pump speed (0-100%)
status = setLnpSpeed(value);
} else if (function == vacuumOutValue_) {
// Set vacuum on/off
status = setVacuum(value);
}
callParamCallbacks();
if (status == 0) {
......@@ -510,6 +608,48 @@ asynStatus Linkam::setLnpSpeed(epicsInt32 value)
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::setVacuum(epicsInt32 value)
{
bool status;
static const char *functionName = "setVacuum";
this->lock();
// Off = 0 = false ; On = 1 = true
if (controllerVacuumReady_)
{
if (stageVacuum_)
{
// Vacuum control is supported and ready
status = StartVacuum((value) ? true : false);
}
else
{
status = false;
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting vacuum: stageVacuum_ = %d\n",
driverName, functionName, this->portName, stageVacuum_);
}
}
else
{
status = false;
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s, port %s, ERROR setting vacuum: controllerVacuumReady_ = %d\n",
driverName, functionName, this->portName, controllerVacuumReady_);
}
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %d\n",
driverName, functionName, this->portName, value);
return (status) ? asynSuccess : asynError;
}
asynStatus Linkam::readInt32(asynUser *pasynUser, epicsInt32 *value)
{
......@@ -574,6 +714,11 @@ asynStatus Linkam::readControllerConfig()
else
controllerLnpReady_ = 0;
if (controllerConfig_ & ( (epicsUInt64)1 << (int)u64VacuumReady ) )
controllerVacuumReady_ = 1;
else
controllerVacuumReady_ = 0;
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
......@@ -631,6 +776,11 @@ asynStatus Linkam::readStageConfig()
else
stageLnpAuto_ = 0;
if (stageConfig_ & ( (epicsUInt64)1 << (int)u64SupportsVacuum ) )
stageVacuum_ = 1;
else
stageVacuum_ = 0;
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, stageConfig_ = %llx, stageLnpManual_ = %d, stageLnpAuto_ = %d\n",
driverName, functionName, this->portName, this->stageConfig_, stageLnpManual_, stageLnpAuto_);
......@@ -647,11 +797,13 @@ void Linkam::report(FILE *fp, int details)
{
fprintf(fp, " controller config = %llx\n", controllerConfig_);
fprintf(fp, "\tLNP Ready = %d\n", controllerLnpReady_);
fprintf(fp, "\tVac Ready = %d\n", controllerVacuumReady_);
fprintf(fp, " controller error = %lx\n", controllerError_);
fprintf(fp, " controller status = %llx\n", controllerStatus_);
fprintf(fp, " stage config = %llx\n", stageConfig_);
fprintf(fp, "\tLNP Manual = %d\n", stageLnpManual_);
fprintf(fp, "\tLNP Auto = %d\n", stageLnpAuto_);
fprintf(fp, "\tVacuum = %d\n", stageVacuum_);
}
fprintf(fp, "\n");
}
......
......@@ -16,6 +16,8 @@ static const char *driverName = "Linkam";
#define u32Heater1LimitRW 2
#define u32Heater1PowerR 3
#define u32Heater1LnpSpeedR 4
#define u32VacuumR 12
#define u32VacuumLimitRW 13
// eSTAGECONFIG Enumeration
#define u64StandardStage 0
......@@ -30,6 +32,7 @@ static const char *driverName = "Linkam";
// eCONTROLLERCONFIG Enumeration
#define u64SupportsHeater 0
#define u64VacuumReady 10
#define u64LnpReady 36
// eSTATUS Enumeration
......@@ -52,9 +55,16 @@ static const char *driverName = "Linkam";
#define rampRateInValueString "RAMP_RATE_IN_VALUE" /* asynFloat64 r/o */
#define heaterPowerInValueString "HEATER_POWER_IN_VALUE" /* asynFloat64 r/o */
#define heatingOutValueString "HEATING_OUT_VALUE" /* asynInt32 r/w */
//
#define lnpModeOutValueString "LNP_MODE_OUT_VALUE" /* asynInt32 r/w */
#define lnpSpeedOutValueString "LNP_SPEED_OUT_VALUE" /* asynInt32 r/w */
#define lnpSpeedInValueString "LNP_SPEED_IN_VALUE" /* asynFloat64 r/o */
//
#define vacuumOutValueString "VACUUM_OUT_VALUE" /* asynInt32 r/w */
#define vacuumLimitOutValueString "VACUUM_LIMIT_OUT_VALUE" /* asynFloat64 r/w */
#define vacuumLimitInValueString "VACUUM_LIMIT_IN_VALUE" /* asynFloat64 r/o */
#define pressureInValueString "PRESSURE_IN_VALUE" /* asynFloat64 r/o */
//
#define controllerConfigInValueString "CONTROLLER_CONFIG_IN_VALUE" /* asynInt32 r/o */
#define controllerErrorInValueString "CONTROLLER_ERROR_IN_VALUE" /* asynInt32 r/o */
#define controllerStatusInValueString "CONTROLLER_STATUS_IN_VALUE" /* asynInt32 r/o */
......@@ -87,6 +97,10 @@ protected:
int lnpModeOutValue_;
int lnpSpeedOutValue_;
int lnpSpeedInValue_;
int vacuumOutValue_;
int vacuumLimitOutValue_;
int vacuumLimitInValue_;
int pressureInValue_;
int controllerConfigInValue_;
int controllerErrorInValue_;
int controllerStatusInValue_;
......@@ -95,6 +109,7 @@ protected:
#define LAST_LINKAM_PARAM stageConfigInValue_;
private:
//
asynStatus readTemperature(epicsFloat64 *value);
asynStatus readRampLimit(epicsFloat64 *value);
asynStatus readRampRate(epicsFloat64 *value);
......@@ -102,9 +117,16 @@ private:
asynStatus setRampRate(epicsFloat64 value);
asynStatus readHeaterPower(epicsFloat64 *value);
asynStatus setHeating(epicsInt32 value);
//
asynStatus setLnpMode(epicsInt32 value);
asynStatus setLnpSpeed(epicsInt32 value);
asynStatus readLnpSpeed(epicsFloat64 *value);
//
asynStatus setVacuum(epicsInt32 value);
asynStatus setVacuumLimit(epicsFloat64 value);
asynStatus readVacuumLimit(epicsFloat64 *value);
asynStatus readPressure(epicsFloat64 *value);
//
asynStatus readControllerConfig();
asynStatus readControllerError();
asynStatus readControllerStatus();
......@@ -124,6 +146,9 @@ private:
short controllerLnpReady_;
short stageLnpAuto_;
short stageLnpManual_;
short controllerVacuumReady_;
short stageVacuum_;
};
#define NUM_PARAMS ((int)(&LAST_LINKAM_PARAM - &FIRST_LINKAM_PARAM + 1))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment