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  <20162017  2018  2019  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  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: StreamDevice: Flags and Checksum Pseudo-Converter Help
From: Kyle Hesse <[email protected]>
To: [email protected]
Date: Mon, 9 May 2016 15:44:10 -0400 (EDT)
Hello,

My name is Kyle, and I am working on an EPICS driver for an Agilent Technologies TwisTorr 304 Controller. Unfortunately, I have hit a bit of a roadblock in my protocol file, and I need a little nudge in the right direction. I am able to send the device commands and receive responses, but I am looking to automate the checksum process with some of the built in checksum converters. Could you please teach me how to use the converters and flags to ignore the first byte and compute the checksum of any given input and output? 


Below I have posted what I have written in my protocol file. I also wrote an explanation of how this device computes its checksum. 


The Checksum Calculation

#The MESSAGE is a string with the following format:

#<STX>+<ADDR>+<WIN>+<COM>+<DATA>+<ETX>+<CRC>

#<CRC> = XOR of all characters subsequent to <STX> and including the <ETX> terminator. The value is hexadecimal coded and indicated by two ASCII character.

# Example for Soft Start (ON) COMMAND
# <0x02>|<0x80>|<0x31><0x30><0x30>|<0x31>|<0x31>|<0x03>|<0x42><0x32>|
#   STX   | ADDR |              WINDOW        |  WR     |    ON  |   ETX   |           CRC       |

# Response for Soft Start (ON) COMMAND
# <0x02>|<0x80>|<0x06>|<0x03>|<0x38><0x35>|
#   STX    | ADDR |  ACK |  ETX    |         CRC        |

The bytes for the checksum begin with ADDR and end with EXT (inclusive). The resulting checksum is B2 in hex. It is indicated by two separate ASCII characters. 'B' = 42 and '2' = 32. This is for the Soft Start (ON) command. The same logic would apply to the response.

My Protocol File

Terminator = "";
ExtraInput = Ignore;
LockTimeout = 2000;
ReplyTimeout = 100;
WriteTimeout = 50;
ReadTimeout = 50;

#Requests and Answers

#Command that turns on the soft start function

softStartOn {
    out "\x02\x80\x31\x30\x30\x31\x31\x03\x42\x32";
    in "%s";
}

I would like to know how to use %<xor> properly in this command to calculate the checksum. My attempts are listed below:

\x02\x80\x31\x30\x30\x31\x31\x03\%<xor>

\x02\x80\x31\x30\x30\x31\x31\x03\%1.1<xor>

\x02\x80\x31\x30\x30\x31\x31\x03\%2r<xor>

\x02\x80\x31\x30\x30\x31\x31\x03\%2R<xor>

\x02\x80\x31\x30\x30\x31\x31\x03\%xor

\x02\x80\x31\x30\x30\x31\x31\x03\%1.12R<xor>

\x02\x80\x31\x30\x30\x31\x31\x03\%2r%<xor>

The response to the command is 02 80 06 85 (an ACK). My attempts leave me with 02 80 15 96 (a NACK). I am using this example as a means of debugging.

Thank you for your help,

Kyle


Replies:
Re: StreamDevice: Flags and Checksum Pseudo-Converter Help Dirk Zimoch

Navigate by Date:
Prev: version of base and extension l123173
Next: Re: version of base and extension Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: version of base and extension Andrew Johnson
Next: Re: StreamDevice: Flags and Checksum Pseudo-Converter Help Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 15 Jul 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·