EPICS Home

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  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: Streams format converters question ( how to convert 10100 to 1.0E+00, 10011 to 1.0E-11)
From: Peter Sx via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Cc: sxin at bnl.gov
Date: Thu, 27 Mar 2025 09:53:39 -0400
Hi EPICS Specialists:

I've run into a problem converting data to exponential readings. I have a device that outputs messages and data in the same channel. I have separated the readings from messages with data by using the following records and protocol. 
I am wondering whether I can add some arguments in the protocol and convert the data through calcout, but I am new to Streams and can't figure out the details.

Data format:  ppsee (p.p * 10see):
Symbols   Description
pp        Mantissa of the reading (1.0 to 9.9)
s         Sign of the exponent (0 = negative, 1 = positive)
ee        Exponent (00 to 11)

record(ai, "$(Sys)$(Dev)Ch1_Reading")
{
    field(DESC, "Ch1 Reading")
    field(DTYP, "stream")
    field(INP, "@Televac.proto get_Ch1_reading($(Sys)$(Dev)Ch1message) $(PORT)")
    field(SCAN, ".1 second")
}
record(stringin, "$(Sys)$(Dev)Ch1message")
{
}

get_Ch1_reading {
    out "S101";
    in "%f";
    @mismatch {in "%(\$1)39c";}
}

Current channel readback examples:
[sxin@eic-905-pc01 ~]$ caget 905-HC1-Televac:Ch5_Reading    device panel reading 1.0E-11
905-HC1-Televac:Ch5_Reading    10011
[sxin@eic-905-pc01 ~]$ caget 905-HC1-Televac:Ch6message
905-HC1-Televac:Ch6message     OFF

Thank you!
Susheng

Replies:
RE: Streams format converters question ( how to convert 10100 to 1.0E+00, 10011 to 1.0E-11) Zimoch Dirk via Tech-talk

Navigate by Date:
Prev: Phoebus alarm server with Kafka 4.0 Paul Sichta via Tech-talk
Next: RE: Streams format converters question ( how to convert 10100 to 1.0E+00, 10011 to 1.0E-11) Zimoch Dirk 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  2020  2021  2022  2023  2024  <2025
Navigate by Thread:
Prev: Re: [EXTERNAL] Phoebus alarm server with Kafka 4.0 Kasemir, Kay via Tech-talk
Next: RE: Streams format converters question ( how to convert 10100 to 1.0E+00, 10011 to 1.0E-11) Zimoch Dirk 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  2020  2021  2022  2023  2024  <2025