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  <20102011  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  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Another asynPortDriver Question
From: "Mark Rivers" <[email protected]>
To: "Wang Xiaoqiang" <[email protected]>, "Szalata, Zenon M." <[email protected]>
Cc: [email protected]
Date: Mon, 12 Jul 2010 07:32:12 -0500
Hi Xiaoqiang,

You can't do it in your asyn port driver, because the driver has no knowledge of the EPICS records.

It could be done in asyn device support.  It is not implemented in standard asyn device support, because in general a callback with a new value should only update input records (that have SCAN=I/O Intr), not output records.  You could write your own specialized device support to do this (based on standard asyn device support). We could also consider adding a new device support type, e.g. "asynInt32OutputSync" that would register for callbacks on output records and sync the record to the callback value.

Mark

 


________________________________

From: Wang Xiaoqiang [mailto:[email protected]]
Sent: Mon 7/12/2010 1:09 AM
To: Mark Rivers; Szalata, Zenon M.
Cc: [email protected]
Subject: RE: Another asynPortDriver Question





Hi Mark,

I have the same question: changing longout/ao records' value at driver
level.
I see you can sync at database level. But if there are twenties of them,
which is normal for a device with many settings, the database would look
clumsy.
Is there a reason, preventing doing so in asynDriver?

Best,
Xiaoqiang

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mark Rivers
Sent: Sunday, July 11, 2010 11:21 PM
To: Szalata, Zenon M.
Cc: [email protected]
Subject: RE: Another asynPortDriver Question

Hi Zen,

> You showed me how to initialize a longout record from a hardware
register at iocInit time.
>  I implemented that, as you suggested by creating my version of the
virtual function readInt32, and it works fine.

Note that you don't even need to implement your own version of
readInt32.  All you need to do is read the value from the hardware
register in your constructor and call setIntegerParam with the value.
Then when device longout support calls the asynPortDriver::readInt32
function during initialization it will get the current value, and will
get an asynSuccess return.  If you have not called setIntegerParam
before iocInit then asynPortDriver::readInt32 will return asynError, and
the longout device support will not initialize the record to that value.

> How can I modify the contents of a longout record from the low level
driver code at run time? 

> I am developing a low level asyn driver derived from asynPortDriver
class and it became of interest to me to do that. 

> I think that I could accomplish this using dbAccess routines, but that
seems somewhat inelegant.


I would recommend doing it in the database.  Here is an example of how I
do it.  There are 2 longout records, one with soft device support and
one with asyn device support.  There is a longin record on the same
parameter with SCAN=I/O Intr.  When your driver does setIntegerParam()
and callParamCallbacks() this longin record processes.  It writes the
value into the soft longout record, which writes it to the asyn longout.
But the asyn longout does not process because of the configuration of
SDIS and DISV, so your driver is not called.  This has the effect of
synchronizing the longout to the driver value any time the driver
changes it.

record(longout, "$(P)$(R)FileNumber")
{
    field(PINI, "YES")
    field(OUT, "$(P)$(R)FileNumber_write PP")
    field(VAL, "1")
}

record(longout, "$(P)$(R)FileNumber_write") {
    field(SDIS, "$(P)$(R)FileNumber_Sync.PACT")
    field(DISV, "1")
    field(DTYP, "asynInt32")
    field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))FILE_NUMBER")
}
record(longin, "$(P)$(R)FileNumber_RBV") {
    field(DTYP, "asynInt32")
    field(INP,  "@asyn($(PORT),$(ADDR),$(TIMEOUT))FILE_NUMBER")
    field(SCAN, "I/O Intr")
    field(FLNK, "$(P)$(R)FileNumber_Sync") } record(longout,
"$(P)$(R)FileNumber_Sync") {
    field(DOL,  "$(P)$(R)FileNumber_RBV NPP")
    field(OMSL, "closed_loop")
    field(OUT,  "$(P)$(R)FileNumber PP") }

Mark


________________________________

From: Szalata, Zenon M. [mailto:[email protected]]
Sent: Sun 7/11/2010 3:53 PM
To: Mark Rivers
Cc: [email protected]
Subject: Another asynPortDriver Question



Hi Mark,
You showed me how to initialize a longout record from a hardware
register at iocInit time.  I implemented that, as you suggested by
creating my version of the virtual function readInt32, and it works
fine.

I now have a related question.
How can I modify the contents of a longout record from the low level
driver code at run time?  I am developing a low level asyn driver
derived from asynPortDriver class and it became of interest to me to do
that.  I think that I could accomplish this using dbAccess routines, but
that seems somewhat inelegant.

Thanks in advance,
Zen







References:
Another asynPortDriver Question Szalata, Zenon M.
RE: Another asynPortDriver Question Mark Rivers
RE: Another asynPortDriver Question Wang Xiaoqiang

Navigate by Date:
Prev: RE: EDM Question tom.cobb
Next: Exceptions, munch, ... Re: VxWorks 6.7, MV5500 Kasemir, Kay
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Another asynPortDriver Question Wang Xiaoqiang
Next: StreamDevice question - trailing characters Mark Bennett
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·