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

Subject: RE: Getting value of a PV from a subRecord function
From: "Allison, Stephanie" <[email protected]>
To: PaweÅ PrÄdki <[email protected]>, Ned Arnold <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Fri, 9 Jul 2010 14:17:51 -0700
Hi Pawel,

Chapter 15 of the App Dev Guide discusses Runtime Database Access which I think is what you are asking about.  There are many routines your subroutine can call to get information about an input link (dbGetTimeStamp, dbGetAlarmLimits, etc etc).  

And to dig even deeper (and I don't recommend this be done trivially), you can call dbGetPdbAddrFromLink for any INPx link and then use that address to do other things (like getting to the rset of the record which you can use to call the record's support functions).  But it's up to you to lock/unlock any record that you access this way.  It's better to let the INPx links do all the work for you.  And if you want data (strings or arrays) other than scalar, then use aSub instead.

Stephanie Allison

> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Pawel Predki
> Sent: Friday, July 09, 2010 1:33 PM
> To: Ned Arnold
> Cc: [email protected]
> Subject: Re: Getting value of a PV from a subRecord function
> 
> Thanks for a quick reply, Ned. I have no idea how I missed these fields.
> Just to satisfy my curiosity - is it possible to somehow get to the
> biRecord pointers connected as INPx to the subroutine record?
> 
> Cheers,
> Pawel
> 
> W dniu 2010-07-09 22:16, Ned Arnold pisze:
> > Pawel -
> >
> > The subroutine record fetches the values of the input links before it calls your user routine
> and stores them in fields a,b,c,...  with the previous values in la, lb, lc, ...
> >
> > So, your code could look like this ...
> >
> > long TestPrint(struct subRecord *psu) {
> >
> >      if (psu->a != psu->la) {
> >          <<  input a changed>>
> >      }
> >      if (psu->a) {
> >          <<  input a is non-zero>>
> >      }
> >      if (psu->b != psu->lb) {
> >          <<  input b changed>>
> >      }
> >     if (psu->b) {
> >          <<  input b is non-zero>>
> >      }
> >
> > return o;
> > }
> >
> >
> > On Jul 9, 2010, at 1:53 PM, [email protected] wrote:
> >
> >> Hello,
> >>
> >> I'm new to EPICS and I've been trying to write some simple programs just
> >> to get to know the software.
> >>
> >> Let me start with the database records I'm currently using:
> >>
> >> record(bi,"$(user):goSub0") {
> >> 	field(DESC,"Start Subroutine0")
> >> 	field(DTYP,"Soft Channel")
> >> 	field(FLNK,"$(user):stopsub")
> >> 	field(ZNAM,"Go0")
> >> 	field(ONAM,"Nogo0")
> >> }
> >> record(bi,"$(user):goSub1") {
> >> 	field(DESC,"Start Subroutine1")
> >> 	field(DTYP,"Soft Channel")
> >> 	field(FLNK,"$(user):stopsub")
> >> 	field(ZNAM,"Go1")
> >> 	field(ONAM,"Nogo1")
> >> }
> >> record(sub,"$(user):stopsub") {
> >> 	field(DESC,"SimpleTest")
> >> 	field(INAM,"SubInit")
> >> 	field(SNAM,"TestPrint")
> >> 	field(INPA,"$(user):goSub0.VAL")
> >>         field(INPB,"$(user):goSub1.VAL")
> >>
> >> }
> >>
> >> The idea is, whenever any of the goSubx changes the TestPrint function
> >> should be called. I'm using MEDM to create a simple GUI, where a button
> >> (Message Button) has its Control Channel set to goSubx.VAL with the press
> >> message set to 1.
> >>
> >> As far as I know, this changes the value of goSub whenever I press the
> >> button.
> >>
> >> The question is, having the TestPrint function:
> >>
> >> long TestPrint(struct subRecord *psu) {
> >>
> >> 	return 0;
> >> }
> >>
> >> how can I determine which button was pressed? I wanted to check both
> >> inputs and see which goSubx.VAL == 1 but I don't know how to get to the
> >> biRecord pointer using the subRecord pointer. Is there any way to do this?
> >>
> >> Thanks in advance for your help.
> >>
> >> Kind Regards,
> >> Pawel Predki
> >>
> >>
> >
> >


References:
Getting value of a PV from a subRecord function ppredki
Re: Getting value of a PV from a subRecord function Ned Arnold
Re: Getting value of a PV from a subRecord function PaweÅ PrÄdki

Navigate by Date:
Prev: Re: Getting value of a PV from a subRecord function PaweÅ PrÄdki
Next: devIocStats 3.1.2 released Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Getting value of a PV from a subRecord function PaweÅ PrÄdki
Next: devIocStats 3.1.2 released Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  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 ·