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