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: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice
From: 高振华 via Tech-talk <tech-talk at aps.anl.gov>
To: "Mark Rivers" <rivers at cars.uchicago.edu>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 8 Jan 2026 10:09:46 +0800 (GMT+08:00)

Hi Mark,


Does this Modbus driver use the CRC-16/Modbus check method?


How to set whether CRC uses big-endian or little-endian?


Does this driver only support CRC-16/Modbus check?


If other CRC check methods need to be used, how to set it? (For example: CRC-16/IBM) 


Is there an example of a Modbus RTU IOC with this Modbus driver? 


The parameters of CRC-16/Modbus required for the device I am communicating with are: 


POLY(HEX): 8005


INIT(HEX): FFFF


XOROUT(HEX): 0000



Thanks,


Gao zhenhua





-----原始邮件-----
发件人: "Mark Rivers" <rivers at cars.uchicago.edu>
发送时间: 2026-01-07 20:38:29 (星期三)
收件人: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, 高振华 <gaozh at ihep.ac.cn>
主题: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice

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







      
祝好!
高振华

电话:010-88235426
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 Mark Rivers via Tech-talk
References:
The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice 高振华 via Tech-talk
Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice Mark Rivers via Tech-talk

Navigate by Date:
Prev: Device Support for Tektronix MSO oscilloscope Sukhanov, Andrei via Tech-talk
Next: Re: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice Mark Rivers 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: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice Mark Rivers via Tech-talk
Next: Re: Re: The problem of converting floating-point numbers to 4-byte format (in CDAB order) under StreamDevice Mark Rivers 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 ·