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  2018  <20192020  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  <20192020 
<== Date ==> <== Thread ==>

Subject: RE: StreamDevice for an odd float format
From: "Brown, Garth via Tech-talk" <tech-talk@aps.anl.gov>
To: "Priller, John" <priller@frib.msu.edu>, "Davis, Mark" <davism50@msu.edu>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Mon, 17 Jun 2019 21:21:28 +0000

I’ve used John Priller’s code, and it’s working. The %ZHF format converter exactly matches what I was trying to convert. Thanks! I can clearly see by looking at this code how I could add other custom format converters in the future.

I made one change in the debug output. On line 632 at the top of “FRIBConverter::parse”, I was getting segfaults when it tried to print the string fmt.info. I think it was uninitialized at that point. So I removed it from the printf statement.

 

Garth

 

From: Priller, John <priller@frib.msu.edu>
Sent: Wednesday, June 5, 2019 2:06 PM
To: Davis, Mark <davism50@msu.edu>; tech-talk@aps.anl.gov; Brown, Garth <gwbrown@slac.stanford.edu>
Subject: Re: StreamDevice for an odd float format

 

Z is just the letter I selected when I wrote my protocol converter add-on.  There's a couple issues doing it this way but it seemed the best way forward for us at the time.

 

One, the interface to Stream is unofficial and can (and does) change from version to version.

 

Two, several necessary header files aren't exported as part of the package.  We have a lightly-patched version of Stream we link against that does export those files


From: tech-talk-bounces@aps.anl.gov <tech-talk-bounces@aps.anl.gov> on behalf of Davis, Mark via Tech-talk <tech-talk@aps.anl.gov>
Sent: Wednesday, June 5, 2019 4:01 PM
To: Brown, Garth; tech-talk@aps.anl.gov
Subject: Re: StreamDevice for an odd float format

 

You can add your own format converters to StreamDevice.

John Priller (prioller@frib.msu.edu) at our lab has written the code for several odd format like this (see attached code).  I believe the one you want is the %ZHF one.

Mark


Mark Davis NSCL/FRIB Control Systems Software Engineer davism50@msu.edu

On 6/5/2019 1:58 PM, Brown, Garth via Tech-talk wrote:

Hi All,

I'm trying to use StreamDevice to talk to a device that is almost, but not quite, giving me data that the format converters (as I understand them) can convert.

It’s an ASCII representation of the IEEE 32 bit floating point format, e.g. the raw data for a value of 28.0 is

 

0x34 0x31 0x45 0x30 0x30 0x30 0x30 0x30

 

Which is the ASCII code for

 

41E00000

 

Which is the IEEE-754 floating point representation of 28.0.

I think that if the raw data were 0x41E00000, %R would be able to convert it. And if the raw data were

0x32 0x38 0x2E 0x30 (ASCII for 28.0)

then %f would be able to convert it.

Before I start writing calc records to convert the 32 bits to a float value, I figured I'd ask if someone had a less brute-force approach. Maybe a StreamDevice format converter trick I don't know about?

 

Thanks,

Garth

 


References:
StreamDevice for an odd float format Brown, Garth via Tech-talk
Re: StreamDevice for an odd float format Priller, John via Tech-talk

Navigate by Date:
Prev: Re: PVA Client in python Siniša Veseli via Tech-talk
Next: Re: PVA Client in python Florian Feldbauer via Tech-talk
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  <20192020 
Navigate by Thread:
Prev: Re: StreamDevice for an odd float format Ralph Lange via Tech-talk
Next: RELEASE file Florian Feldbauer via Tech-talk
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  <20192020 
ANJ, 18 Jun 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·