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  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Re: Re: read waveform data using ca_create_subscription
From: 吴煊 <wux@ihep.ac.cn>
To: tech-talk <tech-talk@aps.anl.gov>
Date: Wed, 5 Nov 2014 09:55:41 +0800 (GMT+08:00)
Thank Andrew, Bruce and Yong! Andrew has pointed out the mistake I made. It's really hard to find it out. It's working smoothly now. Thank you all!
 
Cheers,
Xuan
> -----原始邮件-----
> 发件人: "Andrew Johnson" <anj@aps.anl.gov>
> 发送时间: 2014年11月5日 星期三
> 收件人: "吴煊" <wux@ihep.ac.cn>
> 抄送: 
> 主题: Re: ca problem
> 
> Hi Xuan,
> 
> On 11/04/2014 06:05 AM, 吴煊 wrote:
> > I've post a email to tech-talk, but received no reply. I came
> > across a weird problem. That's if I create less than 41 channels,
> > the program works fine. If I create more than 42 channels, it will
> > segment fault. I suspect that is there any limitation in ca client
> > tools. Could you help me getting rid of this? Many thanks in advance.
> > The simple code and db is in the attachment.
> 
> The problem is in your code, in both the simplified test.c that you sent
> me and your original archive.c file. This variable definition
> 	char chName[MAX_STRING][CH_NUM];
> does not match your code that uses it:
> 	sprintf(chName[index], "wf%d", index+1);	
> 	stat=ca_create_channel(chName[index],NULL,NULL,CA_PRIORITY_DEFAULT,&pv[index].channel);
> The code using it would need to be this:
> 	sprintf(&chName[0][index], "wf%d", index+1);
> 	stat=ca_create_channel(&chName[0][index],NULL,NULL,CA_PRIORITY_DEFAULT,&pv[index].channel);
> which does not seg-fault for me, unlike your original.
> 
> However you don't actually need to keep the channel names in memory
> after you have passed them to ca_create_channel(), so you could replace
> the lines above with these and the result also works:
> 
> 	char chName[MAX_STRING];
> ...
> 	sprintf(chName, "wf%d", index+1);
> 	stat=ca_create_channel(chName,NULL,NULL,CA_PRIORITY_DEFAULT,&pv[index].channel);
> 
> You can always get the associated channel name from the CA chid
> afterwards using ca_name(pv[index].channel).
> 
> Hope this helps,
> 
> - Andrew
> -- 
> People everywhere confuse what they read in newspapers with news.
> -- A. J. Liebling



Navigate by Date:
Prev: Re: Sequencer: are variables shared? Damiano Bortolato
Next: catools (caget/caput/camonitor) and locale settings from the environment Goetz Pfeiffer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Re: read waveform data using ca_create_subscription Bruce Hill
Next: Re: Tektronix DMM 4050 device support Hovanes Egiyan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·