Commit a1969d6e authored by kpetersn's avatar kpetersn
Browse files

Added a temperature_RBV PV. Processing the record causes the driver to read...

Added a temperature_RBV PV. Processing the record causes the driver to read the temperature, but the PV doesn't update, for some unknown reason.
parent b153f796
record (ai, "$(P)$(T):temperature_RBV")
{
field(DTYP, "asynInt32")
#!field(INP, "@asyn($(PORT),0)TEMPERATURE_IN_VALUE")
field(INP, "@asyn($(PORT))TEMPERATURE_IN_VALUE")
field(LINR, "NO CONVERSION")
field(HOPR, "2000.0")
field(LOPR, "-300.0")
field(PREC, "3")
field(SCAN, "Passive")
}
......@@ -10,7 +10,7 @@ include $(TOP)/configure/CONFIG
#----------------------------------------------------
# Create and install (or just install) into <top>/db
# databases, templates, substitutions like this
#DB += xxx.db
DB += Linkam_T96.db
#----------------------------------------------------
# If <anyname>.db template is not named <anyname>*.template add
......
......@@ -12,7 +12,7 @@ using namespace std;
Linkam::Linkam(const char *portName) : asynPortDriver(portName, MAX_CONTROLLERS,
asynInt32Mask | asynFloat64Mask | asynDrvUserMask,
asynInt32Mask | asynFloat64Mask,
ASYN_MULTIDEVICE, 1, /* ASYN_CANBLOCK=0, ASYN_MULTIDEVICE=1, autoConnect=1 */
ASYN_MULTIDEVICE | ASYN_CANBLOCK, 1, /* ASYN_CANBLOCK=0, ASYN_MULTIDEVICE=1, autoConnect=1 */
0, 0) /* Default priority and stack size */
{
static const char *functionName = "Linkam";
......@@ -36,22 +36,62 @@ Linkam::Linkam(const char *portName) : asynPortDriver(portName, MAX_CONTROLLERS,
// Start poller? For now just initialize the temperature
// Wrapped call to LinkamCommDll.Comms.GetValue(). Index 0 is temperature.
// See Linkam.SharedEnums.eVALUETYPE page for full listing.
temperatureRbv_ = GetValue(0);
printf("Stage temperature:%f °C\n", temperatureRbv_);
//temperatureRbv_ = GetValue(0);
//printf("Stage temperature:%f °C\n", temperatureRbv_);
// Initialize the temperature param to something other than the default (25.0)
setDoubleParam(temperatureInValue_, 21.3);
callParamCallbacks();
// Disconnect
//OpenComms(false, 0, 0);
}
asynStatus Linkam::readInt32(asynUser *pasynUser, epicsInt32 *value)
{
int function = pasynUser->reason;
asynStatus status;
static const char *functionName = "readInt32";
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, function = %d\n",
driverName, functionName, this->portName, *value);
if (function == temperatureInValue_) {
status = readTemperature();
} else {
status = asynPortDriver::readInt32(pasynUser,value);
}
//callParamCallbacks();
callParamCallbacks(0);
return (status==0) ? asynSuccess : asynError;
}
asynStatus Linkam::readTemperature()
{
static const char *functionName = "readTemperature";
temperatureRbv_ = GetValue(0);
setDoubleParam(temperatureInValue_, temperatureRbv_);
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, temperature = %lf\n",
driverName, functionName, this->portName, temperatureRbv_);
return asynSuccess;
}
extern "C" int LinkamConfig(const char *portName)
{
new Linkam(portName);
Linkam *pLinkam = new Linkam(portName);
pLinkam = NULL; /* This is just to avoid compiler warnings */
return(asynSuccess);
}
static const iocshArg linkamArg0 = { "Port name", iocshArgString};
static const iocshArg * const linkamArgs[1] = {&linkamArg0};
static const iocshFuncDef linkamFuncDef = {"LinkamConfig", 0, linkamArgs};
static const iocshFuncDef linkamFuncDef = {"LinkamConfig", 1, linkamArgs};
static void linkamCallFunc(const iocshArgBuf *args)
{
LinkamConfig(args[0].sval);
......
......@@ -22,7 +22,7 @@ public:
Linkam(const char *portName);
/* These are the methods that we override from asynPortDriver */
virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value);
protected:
int temperatureInValue_;
......@@ -30,6 +30,8 @@ protected:
#define LAST_LINKAM_PARAM temperatureInValue_;
private:
asynStatus readTemperature();
float temperatureRbv_;
char* wrapperVersion_;
char* libraryVersion_;
......
......@@ -5,6 +5,8 @@
< envPaths
epicsEnvSet("PORT", "linkam1")
cd "${TOP}"
## Register all support components
......@@ -14,9 +16,13 @@ linkam_registerRecordDeviceDriver pdbbase
## Load record instances
#dbLoadRecords("db/xxx.db","user=kpetersnHost")
#
dbLoadRecords("$(LINKAM)/db/Linkam_T96.db", "P=kmp:,T=tc1,PORT=$(PORT)")
dbLoadRecords("$(ASYN)/db/asynRecord.db", "P=kmp:,R=asyn,PORT=$(PORT),ADDR=0,OMAX=255,IMAX=255")
## Run Linkam C# code
cd "${TOP}/bin/${ARCH}"
LinkamConfig("linkam1")
LinkamConfig("$(PORT)")
cd "${TOP}/iocBoot/${IOC}"
iocInit
......
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