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  <20132014  2015  2016  2017  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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re:Fwd: Re: decimal value convert to hex problem
From: [email protected]
To: "Ralph Lange" <[email protected]>
Cc: tech-talk <[email protected]>
Date: Fri, 29 Mar 2013 01:15:12 +0800 (CST)
Dear Lang,
The mail deliver system said the mail deliver failed, and I have not receive any reply.So I resend the letter again. But it says my mail deliver failed again. :(


在 2013-03-29 00:55:43,"Ralph Lange" <[email protected]> 写道:
I was writing this answer on tech-talk 7 hours ago....

~Ralph


-------- Original Message --------
Subject: Re: decimal value convert to hex problem
Date: Thu, 28 Mar 2013 10:22:52 +0100
From: Ralph Lange <[email protected]>
To: EPICS Tech Talk <[email protected]>


On Thu Mar 28 2013 09:54:21 GMT+0100 (CET), 张德敏 <[email protected]> wrote:
Dear all,
  I am trying to communicate a serial device using StreamDevice-2-3 on 32-bit Linux OS.  writting values using the following protocol:
      !Innn<cr>   (program mA demand. FFF=10mA, nnn must be 3 hexadecimal digits)
      Reading values using the following protocol:
     ?I<cr>  , and the response is ?Innn.  nnn represents the hexadecimal.
How can I convert decimal to hex when sending value ,and how can I convert hex to decimal when receiving value?
Thanks,
Demin zhang



Hello Demin,

Please refer to the StreamDevice doc that explains the formats [1].
There you will find that the %x and %X converters are converting LONG values from and to hexadecimal digits.

In addition to the hex encoding done by the format converters in StreamDevice, you will have to add Linear Conversion to the ai and ao records you use, converting engineering values (0...10) to raw values (0...4095) and vice versa. (ESLO=0.002442 and LINR=SLOPE should do that. See [2] for details.)

Hope this helps,
~Ralph


[1] http://epics.web.psi.ch/software/streamdevice/doc/formats.html
[2] https://wiki-ext.aps.anl.gov/epics/index.php/RRM_3-14_Analog_Output




Navigate by Date:
Prev: decimal value convert to hex problem 张德敏
Next: Arcnet question James F Ross
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: decimal value convert to hex problem 张德敏
Next: Arcnet question James F Ross
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·