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  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: modbus: problem on readInt32Array
From: Davide Marcato <[email protected]>
To: [email protected]
Cc: "[email protected]" <[email protected]>
Date: Thu, 14 Dec 2017 13:58:41 +0100
Hello,
I am writing an asynPortDriver port on top of the modbus EPICS module and I would like to read the initial values of the modbus registers for writing functions.

I am currently working with modbus 2-10-1 and asyn4-30 and I am using the absolute addressing. I noticed that when calling readInt32Array on the modbus port using modbus function 16, the module always performs a TCP query but does not return the values, because it enters the following lines of code:

drvModbusAsyn.c line 1276:
                case MODBUS_WRITE_SINGLE_REGISTER:
                case MODBUS_WRITE_MULTIPLE_REGISTERS:
                case MODBUS_WRITE_MULTIPLE_REGISTERS_F23:
                    printf("write multiple registers\n");
                    if (!pPlc->readOnceDone) return asynError;

and readOnceDone is false. This way I can never read the initial values of the registers. Is this a know behavior or is it an error?

In the readInt32 function (drvModbusAsyn.c line 878) the variable readOnceDone is set to 1 after the call to doModbusIO. Is there a reason for not being the same on the readInt32Array function?

Furthermore, would it be a good idea to avoid performing modbusIO more than once in absolute addressing mode when using a write modbus function (eg: 16)? This would keep the behavior consistent with the rest of the module.

I also noticed that on the rest of the module, when trying to read on a "output" port (meaning that a modbus write function code is in use) the module always return the value it read at startup, on the first (and only) reading. Is there a reason why the values written to those registers are not cached and the last written value is returned instead of the value the register had on the first reading? I mean somenthing like:
1 - the registers are read (doModbusIO) and their value is saved to a cache
2 - the user writes to some of those registers
3 - the user tries to read those same registers and the modbus module returns the last cached value for each register

Thank you,
Davide

--
Davide Marcato
INFN - Laboratori Nazionali di Legnaro
Viale dell'Universita', 2
35020 LEGNARO (PD) - ITALY
Phone: +39 0498068439	


Navigate by Date:
Prev: Re: Event triggers for plusers not detected (mrf-timing system) Bjorklund, Eric A
Next: Channel Archiver compilation error Wang, Lin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Save MCA record data Mark Rivers
Next: Channel Archiver compilation error Wang, Lin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·