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

Subject: Re: StreamDevice, asynDriver or some other solution?
From: Rod Nussbaumer <[email protected]>
To: [email protected]
Date: Tue, 22 Jul 2014 15:45:33 -0700
Bryan:

I completely concur with Mark's assessment that StreamDevice is the optimal approach for an EPICS interface to your device.

I do have a question for Mark, however. In my use of SteamDevice, I typically do not use asynOctetSetInputEos to terminate lines in the asyn driver. Is there some tangible benefit that I am missing by using StreamDevice to specify line terminators? As a developer, it feels more natural to specify the terminator character in the protocol file, where everything else related to the data communication with a device is specified. If there is a good reason to do it int he asyn layer, I will consider doing that way in future systems.

   ---   rod.


On 07/22/2014 12:45 PM, Mark Rivers wrote:
Hi Bryan,

I think you are on exactly the right track in recommending StreamDevice
for this application.

Here is a slightly tweaked version of what you sent:

Here is the .proto file. Don’t need the TERMINATOR, let that be set for
the port with asynOctetSetInputEos, etc.

# Get the current reading. Send BELL character (\a) and P character to
get reading which is a float.

get_aware_reading {
out "\aP"; in "%f";
}

A db file (aware.db) perhaps like this:
record (stringout, "$(P):get_aware_reading")
{
field (DTYP, "stream")
field (OUT, "@aware.proto info $(PORT)")
}

A CMD file perhaps like this:
dbLoadDatabase "$(TOP)/dbd/streamApp.dbd"
streamApp_registerRecordDeviceDriver

#where can protocols be located?
epicsEnvSet "STREAM_PROTOCOL_PATH", ".:protocols:../protocols/"

#setup the Moxa terminal server

drvAsynIPPortConfigure "serial1", "164.54.160.22 2101"

asynOctetSetOutputEos(”serial1”,0, “\r\n”)

asynOctetSetInputEos(“serial1”,0, “\r\n”)

drvAsynSerialPortConfigure(“serial2”, “/dev/ttys0”)

asynSetOption(“serial2”,0,”baud”,”9600”)

asynSetOption(“serial2”,0,”bits”,”8”)

asynSetOption(“serial2”,0,”stop”,”1”)

asynOctetSetOutputEos(”serial2”,0, “\r\n”)

asynOctetSetInputEos(“serial2”,0, “\r\n”)

#load the records
dbLoadRecords "aware.db","P=DZ1,PORT=serial1"

dbLoadRecords "aware.db","P=DZ2,PORT=serial2"

var streamDebug 1
iocInit

 > I gleaned the above from an example but am not sure what much of it
means, for example dbLoadRecords "aware.db","P=DZ,BUS=L0 28"

That loads a database definition file (aware.db that you listed
previously) into the run-time EPICS database. It passes a parameter P
that is the prefix for the record names, and BUS (changed to PORT in my
example) telling it the name of the asyn port driver to communicate with.

 > I also did not see in the example how to set the baud rate, etc.

I have added that in my example for the local serial port (/dev/ttys0).

 > StreamDevice might be overkill so my question is, if the customer
wants to periodically poll the monitor for current reading and do
something with it, for example plot, sound an alarm, etc. which would be
the best solution StreamDevice, asynDriver or some other solution?

StreamDevice is not overkill, it is exactly what you want. It talks to
an underlying generic asynDriver for the local serial port, or Moxa
terminal server, etc. With this solution the user does not need to write
any C code.

Cheers,

Mark

*From:* [email protected]
[mailto:[email protected]] *On Behalf Of *Bryan J. Boardman
/ Aware Electronics Corp.
*Sent:* Tuesday, July 22, 2014 2:18 PM
*To:* [email protected]
*Subject:* StreamDevice, asynDriver or some other solution?

Hello good people,

Our company manufactures a line of radiation detectors that can be
controlled and report data by-way-of RS232 connections using ASCII
characters and/or binary. The monitors include both a standard built-in
RS-232 serial port and a built-in USB port using FTDI chip. (FTDI
devices now supported in Ubuntu 11.10, kernel 3.0.0-19
http://www.ftdichip.com/Drivers/VCP.htm )

Our monitors default to 9600 baud, 8 data, 1 stop and can be used with
RS-232 to Ethernet Serial Device Servers such as:
http://www.moxa.com/product/Serial_Device_Servers.htm RS232 to WiFi, GSM
modems, etc.

An overseas customer of ours is converting their nuclear facility to
EPICS and they would like to use it to, among other things, gather data
from and control our monitors.

They state: “As regard EPICS, we are now first stage which install the
base configuration of EPICS (3.14.12 VERSION) at Ubuntu 14.04. We are
testing (editing and compiling) and learning the saving the data
(histogram), alarming and reporting procedure.”

An example command for our monitor: If one sends it the four characters:
BELL,P,CR,LF the monitor responds with an ASCII string floating point
number terminated with CRLF, indicating the current reading.

The other commands are similar.

I previously mentioned to the customer that perhaps the StreamDevice is
the best approach and that a protocol file (aware.proto) is needed along
these lines:

Terminator = CR LF;

# Get the current reading. Send BELL character (\a) and P character to
get reading which is a float.

get_aware_reading {
out "\aP"; in "%f";
}

A db file (aware.db) perhaps like this:
record (stringout, "$(P):get_aware_reading")
{
field (DTYP, "stream")
field (OUT, "@aware.proto info $(BUS)")
}

A CMD file perhaps like this:
dbLoadDatabase " /streamApp.dbd"
streamApp_registerRecordDeviceDriver

#where can protocols be located?
epicsEnvSet "STREAM_PROTOCOL_PATH", ".:protocols:../protocols/"

#setup the busses

#drvAsynIPPortConfigure "L0", "localhost:40000"
vxi11Configure "L0","gpib-dz-1",0,0.0,"gpib0",0,0

#load the records
dbLoadRecords "aware.db","P=DZ,BUS=L0 28"

var streamDebug 1
iocInit

#enable debug output
var streamDebug 1

I gleaned the above from an example but am not sure what much of it
means, for example dbLoadRecords "aware.db","P=DZ,BUS=L0 28"

I also did not see in the example how to set the baud rate, etc.

StreamDevice might be overkill so my question is, if the customer wants
to periodically poll the monitor for current reading and do something
with it, for example plot, sound an alarm, etc. which would be the best
solution StreamDevice, asynDriver or some other solution?

I would like to provide the customer with as much information as
possible regarding using our monitors with EPICS particularly since they
are on the EPICS learning curve, so any and all information and specific
examples to accomplish the above would be most appreciated.

Best Regards / Bryan Boardman / Manager / Aware Electronics Corp

Web Site:
_http://www.aw-el.com__
_E-Mail:
[email protected] <mailto:[email protected]>_



Replies:
Re: StreamDevice, asynDriver or some other solution? Eric Norum
References:
StreamDevice, asynDriver or some other solution? Bryan J. Boardman / Aware Electronics Corp.
RE: StreamDevice, asynDriver or some other solution? Mark Rivers

Navigate by Date:
Prev: RE: synApps usage on 64 bit systems Mooney, Tim M.
Next: Re: StreamDevice, asynDriver or some other solution? Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: StreamDevice, asynDriver or some other solution? Mark Rivers
Next: Re: StreamDevice, asynDriver or some other solution? Eric Norum
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·