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  2020  2021  2022  2023  2024  2025  <2026 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  <2026
<== Date ==> <== Thread ==>

Subject: Re: Device support for Inficon SQM-160
From: Laurenz Rettig via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Tue, 6 Jan 2026 07:54:01 +0100

Hi Feng,

I have implemented a partial stream device support for this once, see attached, but mostly for fixed length fields, as it seems. I hope this helps.

Best, Laurenz

Am 06.01.2026 um 07:47 schrieb LONG FENG via Tech-talk:
Hi all,
Has anyone here tried using StreamDevice to control the SQM-160? While writing the control program, I couldn’t figure out how to determine the “Length” in its communication protocol. If anyone has written a similar program, could you share some insights or give me a bit of inspiration?
Its protocol format is shown in the figure below.

image.png

Feng
-- 
Prof. Dr. Laurenz Rettig
Fritz Haber Institute of the Max Planck Society
Department of Physical Chemistry
Dynamics of Correlated Materials
Faradayweg 4-6
14195 Berlin, Germany

phone: +49-(0)30-8413 5225
email: rettig at fhi-berlin.mpg.de
##########################################################################
# This is an example and debug protocol file for StreamDevice.
#
# (C) 2010 Dirk Zimoch (dirk.zimoch at psi.ch)
#
# This file is part of StreamDevice.
#
# StreamDevice is free software: You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# StreamDevice is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
#########################################################################/

#terminator = CR LF;
Terminator = ;
#OutTerminator = CR LF;
#InTerminator = CR LF;

SYNC = "!";


get_rate1 {
    LEN = 0x24; CMD = "L1"; CRC1 = 0x66; CRC2 = 0x32;
    out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    in $SYNC, "\?A", "% f", " \?\?";
}

get_thickness1 {
    LEN = 0x24; CMD = "N1"; CRC1 = 0x5D; CRC2 = 0x51;
    out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    in $SYNC, "\?A", "% f", " \?\?";
}

get_frequency1 {
    LEN = 0x24; CMD = "P1"; CRC1 = 0x5A; CRC2 = 0x91;
    out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    in $SYNC, "\?A", "%11f", "\?\?";
}

get_shutter {
    LEN = 0x24; CMD = "U?"; CRC1 = 0x5B; CRC2 = 0x54;
    out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    in $SYNC, "\?A", "%!1d", "\?\?";
}

get_filmParameters {
    LEN = 0x25; CMD = "A1?"; CRC1 = 0x2E; CRC2 = 0x95;
    out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    #in $SYNC, "\?A", "%#s%", , "%(\$1.VAL)f", "*f", "%(\$2.VAL)f", "%*f", "%*f", "%*d". "%*d", "\?\?";
    in $SYNC, "\?A", "%#8s %(\$1.VAL)f %(\$2.VAL)d %(\$3.VAL)f %*f %*f %*d %*d\?\?";
}

set_zero {
    LEN = 0x23; CMD = "S"; CRC1 = 0x8E; CRC2 = 0x8F;
    out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    in $SYNC, "\?A", "\?\?";
    #LEN = 0x23; CMD = "T"; CRC1 = 0x4F; CRC2 = 0x35;
    #out $SYNC, $LEN, $CMD, $CRC1, $CRC2;
    #in $SYNC, "\?A", "\?\?";
}

##########################################################################
# This is an example and debug EPICS database for StreamDevice.
#
# (C) 2010 Dirk Zimoch (dirk.zimoch at psi.ch)
#
# This file is part of StreamDevice.
#
# StreamDevice is free software: You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# StreamDevice is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with StreamDevice. If not, see https://www.gnu.org/licenses/.
#########################################################################/

record (ai, "$(NAME):Rate")
{
    field (DTYP, "stream")
    field (INP,  "@$(PTCOLS) get_rate1 $(PORT)")
    field (EGU, "Ang/s")
    field (SCAN, "1 second")
    field (FLNK, "$(NAME):Thickness_")
}

record (ai, "$(NAME):Thickness_")
{
    field (DTYP, "stream")
    field (INP,  "@$(PTCOLS) get_thickness1 $(PORT)")
    field (EGU, "Ang")
    field (SCAN, "Passive")
    field (FLNK, "$(NAME):Frequency")
}

