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: MODBUS User-Defined Function Codes
From: William Jamieson via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Mon, 2 Feb 2026 12:54:14 -0500
Does anyone have experience using user-defined function codes alongside the standard function codes that can be handled by the asyn MODBUS driver? I am currently using the MODBUS driver for the standard 03 "READ HOLDING REGISTERS" function while simultaneously using streamDevice driver for executing user-defined functions. This is resulting in conflicts between the MODBUS and streamDevice driver. I have tried setting up two virtual ports pointing to the same serial port:
drvAsynSerialPortConfigure("rs485_modbus", "/dev/ttyUSB0", 0, 1, 0)
drvAsynSerialPortConfigure("rs485_stream", "/dev/ttyUSB0", 0, 1, 0)

Then using a SEQ record that disables the rs485_modbus port then enables the rs485_stream port before processing the stream record. after processing, it disables the rs485_stream port and re-enables the rs485_modbus port.

I disable and enable ports by writing a 0 (disable) or 1 (enable) to the CNCT field of an ASYN record for each port. Example record:
record (asyn, "modbusPort_ASYN")
{
    field (PORT, "rs485_modbus")
}

Not only does this switchover create a lot of I/O Error messages in the IOC shell, but this still results in a garbled data readback from the stream record.

Does anyone have a successful method of making these two methods work in parallel? (or some other tools that make it work) Or should I just give up and use deviceStream reads/writes instead of just the custom ones. I prefer to use the MODBUS driver if possible for the standard MODBUS function codes.

Thanks for any help!

William Jamieson
PPPL I&C Engineer



Replies:
Re: MODBUS User-Defined Function Codes Mark Rivers via Tech-talk
Re: MODBUS User-Defined Function Codes Torsten Bögershausen via Tech-talk

Navigate by Date:
Prev: Re: asynInt32 device support for mbbiDirect record for representing bitmasks Ralph Lange via Tech-talk
Next: Re: asynInt32 device support for mbbiDirect record for representing bitmasks 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: asynInt32 device support for mbbiDirect record for representing bitmasks Mark Rivers via Tech-talk
Next: Re: MODBUS User-Defined Function Codes 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 ·