EPICS Home

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  2019  <20202021  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  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: StreamDevice and negative hex values
From: Mark Davis via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 16 Apr 2020 14:26:47 -0400
I have a question about conversion of hex input strings in StreamDevice.

If I have in statements in StreamDevice protocols that, when reading the input strings "FFFF" and "8000" using the string "%4X" conversion, results in the value 65535 and 32768 (at least when using a longin record).  Given that the end result IS a long integer, this makes some sense.

However, from the point of view of the device that produces these strings, they are 2-byte signed values, so they represent the values -1 and -32678.

Is there some way to get StreamDevice to interpret these as negative values?

I see that later versions of the StreamDevice doco includes this statement regarding the Standard LONG Converters:

    "With the - negative octal and hexadecimal values are accepted."

But what does that mean?  I tried changing the protocol to -4X rather than 4X but it made no difference.

How would the '-' option be used, and under what circumstances would it result in a negative long integer value that (without the "-" prefix) would have been a positive value?

NOTE:  For now I am just using a calc record to handle the 2-byte 2's complement format used by the device.

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

Navigate by Date:
Prev: Alarm Reports (JSP web package) John Dobbins via Tech-talk
Next: How to use SRQ from device in StreamDevice. Noboru Yamamoto 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  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Alarm Reports (JSP web package) John Dobbins via Tech-talk
Next: How to use SRQ from device in StreamDevice. Noboru Yamamoto 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  2019  <20202021  2022  2023  2024