record (ai, "$(NAME):Frequency")
{
    field (DTYP, "stream")
    field (INP,  "@$(PTCOLS) get_frequency1 $(PORT)")
    field (EGU, "Hz")
    field (SCAN, "Passive")
    field (FLNK, "$(NAME):Shutter_RBV")
}

record (ai, "$(NAME):Shutter_RBV")
{
    field (DTYP, "stream")
    field (INP,  "@$(PTCOLS) get_shutter $(PORT)")
    field (SCAN, "Passive")
    field (FLNK, "$(NAME):Film")
}

record (ai, "$(NAME):Density")
{
    field (EGU, "g/cm^3")
    field (SCAN, "Passive")
}

record (ai, "$(NAME):ToolingFactor")
{
    field (EGU, "%")
    field (SCAN, "Passive")
}

record (ai, "$(NAME):Z-ratio")
{
    #field (EGU, "g/cm^3)
    field (SCAN, "Passive")
}

record (stringin, "$(NAME):Film")
{
    field (DTYP, "stream")
    field (INP,  "@$(PTCOLS) get_filmParameters($(NAME):Density, $(NAME):ToolingFactor, $(NAME):Z-ratio) $(PORT)")
    field (SCAN, "Passive")
    field (FLNK, "$(NAME):MeanRate")
}

record (bo, "$(NAME):Zero")
{
    field (DTYP, "stream")
    field (OUT,  "@$(PTCOLS) set_zero $(PORT)")
    field (FLNK, "$(NAME):ThicknessRawOff")
}

record (ai, "$(NAME):_starttime")
{
    field (DTYP, "Soft Timestamp")
    field (TSEL, "$(NAME):Zero.TIME")
}

record (ai, "$(NAME):_currtime")
{
    field (DTYP, "Soft Timestamp")
    field (TSEL, "$(NAME):Thickness.TIME")
}

record (calc, "$(NAME):_K1")
{
    #field (EGU, "Ang")
    field (INPA, "$(NAME):Density")
    field (INPB, "$(NAME):Z-ratio")
    field (INPC, "$(NAME):ToolingFactor")
    field (CALC, "C/100*1.668E13*2.648/(PI*A*B)")
}

record (calc, "$(NAME):_K2")
{
    #field (EGU, "Ang")
    field (CALC, "PI/(6E6+5E4)")
}

record (ai, "$(NAME):ThicknessRawOff")
{
    field (EGU, "Ang")
    field (INP, "$(NAME):ThicknessRaw.VAL")
    field (SCAN, "Passive")
}

record (calc, "$(NAME):ThicknessRaw")
{
    field (EGU, "Ang")
    field (PREC, "5") 
    field (INPA, "$(NAME):Frequency")
    field (INPB, "$(NAME):ThicknessRawOff")
    field (INPC, "$(NAME):Z-ratio")
    field (INPD, "$(NAME):_K1 PP MS")
    field (INPE, "$(NAME):_K2 PP MS")
    field (CALC, "ATAN(C*TAN(PI-E*A))*D/A")
    field (FLNK, "$(NAME):Thickness")
}

record (calc, "$(NAME):Thickness")
{
    field (EGU, "Ang")
    field (PREC, "5")
    field (INPA, "$(NAME):ThicknessRaw")
    field (INPB, "$(NAME):ThicknessRawOff")
    field (CALC, "A-B")
}

record (calc, "$(NAME):Runtime")
{
    field (EGU, "s")
    field (INPA, "$(NAME):_starttime PP MS")
    field (INPB, "$(NAME):_currtime PP MS")
    field (CALC, "B-A")
}

record (calc, "$(NAME):MeanRate")
{
    field (EGU, "Ang/s")
    field (INPA, "$(NAME):Thickness")
    field (INPB, "$(NAME):Runtime PP MS")
    field (CALC, "A/B")
    field (FLNK, "$(NAME):ThicknessRaw")
}

Attachment: smime.p7s
Description: Kryptografische S/MIME-Signatur


References:
Device support for Inficon SQM-160 LONG FENG via Tech-talk

Navigate by Date:
Prev: Device support for Inficon SQM-160 LONG FENG via Tech-talk
Next: NDPluginFile question Jörn Dreyer 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  <2026
Navigate by Thread:
Prev: Device support for Inficon SQM-160 LONG FENG via Tech-talk
Next: NDPluginFile question Jörn Dreyer 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  <2026
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·