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: CA client application
From: Benjamin Franksen <[email protected]>
To: [email protected]
Date: Wed, 15 Oct 2008 21:05:01 +0200
On Mittwoch, 15. Oktober 2008, M.Babai wrote:
> I am trying to develop an application using EPICS CA connection library.
> We have the following setting:
>
> device one: provides PV1
> device two: provides PV2
>
> Now, the intention is to read a number of values from the first device
> and collect them. After collecting of, let say 100, values of PV1 we can
> perform some computations and based on the results we can determine the
> value for PV2 and set that. After this operations we want to go to the
> monitoring phase and continue collecting PV1 values. For reading PV1
> values I am using a program with the same structure like the caMonitor
> application provided by the makeBaseApp.pl:
>
> /Code
> status = ca_context_create(ca_disable_preemptive_callback);
> SEVCHK(status,"ca_context_create()");
>
> status = ca_create_channel(pname,connectionCallback,
>                                 pmynode,20,&pmynode->mychid);
> SEVCHK(status,"ca_create_channel()");
>
> status = ca_add_event(DBR_FLOAT,pmynode->mychid,
> 			    eventCallback, pmynode,&pmynode->myevid);
> SEVCHK(status,"ca_add_event()");
>
> SEVCHK(ca_pend_event(0.0),"ca_pend_event()");
> /Code
>
> I am using ca_pend_event() because I want to collect PV1 values only if
> they change. The frequency of changes of PV1 are not known, thus the
> application needs to wait until there are enough values available.
> If I use the value 0.0 as the argument for ca_pend_event(), then program
> remains calling the eventCallback function (blocking mode), thus all of
> the necessary computations need to be done in the body of eventCallback.
> In the other case, other values for time-out, there is no guaranty that
> we can collect enough PV1-s.

int counter = 0;

while (counter < 100) {
  ca_pend_event(1.0);
}

my_event_callback(...) {
  ...stash the new data value into some buffer...
  counter ++;
}

Or maybe I am not understanding your question?

Cheers
Ben

References:
CA client application M.Babai

Navigate by Date:
Prev: Re:RE: RE: a question about mbbiDirect and fanout marco_hair
Next: Re: LvEPICS on USB Key pre-release Mauro Giacchini
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: CA client application M.Babai
Next: Re: CA client application M.Babai
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 ·