Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: [Fwd: Re: Stream Device parsing strings]
From: Dirk Zimoch <dirk.zimoch@psi.ch>
To: EPICS <tech-talk@aps.anl.gov>
Date: Thu, 12 Apr 2012 14:25:40 +0200
I forgot to send this reply to tech-talk...
--- Begin Message ---
Subject: Re: Stream Device parsing strings
From: Dirk Zimoch <dirk.zimoch@psi.ch>
To: Rod Nussbaumer <bomr@triumf.ca>
Date: Thu, 12 Apr 2012 11:24:27 +0200
Hi Rod,

Separator is ONLY used when reading arrays (e.g. waveform record). It cannot be used for breaking up the input into several different records.

The problem here is the %s. As in scanf, %s reads up to the next whitespace, which is not what you want.

I suggest to use %[^;] instead to read up to the next ; (or end of string) and include whitespace.

Thus your format would look like this:

in "%(\$1PARAM01.VAL)[^;];"
   "%(\$1PARAM02.VAL)[^;];"
   "%(\$1PARAM03.VAL)[^;];"
   "%(\$1PARAM04.VAL)[^;];"
   "%(\$1PARAM05.VAL)[^;];"
   "%(\$1PARAM06.VAL)[^;];"
   "%(\$1PARAM07.VAL)[^;]";

BTW, in the current version of StreamDevice you don't need the .VAL any more.

Dirk

Rod Nussbaumer wrote:
Hi all.

I am trying to get streamDevice to break an input string that has fields delimited with semi-colons into discrete strings. The input string as read by asyn + GPIB looks something like

BIN;RI;MSB;4;32;500;Y;100.00000000000E-12;20.90000000000E-9;"s";0.05000000000;5.00000000000E-9;21.00000000000E-9;0.00500000000;232.83064365387E-12;0.0000;"V";"C2, 50.00mV/div, 5.000ns/div,500 points, Sample mode";"C2"

My stream device protocol looks like:


WFMPRE {
    ReplyTimeout = 200;
    ReadTimeout = 50;
    InTerminator = LF;
    Separator = ";";
    out "VERBOSE ON";
    out "WFMO?";
in "%(\$1PARAM01.VAL)s%(\$1PARAM02.VAL)s%(\$1PARAM03.VAL)s%(\$1PARAM04.VAL)s%(\$1PARAM05.VAL)s%(\$1PARAM06.VAL)s%(\$1PARAM07.VAL)s";
    out "VERBOSE OFF";
}

where the records referred to by $1PARAMxx.VAL are stringout records with SoftChannel DTYP. Each successive conversion ends at either the 39th converted character, or the first whitespace. It seems to be completely ignoring the specified separator. Is this correct behavior? If so, any suggestions for accomplishing what I want (ability to access the string fields as records or as string elements of a waveform record. I intend to add more field conversions to complete the string parsing, if/when I get this much working.

The data in question comes from a Tektronix scope, and contains the data need to convert a generically scaled waveform array into an array scaled to engineering units.

Thanks.

Rod Nussbaumer
ISAC Controls, TRIUMF
Vancouver, Canada.






--- End Message ---

Navigate by Date:
Prev: Announce: sequencer release 2.1.6 Benjamin Franksen
Next: RE: DCT flag in record reference manual Abadie Lana
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Announce: sequencer release 2.1.6 Benjamin Franksen
Next: RTEMS driver for SIS3820 scaler Kate Feng
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·