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  <20132014  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  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: VAL field of PV in ASYN driver
From: Mark Rivers <[email protected]>
To: "'Andrew Johnson'" <[email protected]>, "[email protected]" <[email protected]>, Vikram Bhagat <[email protected]>
Date: Fri, 14 Jun 2013 16:25:18 +0000
I think there may be another issue here.

Standard asyn device support for output records does the following in the init_record routine:

- Tries to read the current value from the driver via pasynInt32SyncIO->read(), pasynFloat64SyncIO->read(), etc.
- If the driver returns asynSuccess then the device support puts the value read from the driver into the VAL field of the output record.  This will replace the value in your DB file.
- If the driver does not return asynSuccess then the device support does not change the VAL field and the DB value will be used.

These steps are designed for "bumpless reboots", so the output record agrees with the device.

After these steps, if there is a value from autoSave then that value will replace the VAL field from either the DB file or the driver.

So you may need to modify your driver so that its read() routine does not return success on an initial when presumably the value is invalid.

Note that if your driver is derived from asynPortDriver then the base class implementation will returns asynError on the read() function if your driver has never called setInt32Param, etc. for that parameter.  It returns asynSuccess on the read() function if your driver has called setInt32Param, etc. for that parameter. 


Mark


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Andrew Johnson
Sent: Friday, June 14, 2013 10:43 AM
To: [email protected]; Vikram Bhagat
Subject: Re: VAL field of PV in ASYN driver

Hi Vikram,

On 2013-06-14 Vikram Bhagat wrote:
> as i understand of i defiend VAL field to some value in DB file then it
>  sould be written on output. 
> I have develop my own driver to write value on serial port using asyn
>  driver. and it is working fine. 
> if i write some value . it is output on port.
>  
> But if i write VAL field in DB file.   it is not writting that value to the
>  output 

To write the record value to the port you have to arrange for the record to 
be processed.  You can do this in several different ways, but depending on 
your port driver not all of them will work.  The simplest is to set the PINI 
field of the record to YES, which will cause it to be processed automatically 
at IOC Initialization time.  However if your Asyn port has not connected up 
to the device in time that might not work, and in that case a better solution 
might be to put a command in your startup script to put the value at some 
time after the call to iocInit, like this:
    ...
    iocInit()
    epicsThreadSleep(2)
    dbpf TEST:VAL 7

The epicsThreadSleep command might not be necessary in some cases, or you 
might have to make the sleep delay longer according to how long it takes for 
your particular Asyn port to connect.

- Andrew
-- 
It is difficult to get a man to understand something, when his salary
depends upon his not understanding it. -- Upton Sinclair


References:
VAL field of PV in ASYN driver Vikram Bhagat
Re: VAL field of PV in ASYN driver Andrew Johnson

Navigate by Date:
Prev: Re: Missing device support routine PV Andrew Johnson
Next: RE: GUI Control System Options Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: VAL field of PV in ASYN driver Andrew Johnson
Next: Missing device support routine PV Igor H. Soares Nunes
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·