EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: subArray INDX field set to 0 if NORD <= 0
From: "J. Lewis Muir" <[email protected]>
To: [email protected]
Date: Thu, 08 Nov 2007 18:05:40 -0500
I have found that if a subArray record reads 0 elements into its array, it sets its INDX field to 0. Is this behavior intended? I would rather it not change its INDX field in this situation.

As an example, say I read four bytes from a serial connection with an asyn record. I then want to grab the fourth read byte from the asyn record's BINP field with a subArray record. So I make the subArray record's INDX field have the value 3. Now say the asyn record has a read error and reads 0 bytes from the serial connection. When the subArray record processes, it sets its INDX field to 0. At this point, my database is broken because INDX has the wrong index for getting the fourth byte of the asyn record's BINP field.

I've attached an example database that shows this problem. Run it on an IOC and run the following commands assuming a PV prefix of "xxx:":

$ caget xxx:FourthByte.INDX
$ caput xxx:ReadFourBytes.PROC 1
$ caget xxx:FourthByte.INDX

In the first caget, INDX will be 3. In the second caget, INDX will be 0.

I've attached a small patch against EPICS 3.14.8.2 base to fix this. But maybe I'm mistaken and the way it works is how it is supposed to work?

My configuration is:
* Processor: Intel Core Duo
* OS: Mac OS X 10.4.10
* EPICS 3.14.8.2
* synApps 5.2 (with motor 6-2-2 + fixes, asyn 4-8 + fixes, sscan 2-5-6)

Thanks,

Lewis

--
J. Lewis Muir
Software Engineer
CARS/IMCA-CAT

#
#  Parameters:
#    $(P)     PV name prefix (e.g. 17bm:)
#

record(asyn, "$(P)ReadFourBytes") {
  field(PORT, "noexistent")
  field(TMOT, "2.0")
  field(TMOD, "Read")
  field(NRRD, "4")
  field(IFMT, "Binary")
  field(FLNK, "$(P)FourthByte")
}

record(subArray, "$(P)FourthByte") {
  field(INP, "$(P)ReadFourBytes.BINP NPP MS")
  field(FTVL, "CHAR")
  field(MALM, "4")
  field(NELM, "1")
  field(INDX, "3")
}
*** src/rec/subArrayRecord.c.orig	Tue Apr  1 16:02:03 2003
--- src/rec/subArrayRecord.c	Thu Nov  8 16:52:46 2007
***************
*** 314,320 ****
          if (psa->nord <= 0)
          {
             status = -1;
-            psa->indx = 0;
          }
          return(status);
  }
--- 314,319 ----

Replies:
Re: subArray INDX field set to 0 if NORD <= 0 Andrew Johnson

Navigate by Date:
Prev: RE: EDM screens did not reconnect Jeff Hill
Next: Re: subArray INDX field set to 0 if NORD <= 0 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Call for expressions of interest for ILC controls R&D and engineering Margaret Votava
Next: Re: subArray INDX field set to 0 if NORD <= 0 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·