Experimental Physics and Industrial Control System
Hello,
This is probably really an elementary question, but we have been
trying to interface an RS-232 device to EPICS soft IOC on Linux. We
are using EPICS 3.14.8.2 with Asyn 4.6 (devGpib) via serial port. The
response from the device looks like this:
1+32.23
2-50.01
3+23.98
...
...
It has five channels, reads one value a second, contiunally sending
the message through the serial port (that seems to be a typical thing
here at STAR/BNL).
We need to have the data sorted into five different PVs, based upon
the channel names. In the end, the example above should look like
this:
channel 1: 32.23
channel 2: -50.01
channel 3: 23.98
Because we need the channel number and the + or - sign in the raw
data, I am taking the data into the IOC as string, having the
sequencer split the channel number, based upon that, we are trying to
put the value into the database.
Well, so far, we have not been successful in writing the sequencer
code. To the best of my knowledge, the sequencer cannot manipulat
text strings, we are escaping all of that to C within the sequencer
code, but we are getting a number of errors upon make.
Here is the error message we are getting:
make[3]: Entering directory
`/home/sysuser/epics3.14.8.2/hygrometerApp/hygrometerApp/src/O.linux-x86'
/usr/bin/gcc -c -D_POSIX_C_SOURCE=199506L -D_POSIX_THREADS
-D_XOPEN_SOURCE=500 -D_X86_ -DUNIX -D_BSD_SOURCE -Dlinux
-D_REENTRANT -ansi -O3 -Wall -g -I. -I..
-I../../../include/os/Linux -I../../../include
-I/home/sysuser/epics3.14.8.2/base-3.14.8.2/../modules/soft/seq-2.0.11/include/os/Linux
-I/home/sysuser/epics3.14.8.2/base-3.14.8.2/../modules/soft/seq-2.0.11/include
-I/home/sysuser/epics3.14.8.2/base-3.14.8.2/include/os/Linux
-I/home/sysuser/epics3.14.8.2/base-3.14.8.2/include
-I/home/sysuser/epics3.14.8.2/modules/soft/asyn/4-6/include/os/Linux
-I/home/sysuser/epics3.14.8.2/modules/soft/asyn/4-6/include
sncProgram.c
../sncExample.stt:34: warning: type defaults to `int' in declaration of `rob'
../sncExample.stt:34: conflicting types for `rob'
../sncExample.stt:9: previous declaration of `rob'
../sncExample.stt:35: `roba' undeclared here (not in a function)
../sncExample.stt:35: syntax error before "v"
../sncExample.stt:36: warning: type defaults to `int' in declaration of `wa1'
../sncExample.stt:36: conflicting types for `wa1'
../sncExample.stt:29: previous declaration of `wa1'
../sncExample.stt:36: braced-group within expression allowed only
inside a function
../sncExample.stt:36: syntax error before string constant
../sncExample.stt:37: warning: type defaults to `int' in declaration of `z'
../sncExample.stt:37: initializer element is not constant
../sncExample.stt:37: warning: data definition has no type or storage class
make[3]: *** [sncProgram.o] Error 1
make[3]: Leaving directory
`/home/sysuser/epics3.14.8.2/hygrometerApp/hygrometerApp/src/O.linux-x86'
and here is the code:
program snchygrometer
%%#include <ctype.h>
%%#include <stdlib.h>
%%#include <stdio.h>
%%char rob[10] ;
char *roba;
assign roba to "rawdata" ;
monitor roba ;
float ch1 ;
float ch2 ;
float ch3 ;
float ch4 ;
float ch5 ;
assign ch1 to "PV1";
assign ch2 to "PV2";
assign ch3 to "PV3";
assign ch4 to "PV4";
assign ch5 to "PV5";
int v ;
float z ;
%%extern char *wa1 ;
%%char *sign="+-" ;
%{
rob=&roba
v=rob[0]; /*Get first char from string*/
wa1=strpbrk(rob, "+-"); /*Break string at +-,rest is wa1*/
z=(float)wa1; /*convert string to float z*/
}%
ss ss1 {
state state1 {
when ( v==1) {
ch1 = z; pvPut(ch1);
} state state2
}
state state2 {
when ( v==2) {
ch2 = z; pvPut(ch2);
} state state3
}
state state3 {
when ( v==3) {
ch3 = z; pvPut(ch3);
} state state4
}
state state4 {
when ( v==4) {
ch4 = z; pvPut(ch4);
} state state5
}
state state5 {
when ( v==5) {
ch5 = z; pvPut(ch5);
} state state1
}
}
What are we doing wrong?? The C code embedded in the sequencer code
above compiles without any issues under gcc. Being new to
sequencer/state notation language, we are lost here...
- Replies:
- Re: Sequencer embedded C code question Jiro Fujita
- Re: Sequencer embedded C code question Maren Purves
- Re: Sequencer embedded C code question Tim Mooney
- Re: Sequencer embedded C code question Dirk Zimoch
- Navigate by Date:
- Prev:
multiple definition error when compiling base 3.14 marco_hair
- Next:
Re: Sequencer embedded C code question Jiro Fujita
- 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
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
multiple definition error when compiling base 3.14 marco_hair
- Next:
Re: Sequencer embedded C code question Jiro Fujita
- 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
2021
2022
2023
2024