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  <20172018  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  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Long string command to device
From: Dirk Zimoch <[email protected]>
To: <[email protected]>
Date: Mon, 13 Feb 2017 10:02:20 +0100
Hello Bo,

If using an INP link for output bothers you, you can also use the aao (analog array output) record.

Dirk


On 26.09.2016 14:08, Bo Jakobsen wrote:
Hi Mark

Thanks a lot, it now works

I had tried the NELM field, but did not realise that the strings
(naturally) needed to be handled specially
(both from caget/put and from labCA under Matlab).

Best
    Bo

On 2016-09-26 13:31, Mark Rivers wrote:
Hi Bo,

I definitely use waveform records that I set from channel access with
stream device support.  Here is an example if a record that I know works:

record(waveform,"$(P)$(R)UserWaveform") {
     field(DTYP, "stream")
     field(INP,  "@Tabor8024.proto setWaveform $(PORT) $(ADDR)")
     field(FTVL, "SHORT")
     field(NELM, "$(NELM)")
}

This one happens to have FTVL=SHORT, but that is not your problem.

I think I see 2 problems with what you have done:

- You have not set the NELM field in the waveform record, which
defaults to 1.  You should set NELM to the length of the longest
string you want to sent, plus 1 for the null terminator.  For example:

record(waveform, "$(P):RAW2") {
    field(DTYP, "stream")
    field(FTVL, "CHAR")
    field(DESC, "RAW waveform lakeshore record")
    field(NELM, "256")
    field(INP, "@Huginn.proto setRAWOUT $(PORT) $(ADDR)")
}

- You need to use the -S option on caput because you are sending a
string.

caput -S Huginn:RAW2 "A"

Let me know if that works.

Mark

________________________________________
From: Bo Jakobsen [[email protected]]
Sent: Monday, September 26, 2016 4:12 AM
To: [email protected]
Cc: Mark Rivers
Subject: Re: Long string command to device

I finally got a chance to test the suggested solutions.

I now have a record reading:

record(waveform, "$(P):RAW2") {
    field(DTYP, "stream")
    field(FTVL, "CHAR")
    field(DESC, "RAW waveform lakeshore record")
    field(INP, "@Huginn.proto setRAWOUT $(PORT) $(ADDR)")
}

however, when I try to send a value from caput I get the following error:

[labuser@localhost m-epics-Huginn]$  caput Huginn:RAW2 "A"
Old : Huginn:RAW2                    0
New : Huginn:RAW2                    0
CA.Client.Exception...............................................
      Warning: "Channel write request failed"
      Context: "op=1, channel=Huginn:RAW2, type=DBR_STRING, count=1,
ctx="Huginn:RAW2""
      Source File: ../oldChannelNotify.cpp line 160
      Current Time: Mon Sep 26 2016 10:52:43.487194595
..................................................................


It is consistent with the manual for waveform records which reads
"The values retrieved from the input link are placed in an array
referenced by VAL. (If the INP link is a constant, elements can be
placed in the array via dbPuts.)"

So in conclusion I am stuck on how to use waveform records for sending
long strings via streamDevice

Any suggestions are welcome

      Best
           Bo



On 2016-09-21 12:00, Mark Rivers wrote:
Your proposed solution seems reasonable, and it should work. You
should be able to use caput to write to the record when its INP field
is configured for StreamDevice. If you get an error message when
attempting this please send it to tech-talk because it must be some
other problem.

Mark


Sent from my iPhone

On Sep 21, 2016, at 3:52 AM, Bo Jakobsen <[email protected]> wrote:

Thanks for the comment. My use case is a bit clumsy.

I am working on a project using the existing LakeShore temperature
controller EPICS module.
Unfortunately this module does not implement uploading temperature
calibration curves to the controller.

As stated earlier I am rather new to EPICS (and EPICS implementation
is not my main job) so doing a full implementation of the curves
uploading mechanism seemed to big a job.

Inspired by the streamDevice manual, I just implemented a "RAW"
record which forwards strings to the apparatus.
The  control strings are then generated in the scripting language I
use (Matlab) and send over CA. This works fine for this special case.
However, for defining the "curve header" the string can get longer
than the 40 characters allowed for stringout, as it contains "names"
and "serial numbers" to be associated with the curve. Therefore the
need for a longer string.

I will try ones more with the waveform record. However, I seems to
remember that if I associate the streamDevice with the INP field, I
could not write to the record using "caput" (which would be
consistent with the manual)

I total agree this is not a pretty solution, but it could be very
useful in prototyping work.

Best
     Bo



On 2016-09-20 17:40, Rod Nussbaumer wrote:
Bob:

I've never found a need to use string data stored in any kind of
array record or string record for output to a device using
streamDevice. Normally, the strings that are sent to a device are
static command or query strings embedded as format strings in a
streamDevice protocol file. streamDevice will send these strings,
perhaps modified by data expanded from an EPICS record, to the
device. So, no need to stuff string data into array records, which
is a bit clumsy to do.

Do you have a different use case that dictates that you must send
string data that originates in a record?

Note also that streamDevice essentially ignores the input/output
nature of IO records. You can send the value of an input record to
a device, and you can fetch the value of a device parameter into an
output record.

Rod Nussbaumer
TRIUMF,
Vancouver, Canada


On 09/20/2016 04:10 AM, Mark Rivers wrote:
Hi Bo,

The waveform record can be used for both input and output.

This is from the documentation for StreamDevice for the waveform
record:

************************
If FTVL=="CHAR" or FTVL="UCHAR":
      In this case, the complete waveform is treated as a large
single string of size NORD. No separators are printed or expected.
      Output: x=range(VAL,0,NORD)
         The first NORD characters are printed, which might be
less than NELM.
      Input: VAL=x, NORD=length(x)
          A maximum of NELM-1 characters can be read. NORD is
updated to the index of the first of the trailing zeros. Usually,
this is the same as the string length.
************************

Mark

______
__________________________________
From: [email protected]
[[email protected]] on behalf of Bo Jakobsen
[[email protected]]
Sent: Tuesday, September 20, 2016 3:34 AM
To: [email protected]
Subject: Long string command to device

Hi,

I am working on modifying an EPICS interface for a LakeShore 336
(LS336)
temperature controller.
In that connection I need to send strings to the LS336 which
extends 40
characters.

I found the following thread:
http://www.aps.anl.gov/epics/tech-talk/2016/msg00887.php
which discusses a similar problem, and suggests to use waveform
records
and StreamDevice (which I am already using).

However, I am unable to get this to work.
As I read the documentation of waveform records they are only for
input,
and hence does not allow to set the OUT field (I am using EPICS 3.14)

Can anyone help with a solution to this problem?

Best
Bo Jakobsen





Navigate by Date:
Prev: Logbook entry error Patard Charles-Henri
Next: Driver for New Focus 8732 Picomotor Multi-Axis Driver Nilson Pereira
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Logbook entry error Patard Charles-Henri
Next: Driver for New Focus 8732 Picomotor Multi-Axis Driver Nilson Pereira
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·