EPICS Home

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

Subject: Re: How to Read Multiple Values using StreamDevice with array_in
From: Dirk Zimoch <[email protected]>
To: [email protected]
Date: Mon, 07 Oct 2013 10:18:31 +0200
Hello Yasemin

On 07.10.2013 10:03, Yasemin Barutçu wrote:
Hello,

I have a self-produced thermocouple and I connect to this device by RS 232.
I want to read 6 different integers when I send "MEASC" command to the
device.

in thermo.proto file, if I define %s, I can read all data by stringin.

MEASC{
     out "MEASC";
     in "%s";
}

Example:
2013/10/07 10:59:53.633 192.168.1.198:9001 <http://192.168.1.198:9001>
write 6
MEASC\n
2013/10/07 10:59:53.647 192.168.1.198:9001 <http://192.168.1.198:9001>
read 8
029 030 029 028 028 028


But I want to take all 6 datas in integer format. I search the
streamdevice documentation and I found the following line.

There several possibilities to do this.


MEASC{
     out "MEASC";
     array_in {separator=" "; in "%d";}
}

But it doesn't work. I got the following error.

No that does not work. What you wanted to do is:
MEASC{
    separator=" ";
    out "MEASC";
    in "%d";
}


But then you get an array of 6 values. Maybe you want to have the 6 values in separate records. You can do this using redirected input:

MEASC{
    out "MEASC";
in "%d %(\1:TEMP2)d %(\1:TEMP3)d %(\1:TEMP4)d %(\1:TEMP5)d %(\1:TEMP6)d";
}

Called from a record like this:
record (ai, "$(P):TEMP1") {
    field (DTYP, "stream)
    field (INP,  "@thermo.proto MEASC($(P)) $(PORT)")
}

And 5 passive records like this:
record (ai, "$(P):TEMP2") {
}
record (ai, "$(P):TEMP3") {
}
record (ai, "$(P):TEMP4") {
}
record (ai, "$(P):TEMP5") {
}
record (ai, "$(P):TEMP5") {
}

Note that the 5 passive records have no "stream" support (in fact they use "Soft Channel" or if you wish you can use "Raw Soft Channel").

Dirk




References:
How to Read Multiple Values using StreamDevice with array_in Yasemin Barutçu

Navigate by Date:
Prev: How to Read Multiple Values using StreamDevice with array_in Yasemin Barutçu
Next: Base building problem on Win7 (both MinGW and VS 2012 Express) Koponen Jukka
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: How to Read Multiple Values using StreamDevice with array_in Yasemin Barutçu
Next: How to Read Multiple Values using StreamDevice with array_in Yasemin Barutçu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024