Florian Feldbauer wrote:
Hi,
you can use the redirection mechanism of streamdevice.
Just configure your ai1 record to use stream as DTYP and the protocol as
input:
record (ai "ai1") {
field (DTYP, "stream")
field (INP, "@myDev.proto getMsg dev1")
field (SCAN, "I/O Intr")
}
Your protocol would look like this:
getMsg {
in "*05CC%d#*05DD%(ai2.VAL)d#*05EE%(ai3.VAL)#"
}
There is a "d" missing near the end ;-). But otherwise I would do the
same: in "*05CC%d#*05DD%(ai2.VAL)d#*05EE%(ai3.VAL)d#";
Keep in mind that with redirection, the other two records ai2 an ai3 are
processed by ai1. Thus do not set SCAN, DTYP or INP for them. Except if
you want to scale the values from integer to floating point. Then
redirect to .RVAL instead and use DTYP="Raw Soft Channel" and
LINR="Linear" in those records and set ESLO according to your needs.
If you need to FLNK from these record to anything else, put the FLNK
into ai1, because it will finish processing last and then all three
records are guaranteed to have values.
The other alternative is not to use redirection and make all three
records "I/O Intr". Then each record would use read its part of the
message (in no particular order) and ignore the other values (with %*):
getData1 { in "*05CC%d#*05DD%*d#*05EE%*d#"; }
getData2 { in "*05CC%*d#*05DD%d#*05EE%*d#"; }
getData3 { in "*05CC%*d#*05DD%*d#*05EE%d#"; }
BTW, with "I/O Intr", StreamDevice has to poll for new input. Make sure
that PollPeriod is short enough in order not to have a too long delay
between the message and processing the record. The default value for
PollPeriod is ReplyTimeout and the default value for ReplyTimeout is 1
second. I usually choose approximately 1/10 of the expected send period
of the device. A too short PollPeriod wastes CPU time.
Dirk
I'm not sure though if one should define the length for the format
converters here?
Why? There is a # after the number that terminates the %d converter.
Best regards,
Florian
Am 17.05.2012 07:15, schrieb Silver:
hi, all:
If the device send a string to IOC automaticlly, the data is like
"*05CC1234#*05DD5678#*05EE1345#". I have three ai records as ai1,ai2,ai3.
I want to get "1234" of "*05CC1234#" to ai1, "5678" of "*05DD5678#" to
ai2, "1345" of "*05EE1345#" to ai3, how can I implement it?
thanks a lot in advance.
Best regards
Geyang 2012-05-17
- References:
- stream device driver parse question Silver
- Re: stream device driver parse question Florian Feldbauer
- Navigate by Date:
- Prev:
Re: cPCI express Urša Rojec
- Next:
Re: CSS build with Eclipse RCP-3.7 and -pluginCustomization Kasemir, Kay
- 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:
Re: stream device driver parse question Florian Feldbauer
- Next:
Re: stream device driver parse question Rod Nussbaumer
- 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
|