EPICS Controls Argonne National Laboratory

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  2013  2014  2015  2016  2017  <20182019  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  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Parsing problem with stream
From: Florian Feldbauer <[email protected]>
To: "Lucock, Richard M" <[email protected]>, [email protected]
Date: Mon, 4 Jun 2018 16:51:22 +0200

Hey Richard,

I actually do not know, why your second solution is not working. I have a device with a similar protocol where I use this approach and it works.

Anyhow. You could use your first solution, but exclude the ACK from the checksum with the width/precision flags. From the documentation:

> The width field is the byte number from which to start calculating the checksum. Default is 0, i.e. the first byte of the input or output of the current command. The last byte is precision bytes before the checksum (default 0). For example in "abcdefg%<xor>" the checksum is calculated from abcdefg, but in "abcdefg%2.1<xor>" only from cdef

So in your case you could use:

in ACK, STX, "001 f%[^\003]", ETX, "%1<xor8ff>";


Hope this helps!

Florian


On 06/04/2018 04:30 PM, Lucock, Richard M wrote:
Hi,

    I am having problems parsing data from a serial device (ie
obtained using asyn & stream). The normal protocol is to send a
message (with checksum), wait for an ACK character, then read the
reply (which has a checksum).

If I read the ACK and the reply on one line, using the protocol below:

   read_version {
      out STX, "001?f" ETX, "%<xor8ff>";
      in ACK, STX, "001 f%[^\003]", ETX, "%<xor8ff>";
   }


then I get the correct data into my 'stringin' record, but the shell
reports that the checksum is wrong (presumably because the ACK has
been included in the calculation). If I separate out the ACK and the
reply inputs:

   read_version {
      out STX, "001?f" ETX, "%<xor8ff>";
      in ACK;
      in STX, "001 f%[^\003]", ETX, "%<xor8ff>";
   }

then the shell reports no errors, but nothing is placed in my
'stringin' record.

The messages have no terminators, which I guess is part of the
problem. I have tried playing about with 'extrainput', 'maxinput' and
'wait', with no luck. Does anyone have any suggestions for dealing
with this ?

Thanks,
    Richard

-- 
----------------------------------------
| Dr. Florian Feldbauer                |
|                                      |
| Ruhr-Universität Bochum              |
| Experimentalphysik I AG              |
| Universitätsstr 150                  |
| D-44801 Bochum                       |
|                                      |
| Office: NB 2/134                     |
| Phone:  (+49)234 / 32-23563          |
----------------------------------------

References:
Parsing problem with stream Lucock, Richard M

Navigate by Date:
Prev: Re: Parsing problem with stream Dirk Zimoch
Next: Re: Linkam T96 System Controller Kevin Peterson
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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Parsing problem with stream Lucock, Richard M
Next: MVME3100 FPU Support on RTEMS 4.10.2 Matt Rippa
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  <20182019  2020  2021  2022  2023  2024 
ANJ, 06 Jun 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·