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: PaweÅ PrÄdki <[email protected]>
To: Ned Arnold <[email protected]>
Cc: [email protected]
Date: Fri, 09 Jul 2010 22:33:03 +0200
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





Replies:
RE: Getting value of a PV from a subRecord function Allison, Stephanie
References:
Getting value of a PV from a subRecord function ppredki
Re: Getting value of a PV from a subRecord function Ned Arnold

Navigate by Date:
Prev: Re: Getting value of a PV from a subRecord function Ned Arnold
Next: RE: Getting value of a PV from a subRecord function Allison, Stephanie
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 Ned Arnold
Next: RE: Getting value of a PV from a subRecord function Allison, Stephanie
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 ·