Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: need help
From: Eric Norum <norume@aps.anl.gov>
To: btanu@veccal.ernet.in
Cc: TECHTALK Tech-Talk <tech-talk@aps.anl.gov>
Date: Fri, 2 Jun 2006 08:28:19 -0500
The value you want to convert is the first one returned? If so, then a simple "%lf" scanf format is all you need:

{&DSET_AI, GPIBREAD, IB_Q_LOW, "CONF:CURR""\r""READ?""\r", "%lf", 0,80,0,0,0,NULL,NULL,"\r"}

1) I increased the size of the message buffer from 20 to 80 -- the example you show below has more than 20 characters in the reply.
2) If you're using the ASYN version of devGpib you can specify the command/response terminators outside the command table entries. This often makes the command tables useable by both serial and GPIB controllers.



If you want to convert the second value in the reply string the scanf format string is a little more complicated.
"%[^,]*,%lf"
This looks a little complex, but isn't too bad if you consider each part separately:
%[^,]* -- Match any characters that are not a comma. Do not store the result.
, -- Match a comma
%lf -- convert the floating point value and store into a double.


On Jun 2, 2006, at 6:39 AM, btanu@veccal.ernet.in wrote:

Hi!

I am trying to communicate with Keithley 6485 pA to read the current.After sending the command it provides current value and some other value separated by comma.but i am only interested to store the current.
The response is like this:
-1.047791E-13A,+4.055828E+03,+0.000000E+00\r
How it can be done?
will i have to use any convert function?
i am attaching the code here
static struct gpibCmd gpibCmds[] = {
/* Param 0 */
{&DSET_AI,GPIBREAD,IB_Q_LOW,"CONF:CURR""\r""READ?""\r", 0,0,20,0,0,0,NULL,NULL,"\r"}
};
Thanks
tanushyam



-- Eric Norum <norume@aps.anl.gov> Advanced Photon Source Argonne National Laboratory (630) 252-4793



Replies:
Re: need help Eric Norum
References:
need help btanu

Navigate by Date:
Prev: RE: need help Dalesio, Leo `Bob`
Next: Re: need help Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: RE: Keithley 6485, was: Re: need help Walters, M (Malcolm)
Next: Re: need help Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·