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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: data format conversion |
From: | Florian Feldbauer via Tech-talk <tech-talk at aps.anl.gov> |
To: | "yincx at ihep.ac.cn" <yincx at ihep.ac.cn>, tech-talk <tech-talk at aps.anl.gov> |
Date: | Fri, 21 Aug 2020 17:00:00 +0200 |
Hey Chunxia,
you could try the following:
Without quotes, the variable is assumend to be the decimal value of one byte, so it will send one byte with value '9' to your device, just like "\x09" would do.
HTH,
Florian
Hello everyone,I am using the stream device to gat data from a device, and have a problem about format conbersion. I hope to get some advice and will appreciate for your help.I want to send data, such as "09", in hexademical format to the device. the device will return a float data %f.
Statements in the db file:recorrd(ai, "$(P)$(R)read"){field(DESC, "read pressure")field(DTYP, "stream")field(INP, "@pressure.proto SendCommand(09) $(PORT)")field(SCAN, "1 second")}
Statements in the protocol file is like this:
SendCommand{out "\x\$1";in "%f";}
when I run the st.cmd, an error occurs:Hex digit expected after \x: "\X""
if "09" is send directly, not as a variable "\$1":SendCommand{out "\x09";in "%f";}
everything goes well and I can get the returned %f correctly.
I wonder how can I send "09" as a variable? How to change a variable in the record to be hexadecimal?
Thank you very much for any advice, I will try it and give feedback.
Bset wishesChunxia Yin
-- Ruhr-Universität Bochum AG der Experimentalphysik I Dr. Florian Feldbauer NB 2/131 / Fach 125 Universitätsstr. 150 D-44801 Bochum Office: NB 2/134 Phone: (+49)234 / 32-23563 Fax: (+49)234 / 32-14170 https://paluma.ruhr-uni-bochum.de