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

Subject: Re: interrupt read data in int32Driver example
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, timesir <mrlong336 at gmail.com>
Date: Fri, 7 Jul 2023 12:19:51 +0000
Hi,
  • However, the return value of `caget` did not change. How can I make `asyndevAiInt32A0` generate a read data interrupt to software simulate a hardware interrupt that produces new data?
If you open the OPI file for that testEpicsApp program you will see that there is another record that sets the interrupt rate.  That record defaults to 0, so there are no interrupts.  You can set it to a non-zero value either in the OPI screen or with a caput command.

Here I set it to 1.0 seconds using caput:

corvette:~>caput asyndevSetRateInt32 1.0
Old : asyndevSetRateInt32            0
New : asyndevSetRateInt32            1

Now when I run caget on asyndevAiInt32A0 it is indeed changing as you expect:

corvette:~>caget asyndevAiInt32A0
asyndevAiInt32A0               -99.9115
corvette:~>caget asyndevAiInt32A0
asyndevAiInt32A0               -99.8993
corvette:~>caget asyndevAiInt32A0
asyndevAiInt32A0               -99.8962

I can also run camonitor to see it change.

corvette:~>camonitor asyndevAiInt32A0
asyndevAiInt32A0               2023-07-07 07:01:09.423192 -99.8779
asyndevAiInt32A0               2023-07-07 07:01:10.423334 -99.8749
asyndevAiInt32A0               2023-07-07 07:01:11.423444 -99.8718
asyndevAiInt32A0               2023-07-07 07:01:12.423598 -99.8688
asyndevAiInt32A0               2023-07-07 07:01:13.423738 -99.8657
asyndevAiInt32A0               2023-07-07 07:01:14.423891 -99.8627
asyndevAiInt32A0               2023-07-07 07:01:15.424011 -99.8596
asyndevAiInt32A0               2023-07-07 07:01:16.424143 -99.8566

The function in int32Driver that does the interrupt callback is here:

If you plan to write your own driver that does interrupt callbacks I would strongly recommend that you do not use int32Driver.c as an example.  It uses the asyn C interface, which is very verbose and requires a lot of code to do this.  I recommend that you write your driver in C++ and inherit from asynPortDriver.  The code required to do interrupt callbacks is then much simpler.  This is the code that does asynFloat64 callbacks on the "mean value" in the simulation:


It is just:
        setDoubleParam(P_MeanValue, meanValue);
        callParamCallbacks();

Mark


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of timesir via Tech-talk <tech-talk at aps.anl.gov>
Sent: Friday, July 7, 2023 1:18 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: interrupt read data in int32Driver example
 
Dear community,

I would like to learn about the usage of epics interrupt. I found an example routine called `int32Driver` (asyn/iocBoot/ioctestEpics/st.cmd and asyn/testEpicsApp/src). In the `st.cmd` script, there is a record instance that I want to use to run an interrupt because it has `SCAN=I/O Intr`. Here is the example record instance:

record(ai,"asyndevAiInt32A0") {
    field(SCAN,"I/O Intr")
    field(DTYP,"asynInt32")
    field(INP,"@asyn( int32 , 0 , 1.0) ")
    field(LINR,"LINEAR")
    field(EGUF,"100.0")
    field(EGUL,"-100.0")
    field(PREC,"3")
}

After running `epics` using the above command, I tried to read the data generated by the interrupt using `caget asyndevAiInt32A0`. However, the return value of `caget` did not change. How can I make `asyndevAiInt32A0` generate a read data interrupt to software simulate a hardware interrupt that produces new data?

References:
interrupt read data in int32Driver example timesir via Tech-talk

Navigate by Date:
Prev: Re: issue of getTimeStamp from EVR Timo Korhonen via Tech-talk
Next: Re: issue of getTimeStamp from EVR Shen, Guobao 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  <20232024 
Navigate by Thread:
Prev: Re: interrupt read data in int32Driver example Ralph Lange via Tech-talk
Next: issue of getTimeStamp from EVR Di Wang 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  <20232024 
ANJ, 07 Jul 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·