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  <20162017  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  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: wait/dealy inside a record
From: Andrew Johnson <[email protected]>
To: <[email protected]>
Date: Fri, 12 Aug 2016 10:23:46 -0500
Hi Stefen,

On 08/12/2016 02:48 AM, Stefen Paul wrote:
> I'm using a waveform record (with custom device support) for writing &
> reading a hardware.
> 
> I need following sequence:
> 
> - write to a register
> - wait for 20 microseconds
> - again write to the same register
> - again wait for 20 microseconds
> - read an array of other registers
> 
> Any tips on how can I generate a delay/wait of ~20 microsec inside the
> device support routine  or otherwise in EPICS ?

40 microseconds is probably a bit too long for your device routine to
block record processing, so Michael's suggestion that you use an
asynchronous completion callback is sensible. That requires you to
implement the write/delay/write/delay/read sequence yourself though,
probably in another thread, and to communicate between threads.

An alternative approach that I recommend looking at is to use
asynDriver's Port Driver C++ class, which can simplify the device
support code quite a bit and allows you to write the above sequence as
what looks like single-threaded code. Your 20µs delays could then become
calls to the OS' nanosleep() routine or an equivalent. The asynDriver
infrastructure will run this code in a separate thread at the
appropriate time and handle the communication with the record for you.

http://www.aps.anl.gov/epics/modules/soft/asyn/R4-29/asynPortDriver.html
http://www.aps.anl.gov/epics/modules/soft/asyn/R4-29/asynDriver.html

HTH,

- Andrew

-- 
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon

Replies:
RE: wait/dealy inside a record Mark Rivers
References:
wait/dealy inside a record Stefen Paul

Navigate by Date:
Prev: Re: Question about pv value and the label display in CSS boy opi Kasemir, Kay
Next: RE: building EPICS base-13.15.4 on Windows 10 Lee, William R. (LARC-D304)[Jacobs Technology, Inc.]
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: wait/dealy inside a record Michael Davidsaver
Next: RE: wait/dealy inside a record Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 12 Aug 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·