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  2012  2013  2014  2015  2016  <2017 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
<== Date ==> <== Thread ==>

Subject: Re: stream enum
From: Dirk Zimoch <dirk.zimoch@psi.ch>
To: <tech-talk@aps.anl.gov>
Date: Thu, 8 Jun 2017 12:48:46 +0200
Your conversion "\x02%*4s%c%*c%*c%*c%*c%*c%*c%*c%*c%*c%*s" lets me assume you want to read the character number 6 (after an initial 0x02 and a 4 byte string) as a number. But %c gives not a number but a string. To read one char as a number use %1d and a longin record.

in "\x02%*4s%1d%*c%*c%*c%*c%*c%*c%*c%*c%*c%*s";

Be aware that %*4s reads less than 4 chars if it finds a space or tab! Maybe that is not what you want. Try %*4c instead:

in "\x02%*4c%1d%*c%*c%*c%*c%*c%*c%*c%*c%*c%*s";

Dirk

On 05.06.2017 15:28, l123173 wrote:
Hi all,
   I met some little question about stream.
   After I sent command, I received a sequence of character through stream.
   The pv type was stringin and the value of the pv was 1(string) or
0(string).
   My question was that, I need the pv value was natural number( 0 or 1
), not string type.
   I have tried to change the stringin to ai, some error came out. Then
I think I could use the enum, but I could not know the usage though I tried.
   Could someone give some help.

Thanks,
Li xing

My db and proto file.
---------------------------------------------------------------
record(stringin, "$(P)$(R)STAT")
{
    field(DESC, "test")
    field(DTYP, "stream")
    field(INP,  "@devplc2.proto STAT $(PORT) $(A)")
}

STAT{
    out "\x0500FFBR2Y0000402F";
     in "\x02%*4s%c%*c%*c%*c%*c%*c%*c%*c%*c%*c%*s";
}





References:
stream enum l123173

Navigate by Date:
Prev: RE: makeBaseApp.pl Compilation error on Windows x64 freddie.akeroyd
Next: Re: makeBaseApp.pl Compilation error on Windows x64 Saeed Haghtalab
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
Navigate by Thread:
Prev: RE: stream enum Mark Rivers
Next: EDM X-Y Graph lot widget oddities Eric Norum
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
ANJ, 08 Jun 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·