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

Subject: data format conversion
From: yincx--- via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk <tech-talk at aps.anl.gov>
Date: Fri, 21 Aug 2020 09:43:49 +0800
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 wishes
Chunxia Yin



Replies:
Re: data format conversion Florian Feldbauer via Tech-talk

Navigate by Date:
Prev: Re: Suggestion on LVDT? Makarov, Oleg A. via Tech-talk
Next: Re: data format conversion Florian Feldbauer via Tech-talk
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  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Suggestion on LVDT? Makarov, Oleg A. via Tech-talk
Next: Re: data format conversion Florian Feldbauer via Tech-talk
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  <20202021  2022  2023  2024 
ANJ, 21 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·