- added general binary scriptcontext protocoll

- improved some drivers
This commit is contained in:
zolliker
2010-09-02 11:41:31 +00:00
parent 1e9f9d408c
commit bc2c9e5a3e
10 changed files with 528 additions and 27 deletions

View File

@ -33,19 +33,19 @@ Markus Zolliker, July 2006
#define PID_FLAG 1
#define RDGRNG_FLAG 2
#define HTRRNG_FLAG 3
#define MAX_CHAN 3
#define MAX_CHAN 4
typedef struct {
EaseDriv d;
float t;
float htr;
float set;
float res;
float prop;
float integ;
float deriv;
float resist; /* Ohm */
float temp[MAX_CHAN];
float res[MAX_CHAN];
int channel[MAX_CHAN];
int ighHeater; /* IGH heater range (-1 if output is direct) */
int htrRange;
@ -116,13 +116,18 @@ static void Lsc370ParDef(void *object)
};
static char *offOn[] = { "off", "on", NULL };
static char *tNames[] = { "tsample", "tstill", "tmix" };
static char *cNames[] = { "csample", "cstill", "cmix" };
static char *tNames[] = { "tsample", "tstill", "tmix", "tplate" };
static char *rNames[] = { "rsample", "rstill", "rmix", "rplate" };
static char *cNames[] = { "csample", "cstill", "cmix", "cplate" };
ParName("");
ParTail("K");
ParFloat(&drv->temp[0], PAR_NAN);
ParName("res");
ParTail("Ohm");
ParFloat(&drv->res[0], PAR_NAN);
ParName("set");
ParTail("K");
if (EaseUpdate(EASE_RUN)) {
@ -140,16 +145,16 @@ static void Lsc370ParDef(void *object)
ParName(tNames[i]);
ParTail("K");
ParFloat(&drv->temp[i], PAR_NAN);
ParName(rNames[i]);
ParTail("Ohm");
ParFloat(&drv->res[i], PAR_NAN);
}
ParName(cNames[i]);
ParAccess(usUser);
ParInt(&drv->channel[i], 0);
}
ParName("res");
ParTail("Ohm");
ParFloat(&drv->res, PAR_NAN);
ParName("prop");
ParTail("(gain)");
EaseUpdate(PID_FLAG);
@ -270,6 +275,10 @@ static void Lsc370ParDef(void *object)
EaseDrivPar(drv, "%.5g", "K");
ParStdDef();
EaseMsgPar(drv);
ParName("period");
ParAccess(usUser);
ParInt(&drv->d.b.p.period, 5);
}
/*----------------------------------------------------------------------------*/
@ -292,26 +301,28 @@ static long Lsc370Read(long pc, void *object)
drv->temp[drv->index] = PAR_NAN;
goto noRead;
}
snprintf(buf, sizeof buf, "RDGK?%d", drv->channel[drv->index]);
EaseWrite(eab, buf);
return __LINE__;
case __LINE__: /**********************************/
if (1 == sscanf(eab->ans, "%f", &x)) {
drv->temp[drv->index] = x;
}
snprintf(buf, sizeof buf, "RDGR?%d", drv->channel[drv->index]);
EaseWrite(eab, buf);
return __LINE__;
case __LINE__: /**********************************/
if (1 == sscanf(eab->ans, "%f", &x)) {
drv->res[drv->index] = x;
}
noRead:
drv->index++;
if (drv->index < MAX_CHAN)
goto chanLoop;
EaseWrite(eab, "RDGR?1");
return __LINE__;
case __LINE__: /**********************************/
if (1 == sscanf(eab->ans, "%f", &x)) {
drv->res = x;
}
EaseWrite(eab, "HTR?");
return __LINE__;
case __LINE__: /**********************************/