Experimental Physics and
| |||||||||||||||||
|
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]> wrote: You can just do a ca_get of record.NELM. -- 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
| ||||||||||||||||
ANJ, 18 Nov 2013 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |