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  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: Re: Parse Hex into signed number with streamdevice?
From: "Zimoch, Dirk 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:28:07 +0000
Hello Eddy

Signed %x input is currently not supported by StreamDevice but it is definitely
useful to have. I have to think how to implement it and which flag to use to
signal the switch from normal unsigned %x.

Dirk

On Mon, 2025-09-15 at 08:04 +0000, Blomley, Edmund (IBPT) via Tech-talk wrote:
> 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
>  

Replies:
Re: Parse Hex into signed number with streamdevice? Zimoch, Dirk via Tech-talk
References:
Parse Hex into signed number with streamdevice? Blomley, Edmund (IBPT) via Tech-talk

Navigate by Date:
Prev: Parse Hex into signed number with streamdevice? Blomley, Edmund (IBPT) 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: Parse Hex into signed number with streamdevice? Blomley, Edmund (IBPT) 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