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  <20122013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: stream device string/hex parsing
From: Gerrit Kühn <gerrit.kuehn@aei.mpg.de>
To: Dirk Zimoch <dirk.zimoch@psi.ch>
Cc: peter.owens@stfc.ac.uk, tech-talk@aps.anl.gov
Date: Fri, 27 Jul 2012 10:51:11 +0200
On Thu, 26 Jul 2012 17:55:55 +0200 Dirk Zimoch <dirk.zimoch@psi.ch> wrote
about Re: stream device string/hex parsing:

Hello Dirk,

DZ> I would not use extrainput=Ignore except when absolutely necessary, 
DZ> because this may hide some errors with incomplete input strings (e.g. 
DZ> because of bad connections).
DZ> 
DZ> Better ignore a known number of digits after your payload like
DZ> %*5c%4x%*30x

Thanks for the hint. I have changed to a pattern like this now (without
ignoring extra input):

---
# set block 0: 00000000
out ":0600020000..";
in "%*s";
# sample block 0
out ":0400000008..";   
in ":0410%4x%(\$1_B00_FRONT_LEFT_I_NEG.VAL)4x%(\
$1_B00_FRONT_LEFT_U_POS.VAL)4x%(\$1_B00_FRONT_LEFT_I_POS.VAL)4x%(\
$1_B00_FRONT_RIGHT_U_NEG.VAL)4x%(\$1_B00_FRONT_RIGHT_I_NEG.VAL)4x%(\
$1_B00_FRONT_RIGHT_U_POS.VAL)4x%(\$1_B00_FRONT_RIGHT_I_POS.VAL)4x%*2c"; 
---


First I set digital outputs to drive an external multiplexer, then I read
8 AD channels and parse the answer into channels. This is then repeated
for other multiplexer settings (and different channel names). Appear to
work fine now.

DZ> Even better do not ignore the checksum but check it. What is the 
DZ> checksum algorithm? (sum of all bytes)&0xff as 2 hex digits? See the %
DZ> <> formats.

I did not yet look into the checksumming at all. For sending commands, the
".." can be used to turn crc off, for receiving, I use the %*2c now to
ignore them.
The documentation says the packet LRC is the two's complement of the sum
over the packet's parameter and command bytes. Each binary data byte is
transmitted as two hex digits which have to be transformed into binary
form before adding them. So, looking at the available checksum algorithms,
this calls for something like %<neghexsum8>, which does not exist...


cu
  Gerrit

Replies:
Re: stream device string/hex parsing Dirk Zimoch
References:
stream device string/hex parsing Gerrit Kühn
RE: stream device string/hex parsing peter.owens
Re: stream device string/hex parsing Gerrit Kühn
Re: stream device string/hex parsing Dirk Zimoch

Navigate by Date:
Prev: Re: VMware : won't allow cagets Mogamad Amien Crombie
Next: EPICS and EtherChannel Shalafi
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: stream device string/hex parsing Dirk Zimoch
Next: Re: stream device string/hex parsing Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·