EPICS Controls 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  2019  2020  2021  2022  2023  2024  <2025 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  2020  2021  2022  2023  2024  <2025
<== Date ==> <== Thread ==>

Subject: Parse Hex into signed number with streamdevice?
From: "Blomley, Edmund \(IBPT\) via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 15 Sep 2025 08:04:44 +0000

Hey,

 

So my device sends me a 4 bit hex which I convert to a float using an ai record and linear conversion with ESLO.

Let’s ignore the conversion for now, the number needs to be treated as a signed long, so I need to get the 2’s complement:

 

07D0 -> 2000

F6F5 -> -2315

 

Is there a way to do this directly with streamdevice?

If not, I would need to read in the raw long and convert it myself. What is the best approach to do the conversion with records?

So far I would do:

 

field(CALC, "65535 - A + 1") with A being the raw long.

Cheers
eddy

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Replies:
Re: Parse Hex into signed number with streamdevice? Zimoch, Dirk via Tech-talk

Navigate by Date:
Prev: R: modbus instruments don't provide the correct connection status using asyn check Antonio Moschini via Tech-talk
Next: Re: Parse Hex into signed number with streamdevice? Zimoch, Dirk 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  2020  2021  2022  2023  2024  <2025
Navigate by Thread:
Prev: R: modbus instruments don't provide the correct connection status using asyn check Antonio Moschini via Tech-talk
Next: Re: Parse Hex into signed number with streamdevice? Zimoch, Dirk 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  2020  2021  2022  2023  2024  <2025
ANJ, 15 Sep 2025 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·