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  <20122013  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  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: [CA][waveform] how to NELM?
From: Mark Rivers <[email protected]>
To: Pavel Masloff <[email protected]>
Cc: EPICS Tech Talk <[email protected]>
Date: Fri, 11 May 2012 15:32:24 +0000
I don't have much experience with writing CA clients in C, I mostly use IDL, Java, Python, etc.  Perhaps someone else can help.

Mark

________________________________
From: Pavel Masloff [[email protected]]
Sent: Friday, May 11, 2012 9:07 AM
To: Mark Rivers
Cc: EPICS Tech Talk
Subject: Re: [CA][waveform] how to NELM?

Thanks, Mark! It works if I am reading just one PV. But when I am reading 2 PVs - (waveform and NELM), my NELM value is enormously big!!!
How can I read several PVs?

This is my code:

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "cadef.h"

int main(int argc,char **argv)
{
    int data;         /* NELM */
    chid mychid;

    chid chan;        /* WAVEFORM - file*/
    int status;
    unsigned elementCount, nBytes, i;
    struct dbr_time_char * pTD;
    const dbr_char_t * pValue;

    SEVCHK(ca_context_create(ca_disable_preemptive_callback),"ca_context_create");
    SEVCHK(ca_create_channel("file.NORD",NULL,NULL,10,&mychid),"ca_create_channel failure");
    SEVCHK(ca_pend_io(1.0),"ca_pend_io failure");
    SEVCHK(ca_get(DBR_INT,mychid,(void *)&data),"ca_get failure");
    SEVCHK(ca_pend_io(1.0),"ca_pend_io failure");
    printf("file.NORD: %d\n",data);

    ca_clear_channel ( mychid );
    ca_task_exit ();


    SEVCHK(ca_context_create(ca_disable_preemptive_callback),"ca_context_create");
    status = ca_create_channel ( argv[1], 0, 0, 0, & chan );
    ca_search(argv[1], &chan);
    SEVCHK ( status, "ca_create_channel()" );
    status = ca_pend_io ( 1.0 );
    if ( status != ECA_NORMAL ) {
        fprintf ( stderr, "\"%s\" not found.\n", argv[1] );
        return -1;
    }

    elementCount = ca_element_count ( chan );
    nBytes = dbr_size_n ( DBR_TIME_CHAR, elementCount );
    pTD = ( struct dbr_time_char * ) malloc ( nBytes );
    if ( ! pTD ) {
        fprintf ( stderr, "insufficient memory to complete request\n" );
        return -1;
    }

    status = ca_array_get (DBR_TIME_CHAR, elementCount, chan, pTD );
    SEVCHK ( status, "ca_array_get()" );
    status = ca_pend_io ( 1.0 );
    if ( status != ECA_NORMAL ) {
        fprintf ( stderr, "\"%s\" didnt return a value.\n", argv[1] );
        return -1;
    }

    pValue = & pTD->value;
    for ( i = 0; i < 10; i++ )    printf("%d ", pValue[i]);
    printf("\nTotal size: %d\n", elementCount);
    printf("Timestamp: %d\n", pTD->stamp.nsec);
    ca_clear_channel ( chan );
    free ( pTD );

    return(0);
}






On Fri, May 11, 2012 at 3:42 PM, Mark Rivers <[email protected]<mailto:[email protected]>> wrote:
You can just do a ca_get of record.NELM.
________________________________
From: [email protected]<mailto:[email protected]> [[email protected]<mailto:[email protected]>] on behalf of Pavel Masloff [[email protected]<mailto:[email protected]>]
Sent: Friday, May 11, 2012 6:39 AM
To: EPICS Tech Talk
Subject: [CA][waveform] how to NELM?

I am writing a simple CA client in C.
The client reads the waveform record. And I need to know how many elements there are in it (NELM field).
There is a function entitled ca_element_count() which happens to read the NORD field.

Does anybody know how can I get the NELM field ?



--
Best regards,


Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia

Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01



--
Best regards,


Pavel Maslov, MS
Controls Engineer at Pulsed power Lab
Efremov Institute for Electro-Physical Apparatus
St. Petersburg, Russia

Mobile: +7 (951) 672 22 19
Landline: +7 (812) 461 01 01


Replies:
Re: [CA][waveform] how to NELM? Pavel Masloff
References:
[CA][waveform] how to NELM? Pavel Masloff
RE: [CA][waveform] how to NELM? Mark Rivers
Re: [CA][waveform] how to NELM? Pavel Masloff

Navigate by Date:
Prev: Re: [CA][waveform] how to NELM? Pavel Masloff
Next: 'reconnect' in asyn / streamDevice Emmanuel Mayssat
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: [CA][waveform] how to NELM? Pavel Masloff
Next: Re: [CA][waveform] how to NELM? Pavel Masloff
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·