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
- Replies:
- RE: stream device string/hex parsing peter.owens
- Navigate by Date:
- Prev:
Re: Problems when download synApps IOC Tim Mooney
- Next:
Re: Problems when download synApps IOC Dohn Arms
- 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: Problem in seq-2.1.8 Andrew Johnson
- Next:
RE: stream device string/hex parsing peter.owens
- 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
|