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