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

Subject: Re: Creating an error counter
From: Ralph Lange <ralph.lange@gmx.de>
To: EPICS Tech Talk <tech-talk@aps.anl.gov>
Date: Thu, 20 Jul 2017 22:02:05 +0200
It used to be that way some time ago.
In fact, the following minimal calc record does indeed count when being processed:

record(calc,"calc") {
  field(CALC,"VAL+1")
}

According to the release notes, the VAL keyword was added to the calc engine in Base 3.14.10, published nine years ago.

Cheers,
~Ralph



On Thu, Jul 20, 2017 at 8:52 PM, Southern, Tim <t1o@ornl.gov> wrote:

To make the CALC record increment, you need to add the counter PV as an input for the CALC field to use. You can't use the VAL field itself as others have replied.  The following counter PV should solve your issue. 


record(calc,$(P):$(R):DEBUG:COUNTER)  {

    field(DESC,"Counter of # of errors")

    field(SCAN,"Passive")

    field(INPA,"1")

    field(INPB, "$(P):$(R):DEBUG:COUNTER"

    field(CALC,"A+B")

}

 

-Tim



On 7/20/17 12:49 PM, Flewellen-Gore, Andrew (US) wrote:

Hello, and thanks for reading,

 

I’m having trouble keeping a counter for the number of errors coming in from an electron microscope (SEM). I’m using the Stream device driver to listen to incoming messages from the SEM, and when a message matches a certain format that identifies it as an error message, the PV processes and stores the new error message, overwriting the last. When this happens I would like to have a second record process and increment a counter, so that I can keep track of the number of error messages coming in.

 

My current setup gets the most recent error message correctly, but does not correctly increment the counter (the counter stays at zero). Here is the relevant code from the record definition file.

 

record(waveform,$(P):$(R):DEBUG:LISTEN)  {

    field(DESC,"Holds last SEM error")

    field(DTYP,"stream")

    field(NELM,"1000")

    field(FTVL,"CHAR")

    field(SCAN,"I/O Intr")

    field(FLNK,"$(P):$(R):DEBUG:COUNTER")

    field(INP, "@devhardware.proto debugListen() L5 0")

}

 

record(calc,$(P):$(R):DEBUG:COUNTER)  {

    field(DESC,"Counter of # of errors")

    field(SCAN,"Passive")

    field(INPA,"1")

    field(CALC,"VAL+A")

}

 

When the first record processes due to an interrupt on a received error message, it is supposed to forward-link the calc record to process, causing an increment to the counter.

 

Any help or insight is appreciated.

-Andrew




References:
Creating an error counter Flewellen-Gore, Andrew (US)
Re: Creating an error counter Southern, Tim

Navigate by Date:
Prev: Re: Creating an error counter Southern, Tim
Next: RE: Creating an error counter Flewellen-Gore, Andrew (US)
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
Navigate by Thread:
Prev: Re: Creating an error counter Southern, Tim
Next: Re: Creating an error counter Ford, Christopher
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
ANJ, 20 Jul 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·