1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 <2015> 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 <2015> 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | calling the output of one record into another record |
From: | Ana Malagon <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Wed, 14 Jan 2015 11:32:10 -0800 |
/* Param 18 -- Read S21 Format: (Re,Im) dB */
{&DSET_WF, GPIBREAD, IB_Q_HIGH, ":CALC1:PAR1:DEF S21;:CALC1:PAR1:SEL;:CALC1\
:SEL:DATA:SDAT?", NULL, 0, 1E6, readWF, 0, 0, NULL, NULL, NULL}
and here is the query of the points:
/* Param 21 - Get Points in Sweep */
{&DSET_AI, GPIBREAD, IB_Q_HIGH, ":SENS1:SWE:POIN?", NULL, 0, 100, readData, 0, 0, N\
ULL, NULL, NULL},
where the conversion function readWF is defined as:
static int readWF(struct gpibDpvt *pdpvt,int P1, int P2, char**P3) {
struct waveformRecord *pwf=(struct waveformRecord *)pdpvt->precord;
asynUser *pasynUser = pdpvt->pasynUser;
double* value = (double *)pwf->bptr;
const char* cpymsg = pdpvt->msg;
double data;
int n;
pwf->nord=0;
while ((pwf->nord < pwf->nelm) && sscanf(cpymsg,"%lE,%n",&data,&n)==1) {
if (P1==1) data/=1E6;
if (P1==2 && (pwf->nord==0 || pwf->nord==1)) data/=1E6;
memcpy(value+pwf->nord,&data,sizeof(double));
pwf->nord++;
cpymsg+=n;
asynPrint(pasynUser,ASYN_TRACE_FLOW,"(NORD,VAL) : (%i,%E)\n",pwf->nord,data); \
}
if (pwf->nord == 0) return -1;
pwf->udf = 0;
return 0;
}
the readData conversion function is:
static int readData(struct gpibDpvt *pdpvt,int P1, int P2, char**P3) {
struct aiRecord *pai=(struct aiRecord *)pdpvt->precord;
printf("got: %s\n",pdpvt->msg);
double meas =(double)atof(pdpvt->msg);
pai->val = meas;
pai->udf = 0;
return 0;
}
and the database definition entry for the read measurement comand is below, where NELM was defined to be 2x the maximum number of points one can request in a measurement:
record(waveform, "$(P):S21")
{
field(DESC, "S21 (Re,Im)")
field(EGU,"dB")
field(SCAN, "Passive")
field(NELM, "20002")
field(DTYP, "fieldfox")
field(FTVL, "DOUBLE")
field(INP, "#L$(L) A$(A) @18")
field(FLNK, "$(P):FREQ")
field(DISV, "0")
field(SDIS, "$(P):OPC.VAL PP")
}
The reason I need to cut off the values is because the current syntax in the read measurement command not only returns the measurement data but also the x-axis values, which I don't want.
Sorry again for the very basic question, and thanks!
Ana Malagon