Experimental Physics and Industrial Control System
Have you set
extrainput = Ignore;
In your protocol file?
Even so a better strategy would be to use redirection:
record (ai, "G2:ADC16-TEST_CH0")
{
field (DESC, "ADC0")
field (DTYP, "stream")
field (INP, "@adc16.proto getADCs(G2:ADC16-TEST) ADC16_1")
field (SCAN, "5 Second")
field (FLNK, "G2:ADC16-TEST_CH1")
}
record (ai, "G2:ADC16-TEST_CH1")
{
field (DESC, "ADC1")
field (FLNK, "G2:ADC16-TEST_CH2")
}
---
getADCs {
out ":0400000008..%<checksum>";
in ":0410%4x%(\$1_CH1.VAL)4x%(\$1_CH2.VAL)4x%(\$1_CH3.VAL)4x%(\$1_CH4.VAL)4x%(\$1_CH5.VAL)4x%(\$1_CH6.VAL)4x%(\$1_CH7.VAL)%<checksum>";
}
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gerrit Kühn
Sent: 09 July 2012 16:50
To: [email protected]
Subject: stream device string/hex parsing
Hi all,
I have set up stream device to talk to an ADC converter via rs232. The
records and protocols look like this:
---
record (stringin, "G2:ADC16-TEST")
{
field (DESC, "answer string")
field (DTYP, "stream")
field (INP, "@adc16.proto getData ADC16_1")
field (SCAN, "5 second")
}
record (ai, "G2:ADC16-TEST_CH0")
{
field (DESC, "ADC0")
field (DTYP, "stream")
field (INP, "@adc16.proto getADC0 ADC16_1")
field (SCAN, "I/O Intr")
}
[...] 8 adc channels
---
---
Terminator = CR LF;
getData {
out ":0400000008..";
in "%41c";
}
getADC0 {
in "%*5c%4x";
}
[...] 8 adc channels
---
I get the full answer string from the device into the first record. It looks like this:
---
pt@pt-steward ~ $ caget G2:ADC16-TEST
G2:ADC16-TEST :041000000000000000000000000000000000EC
---
The string needs to be parsed into numerals. The first 5 characters (command string) are not needed, neither the last two (checksum).
The remaining characters need to be processed in groups of 4 (16 bit per channel) and parsed from hex. This is what I intend to do with
in "%*5c%4x";
for the first channel. The next channel would skip 9 characters, the next 13 and so on.
However, this does not appear to work out. Everything works fine when I change the records to "stringin" type and parse for "%*5c%4c" instead. But parsing hex into ai never yields a single value.
Any ideas why this does not work, and how I can be made work?
cu
Gerrit
--
Scanned by iCritical.
- Replies:
- Re: stream device string/hex parsing Gerrit Kühn
- References:
- stream device string/hex parsing Gerrit Kühn
- Navigate by Date:
- Prev:
EPICS channel access performance test tanushyam bhattacharjee
- Next:
New version of LabVIEW-EPICS-interface CA Lab Carsten Winkler
- 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:
stream device string/hex parsing Gerrit Kühn
- Next:
Re: stream device string/hex parsing Gerrit Kühn
- 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