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  <2026 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  <2026
<== Date ==> <== Thread ==>

Subject: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, 高振华 <gaozh at ihep.ac.cn>
Date: Wed, 7 Jan 2026 12:38:29 +0000
Hi Gao,

For this type of Modbus communication you might want to use the EPICS Modbus driver rather than StreamDevice.  It will do those conversions for you.  It is also much simpler and more efficient if you want to read or write a number of bits or registers in a single I/O operation.


Mark


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of 高振华 via Tech-talk <tech-talk at aps.anl.gov>
Sent: Wednesday, January 7, 2026 3:53 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice
 


Hi all,




I am conducting Modbus RTU communication with a device and need to convert a 32-bit floating-point number into 4 bytes of hexadecimal data and then send it to the device.


For example: 3.15 converted to 4 bytes is 40 49 99 9A (in hexadecimal, big-endian order, ABCD order).


Using StreamDevice, how should I convert to the CDAB order? (For example, the CDAB order corresponding to 3.15 is 99 9A 40 49).


Does StreamDevice have a corresponding conversion symbol?





Best regards,



Gao Zhenhua




BSRF


Email:gaozh at ihep.ac.cn




Replies:
Re: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice 高振华 via Tech-talk
References:
The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice 高振华 via Tech-talk

Navigate by Date:
Prev: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice 高振华 via Tech-talk
Next: Gatan K3 Camera EPICS Support? Foster, Andrew (OBS,RAL,TEC) 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  <2026
Navigate by Thread:
Prev: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice 高振华 via Tech-talk
Next: Re: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice 高振华 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  <2026
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·