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  <20142015  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  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: PV for both input AND output
From: Pete Jemian <[email protected]>
To: <[email protected]>
Date: Thu, 16 Jan 2014 11:01:36 -0600
FWIW, this example using Stream Device and write/read communication with
a field device receives a command string from a "user" via Channel Access, sends that to the field device, waits for the response, and then places that response back into the same stringout record for the "user" to read:

Stream protocol fragment from write_read.proto:

debug {
    out "%s";
    in "%39c";
}

EPICS database fragment:

record(stringout, "$(P)cmd") {
    field(DESC, "command interface")
    field(DTYP, "stream")
    field(OUT,  "@write_read.proto debug $(PORT)")


Pete



On 1/16/2014 10:54 AM, Andrew Johnson wrote:
Hi Matteo,

On 01/16/2014 09:33 AM, Matteo Pardi wrote:
Can I create a process variable which will have a callback to read data,
and a callback to write data?

The API between a record type and its device support is set by the
designer of the record type. If you want a record type that does both
input and output you can create one yourself with both a read and a
write function in the DSET. The IOC only requires that the DSET
structure starts like this:

struct my_dset {   /* device support entry table */
     long	number;		/* number of support routines */
     DEVSUPFUN	report;		/* print report */
     DEVSUPFUN	init;		/* init support layer */
     DEVSUPFUN	init_record;	/* init device for particular record */
     DEVSUPFUN	get_ioint_info;	/* get io interrupt information */
     /* Other functions go here and are record-type specific */
};

You can add as many additional functions to the DSET as you need to
implement the desired interface between the record and the device.

When you write your own record type though you do have to write all the
associated device support layers as well, the support layers provided by
Asyn or StreamDevice say will not work directly with your new type,
although you may be able to use them as examples and re-use their driver
layer.

Note that a record type must have a link field called either INP or OUT
to properly connect to device support.

Hope this helps,

- Andrew


--
----------------------------------------------------------
Pete R. Jemian, Ph.D.                <[email protected]>
Beam line Controls and Data Acquisition, Group Leader
Advanced Photon Source,   Argonne National Laboratory
Argonne, IL  60439                   630 - 252 - 3189
-----------------------------------------------------------
   Education is the one thing for which people
      are willing to pay yet not receive.
-----------------------------------------------------------



References:
PV for both input AND output Matteo Pardi
Re: PV for both input AND output Andrew Johnson

Navigate by Date:
Prev: Re: PV for both input AND output Andrew Johnson
Next: RE: PV for both input AND output Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: PV for both input AND output Andrew Johnson
Next: Re: PV for both input AND output Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·