EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  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  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Asyn and a 3rd party API?
From: "Bertrand H.J. Biritz" <[email protected]>
To: [email protected]
Date: Thu, 21 Jun 2007 10:39:46 -0700
Hi Mark,

thank you for the prompt reply. I will look at the examples you linked to - hopefully I will be able to understand how to implement this for my work :)

Sincerely,
Bertrand

On Jun 21, 2007, at 10:11 AM, Mark Rivers wrote:

Hi Bertrand,

You can certainly do this.

You will be writing an "asyn port driver". You need to decide what asyn
interfaces your driver will implement (asynOctet, asynInt32,
asynUInt32Digital, asynFloat64, etc.). Unless the device is very
unusual you won't need to write any EPICS device support, you can use
the standard asyn EPICS device support, which will then talk to your
driver.


You then write your driver to implement the interfaces that you have
chosen to support. For example, if you implement asynFloat64, then your
asynFloat64Read function will call the C function that the vendor
provided to read some double parameter from the device. You will
probably want to implement asynDrvUser interface to handle the need to
handle multiple parameters for each asyn interface. Your template file
might look like:


# ai records to read voltage and current
record(ai, "$(P)Current") {
    field(DTYP,"asynFloat64")
    field(INP,"@asynMask($(PORT) $(ADDR))VOLTAGE")
    field(LINR,"LINEAR")
    field(EGUL,"$(EGUL)")
    field(EGUF,"$(EGUF)")
    field(HOPR,"$(EGUF)")
    field(LOPR,"$(EGUL)")
    field(PREC,"$(PREC)")
}

record(ai, "$(P)Current") {
    field(DTYP,"asynFloat64")
    field(INP,"@asynMask($(PORT) $(ADDR))CURRENT")
    field(LINR,"LINEAR")
    field(EGUL,"$(EGUL)")
    field(EGUF,"$(EGUF)")
    field(HOPR,"$(EGUF)")
    field(LOPR,"$(EGUL)")
    field(PREC,"$(PREC)")
}

Here are 2 drivers you can look at for examples:

1) The Modbus driver
http://cars.uchicago.edu/software/epics/modbus.html

2) The Canberra AIM MCA driver (source file
mcaApp/CanberraSrc/drvMcaAIMAsyn.c)
http://cars.uchicago.edu/software/epics/mca.html

Mark

References:
RE: Asyn and a 3rd party API? Mark Rivers

Navigate by Date:
Prev: RE: Asyn and a 3rd party API? Mark Rivers
Next: Re: Asyn assertion failure (long) Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Asyn and a 3rd party API? Mark Rivers
Next: ARCnet on Linux Jiro Fujita
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·