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  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  2025  2026  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  <20212022  2023  2024  2025  2026 
<== Date ==> <== Thread ==>

Subject: RE: Accessing waveform record values in C
From: "Dudley, David via Tech-talk" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Fri, 19 Feb 2021 21:25:40 +0000

If all you’re trying to do is to read elements of the waveform, couldn’t you also use the “Channel Filters” functions that allow access to the elements directly?

 

I use those all the time in cs-studio displays.

 

They’re outlined here: <filters (anl.gov)>.

 

David Dudley

Controls Engineer III

Facility for Rare Isotope Beams

Michigan State University

640 South Shaw Lane

East Lansing, MI 48824-1321, USA

Tel. 517-908-7133

Email: dudleyd@frib.msu.edu

 

 

cid:image002.jpg@01D07041.57B6D750

 

 

From: Tech-talk <[email protected]> On Behalf Of Hu, Yong via Tech-talk
Sent: Friday, February 19, 2021 11:15 AM
To: Andy Foster <[email protected]>; Wang, Andrew <[email protected]>
Cc: [email protected]
Subject: Re: Accessing waveform record values in C

 

[EXTERNAL] This email originated from outside of FRIB

Another way without any C codes: use “subArray” record(s) to extract individual element(s) from a waveform record.

record(subArray, "second_element")

{

              field(INP, "waveform_record CP")

              field(FTVL, "CHAR")

              field(MALM, "250")

              field(NELM, 1)

              field(INDX, 1)

}

 

See this for details (or search other website): https://wiki-ext.aps.anl.gov/epics/index.php/RRM_3-14_SubArray

 

HTH,

Yong Hu

 

From: Tech-talk <[email protected]> on behalf of "[email protected]" <[email protected]>
Reply-To: Andy Foster <[email protected]>
Date: Thursday, February 18, 2021 at 3:22 AM
To: "Wang, Andrew" <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: Accessing waveform record values in C

 

Hi Andy,

 

Have you set the field type of field "A" in the aSub record to CHAR? FTA set to CHAR.

 

Cheers, Andy

 

On Thu, 18 Feb 2021, 05:23 Wang, Andrew via Tech-talk, <[email protected]> wrote:

All,

 

Basically I have a waveform record that contains ASCII values of chars shown below.

 

record(waveform, "waveform_record")

{

              field(DESC, "")

              field(SCAN, "Passive")

              field(FTVL, "CHAR")

              field(NELM, 250)

}

 

When I input caget waveform_record, I get:

 

waveform_record 250 72 101 108 108 111 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.

 

My goal is to access 72, 101, 108, 108, and 111 in a C code for an asub record.

 

record(aSub, "asub_record")

{

              field(DESC, "")

              field(SCAN, "Passive")

              field(SNAM, "c_code")

              field(INPA, "waveform_record")

              field(NOA, 250)

              …

}

 

In my C code, I attempt to access the waveform record.

 

char *waveform_record = (char *)prec->a;

printf("%s\n", waveform_record);

 

The terminal only prints out 72, the first element. But when I try to do

 

char *waveform_record = (char *)prec->a;

printf("%s\n", *(waveform_record + 4));

 

I get a segmentation fault rather than 111. Any advice on how I could potentially access the other elements in the waveform record? Feel like I am missing something very basic here.

 

Thanks,

Andy

 

 


References:
Accessing waveform record values in C Wang, Andrew via Tech-talk
Re: Accessing waveform record values in C Andy Foster via Tech-talk
Re: Accessing waveform record values in C Hu, Yong via Tech-talk

Navigate by Date:
Prev: Re: Alive Server Installation Arms, Dohn A. via Tech-talk
Next: Matlab 2020b crashes with labCA 3.7.2 Miroslaw Dach via Tech-talk
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  <20212022  2023  2024  2025  2026 
Navigate by Thread:
Prev: Re: Accessing waveform record values in C Hu, Yong via Tech-talk
Next: Identical Process Variable names on Multiple Servers Manoussakis, Adamandios via Tech-talk
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  <20212022  2023  2024  2025  2026 
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·