Hi Kyle,
%01<xor>
The 0 says: convert to ASCII
The 1 says: ignore first byte
Dirk
On 09.05.2016 21:44, Kyle Hesse wrote:
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 touse 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
- References:
- StreamDevice: Flags and Checksum Pseudo-Converter Help Kyle Hesse
- Navigate by Date:
- Prev:
EPICS support with NI-Daqmx Ana Malagon
- Next:
RE: EPICS support with NI-Daqmx Heesterman, Peter J
- 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:
StreamDevice: Flags and Checksum Pseudo-Converter Help Kyle Hesse
- Next:
EPICS support with NI-Daqmx Ana Malagon
- 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
|