Experimental Physics and Industrial Control System
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
- Replies:
- RE: Another asynPortDriver Question Wang Xiaoqiang
- References:
- Another asynPortDriver Question Szalata, Zenon M.
- Navigate by Date:
- Prev:
Another asynPortDriver Question Szalata, Zenon M.
- Next:
RE: linking to shared objects user libraries Andrew C. Starritt
- 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
2023
2024
- Navigate by Thread:
- Prev:
Another asynPortDriver Question Szalata, Zenon M.
- Next:
RE: Another asynPortDriver Question Wang Xiaoqiang
- 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
2023
2024