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

Subject: Re: subroutine, chaning links
From: Tim Mooney <[email protected]>
To: Ben Franksen <[email protected]>
Cc: [email protected]
Date: Fri, 30 May 2008 12:23:42 -0500


Ben Franksen wrote:
On Freitag, 30. Mai 2008, Mathias Steiner wrote:
All would be well if it were possible to change links -- either .FLNK or
.OUT -- from within a subroutine.  I've tried a couple of things without
success.  Just pasting the channel name into the "value" field of the
union does not, and probably should not, work.

Assigning a different value to a link by copying an input link doesn't
work either:
psub->flnk = psub->inpb;

This isn't so clear to me, since they are both of type DBLINK.  After
all, I can "just" type the value into the .FLNK field of any channel
using edm, and it'll work...

It works because this operation is going via Channel Access.


You can do the same from your subroutine: use the CA client library to establish a channel to the FLNK (or whatever other link) field, then do a ca_put with the new value. A very simple example for how to use CA (client) is provides as a makeBaseApp template, just do

makeBaseApp.pl -t caClient

and look at caExample.c.

I am not sure whether the ca_context_create() call is necessary if you call CA from a subroutine record, maybe the context has already been initialized?

Cheers
Ben

I think I would not do this from within a sub record's subroutine, even though it's possible. I would probably arrange for an SNL program, or for some string record's output link (with attribute 'CA'), to write to the links that need to be changed. A sub record's subroutine is not well positioned to perform as a CA client, and there seems to me little benefit to be gained, in the end, from coercing this. The subroutine can't use the new links until it returns and is re-entered (i.e., until the lock set has been released, and CA has had an opportunity to run), so you'll have the principal disadvantage of using an explicit third party, whether you actually use one or not.

--
Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab.

Replies:
Re: subroutine, chaning links Ben Franksen
References:
subroutine, chaning links Mathias Steiner
Re: subroutine, chaning links Ben Franksen

Navigate by Date:
Prev: Re: subroutine, chaning links Ben Franksen
Next: procServ soft IOC server - V2.2.0 released Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: subroutine, chaning links Ben Franksen
Next: Re: subroutine, chaning links Ben Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  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 ·