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  <20142015  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  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Accessing SNL Function and global Pvs from C
From: Ganesh Jangir <[email protected]>
To: [email protected]
Date: Mon, 24 Feb 2014 22:45:19 +0530
Dear All,


Facing problem in calling/accessing SNL Function and global Pvs from C.

Here is the example I tried.

_________________________________________________________________


program cmcseq


string CMC_STATUS;

assign CMC_STATUS to "CMC_STATUS";


foreign ssId;


// No monitoring

// No options

....


ss ss1 {

state initial{

when(delay(5)){

printf("Calling cmcStatus... \n");

cmcStatus(ssId,"Hello",pvIndex(CMC_STATUS));

printf("Received status is %s\n", CMC_STATUS);

}state default

}

....

}


C Function is

%%#include <stdio.h>

%%#include <string.h>

%%#include <stdlib.h>

%{

void cmcStatus(SS_ID ssId,string msg, VAR_ID pvCmcStatus) {

strcpy(pvCmcStatus,msg);

seq_pvPut(ssId,pvCmcStatus, ASYNC);

}

}%


During Make Warnings are

;

^

../cmcseq.stt:49:4: warning: implicit declaration of function ‘cmcStatus’ [-Wimplicit-function-declaration]

cmcStatus("ss1","Hello",CMC_STATUS);

^

.

.

.

../cmcseq.stt:149:6: warning: conflicting types for ‘cmcStatus’ [enabled by default]

void cmcStatus(SS_ID ssId,string msg, VAR_ID pvCmcStatus) {

^

../cmcseq.stt:49:4: note: previous implicit declaration of ‘cmcStatus’ was here

cmcStatus("ss1","Hello",CMC_STATUS);

^

../cmcseq.stt: In function ‘cmcStatus’:

../cmcseq.stt:151:3: warning: passing argument 1 of ‘strcpy’ makes pointer from integer without a cast [enabled by default]

strcpy(pvCmcStatus,msg);

^ printf("checking if all are connected USE pvConnecetd Count Function, Wait UNTIL lISTED PVS are c printf("checking if all are connected USE pvConnecetd Count Function, Wait UNTIL lISTED PVS are connected \n");

/* configure(&seq,&version);

printf("Read Configuration parameter here, Calling File Read function %d %f \n", seq, version);

*/onnected \n");

/* configure(&seq,&version);

printf("Read Configuration parameter here, Calling File Read function %d %f \n", seq, version);

*/

In file included from cmcseq.c:4:0:

/usr/include/string.h:125:14: note: expected ‘char * __restrict__’ but argument is of type ‘VAR_ID’

extern char *strcpy (char *__restrict __dest, const char *__restrict __src)

^

/usr/bin/ar -rc libCMC_SEQSupport.a initTrace.o cmcseq.o

/usr/bin/ranlib libCMC_SEQSupport.a



The error during run time is .

seq cmcseq,

Sequencer release 2.1.16, compiled Sat Feb 22 20:11:22 2014

Spawning sequencer program "cmcseq", thread 0xd939e0: "cmcseq"

cmcseq[0]: all channels connected & received 1st monitor

epics> Calling cmcStatus...

Segmentation fault (core dumped)




Also, Where can I found sequencer Examples /tutorial, for accessing SNL_Function and Pvs in C. I am referring to Sequencer User Guide 2.1.16,already.


Thanks and Regards

Ganesh Jangir

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you


Replies:
Re: Accessing SNL Function and global Pvs from C Benjamin Franksen

Navigate by Date:
Prev: Re: Waveform record I/O interrupt. asyn Andrew Johnson
Next: Error in building epics base-3.15.0.1 on windows XP (32 bit) using mingw Anindya Roy
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  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: procServ softIOC server - V2.6.0 released Bruce Hill
Next: Re: Accessing SNL Function and global Pvs from C Benjamin Franksen
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  2020  2021  2022  2023  2024 
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 ·