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

Subject: Re: Developing of record / driver / device support? Asyn?
From: Eric Norum <[email protected]>
To: Gorka Ronda <[email protected]>
Cc: EPICS tech-talk <[email protected]>
Date: Wed, 28 Jul 2010 10:28:53 -0700
On Jul 28, 2010, at 9:52 AM, Mark Rivers wrote:

Hi Gorka,
 
On the win32-x86 architecture asyn does not currently support local RS-232 serial ports, because there is no termios driver available for them.  However, you can use the cygwin-x86 architecture on Windows to access the local serial ports.  Alternatively, with either architecture you can use an Ethernet terminal server, such as those from Moxa, to access serial ports.
 
To communicate with the device I would recommend using the streamDevice module (http://epics.web.psi.ch/software/streamdevice/).  It uses asyn for the underlying communication, and provides the device support to communicate using standard EPICS records.  I would recommend it over devGPIB for
new applications, it is simpler to use.  You don’t need to write any C code, you just create a “protocol” file that describes how to format the strings to send to the device, and how to parse the response.


Agreed.
If the device uses SCPI (IEEE-488.2) commands you can use the template in ASYN to help you get started:
/usr/local/epics/R3.14.11/modules/soft/synApps_5_5/support/asyn4-13-1/bin/darwin-x86/makeSupport.pl -t streamSCPI myDevice

This provides protocol entries and associated records for the standard SCPI commands.


Here's the template protocol file:
> cat  myDeviceSup/devmyDevice.proto 
getIDN {
    out "*IDN?";
    in "%\$1[^\r\n]";
    ExtraInput = Ignore;
}

cmd {
    out "\$1";
}

setD {
    out "\$1 %d";
}
getD {
    out "\$1?";
    in "%d";
    ExtraInput = Ignore;
}



and here's the database file:
> cat myDeviceSup/devmyDevice.db 
#
# Simple database and stream protocol file for basic SCPI (IEEE488.2) commands
#


#
# Short and long form of identification string
#
record(stringin, "$(P)$(R)IDN")
{
    field(DESC, "SCPI identification string")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getIDN(39) $(PORT) $(A)")
    field(PINI, "YES")
}
record(waveform, "$(P)$(R)IDNwf")
{
    field(DESC, "SCPI identification string")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getIDN(199) $(PORT) $(A)")
    field(PINI, "YES")
    field(FTYP, "CHAR")
    field(NELM, "200")
}

record(bo, "$(P)$(R)RST")
{
    field(DESC, "SCPI Reset")
    field(DTYP, "stream")
    field(OUT,  "@devmyDevice.proto cmd(*RST) $(PORT) $(A)")
}

record(bo, "$(P)$(R)CLS")
{
    field(DESC, "SCPI Clear status")
    field(DTYP, "stream")
    field(OUT,  "@devmyDevice.proto cmd(*CLS) $(PORT) $(A)")
}

record(longin, "$(P)$(R)GetSTB")
{
    field(DESC, "SCPI get status byte")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getD(*STB) $(PORT) $(A)")
}

record(longin, "$(P)$(R)GetESR")
{
    field(DESC, "SCPI get event status")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getD(*ESR) $(PORT) $(A)")
}

record(longout, "$(P)$(R)SetESE")
{
    field(DESC, "SCPI enable event status")
    field(DTYP, "stream")
    field(OUT,  "@devmyDevice.proto setD(*ESE) $(PORT) $(A)")
}

record(longin, "$(P)$(R)GetESE")
{
    field(DESC, "SCPI enabled event status")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getD(*ESE) $(PORT) $(A)")
}

record(longout, "$(P)$(R)SetSRE")
{
    field(DESC, "SCPI enable service requests")
    field(DTYP, "stream")
    field(OUT,  "@devmyDevice.proto setD(*SRE) $(PORT) $(A)")
}

record(longin, "$(P)$(R)GetSRE")
{
    field(DESC, "Enabled service requests")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getD(*SRE) $(PORT) $(A)")
}

record(longin, "$(P)$(R)GetOPC")
{
    field(DESC, "Output completion status")
    field(DTYP, "stream")
    field(INP,  "@devmyDevice.proto getD(*OPC) $(PORT) $(A)")
}



 
You will create a database that defines EPICS records that use the streamDevice device support.
 
You can test communication with your device by loading an “asyn” record and using it interactively to send strings to the device and examine the responses.
 
Mark
 
 

From: [email protected] [mailto:[email protected]] On Behalf Of Gorka Ronda
Sent: Wednesday, July 28, 2010 5:34 AM
To: [email protected]
Subject: Developing of record / driver / device support? Asyn?
 
Hi all,
 
I’m newbie to EPICS and I need some help to start using it. I’m trying to develop an IOC based on a Windows XP PC. I have already build EPICS Base 3.14.9 with win32-x86 architecture and execute the “Example IOC Application” and “Channel Access Host Example” from the Application Developers Guide.
 
Now, I would like to connect a card to the IOC (PC) via RS-232. I think I need the Asyn interface from SynApps. But, I have no clear how to do it. I have to program something or a generic support for any RS-232 connection is already made? Does it change depending on the card to be used? What would I need? Record, Device and Driver support? Some of those? One of those? Maybe, another solution…
 
On the other hand, when I have to develop the database? Before or after record/driver/device support? How to do it simply and fast?
 
Thanks in advance
 
Gorka

-- 
Eric Norum
[email protected]





References:
Developing of record / driver / device support? Asyn? Gorka Ronda
RE: Developing of record / driver / device support? Asyn? Mark Rivers

Navigate by Date:
Prev: Re: Tech-talk archives excluded from indexing? Andrew Johnson
Next: Re: Tech-talk archives excluded from indexing? Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Developing of record / driver / device support? Asyn? Mark Rivers
Next: channel archiver Patrick Thomas
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·