EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: caget() from C++
From: "Church, Eric D" <[email protected]>
To: "[email protected]" <[email protected]>
Cc: "Mendez, Jennifer M" <[email protected]>
Date: Wed, 8 Nov 2017 16:05:06 +0000

Hi, Andrew, Kay, et al:

 

We are trying to use caput() and caget() from a C++ program. The IOC is up and I can issue caputs and cagets from the command line and put and retrieve reasonable values into our EPICS records. We’re having some difficulty in compiled C++, however.

 

I include below the apparently necessary gymnastics to successfully ca_get() anything in C++. We want to do this with a total of about 48 PVs once every 15 seconds. The first thing we note is we need to do a context_create and create_channel each of those 48 times each 15 seconds. Which necessitates the channel clear and context destroy at the end. We can not use our class member chid over and over with each run through this function, it seems. Secondly, and weirdly, we also observe that the effort at getting a DBR_DOUBLE type of a particular record fails, but the DBR_FLOAT succeeds. If we comment either one of those efforts out the other fails on ints own. Failure means the local_float or local_double that we initialize keeps its initial value and a !ECA_NORMAL status is returned. Success means the double fails, and the float works.

 

We’re using base-3.14.12.5 on a machine with

blah:~/ara$ uname -a

Linux arxe 2.6.32-696.10.2.el6.x86_64 #1 SMP Tue Sep 12 14:33:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

This is a CAEN 1470 power supply with 8 channels that we’re controlling.

 

Thanks for helping us trim down the full set of commands to the minimal number that still allows successful ca_get() and ca_put(). At least it would be nice not to have to do the extra failing ca_get() to get the other one to be successful.

 

Many thx. please let us know if we can provide any further useful information.

 

-- Eric

 

        chid local_chid;

        SEVCHK(ca_context_create(ca_disable_preemptive_callback),"ca_context_create");

        cout << "after ca_context_create" << endl;

        SEVCHK(ca_create_channel(eItr->second.eName.c_str(),NULL,NULL,10,&local_chid),"ca_create_channel failure");

        cout << "after ca_create_channel" << endl;

 

        success = ca_get(DBR_DOUBLE, local_chid, &local_double); // success here is whether the request qued ok.                                                                               

        if (success == ECA_NORMAL) {

          cout << "success == normal" << endl;

        }

        else {

          cout << "ERROR - (" << ca_message(success) << ")" << endl;

        }

        success = ca_pend_io(3.0); // here, we flush the request and see about the status.                                                                                                     

        if (success == ECA_NORMAL) {

          cout << "success == normal" << endl;

        }

        else {

          cout << "ERROR - (" << ca_message(success) << ")" << endl;

        }

        cout << "local double var=" << local_double << endl << endl;

        success = ca_get(DBR_FLOAT, local_chid, &local_float); // success here is whether the request qued ok.                                                                                 

        if (success == ECA_NORMAL) {

          cout << "success == normal" << endl;

        }

        else {

          cout << "ERROR - (" << ca_message(success) << ")" << endl;

        }

        success = ca_pend_io(3.0); // here, we flush the request and see about the status.                                                                                                     

        if (success == ECA_NORMAL) {

          cout << "success == normal" << endl;

        }

        else {

          cout << "ERROR - (" << ca_message(success) << ")" << endl;

        }

        //      cout << "local chid=" << local_chid << endl;                                                                                                                                   

        cout << "local float var=" << local_float << endl;

        cout << "---------------------------------" << endl;

 

 

        ca_clear_channel(local_chid);

        ca_context_destroy(); // no args                                                                                                                                                       

 

 


Replies:
Re: caget() from C++ Andrew Johnson

Navigate by Date:
Prev: RE: caLab and real time os Mazanec Tomáš
Next: Re: motor module compile problems Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: motor module compile problems Lang, Keenan C.
Next: Re: caget() from C++ Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024