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
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Bertrand
> H.J. Biritz
> Sent: Thursday, June 21, 2007 11:52 AM
> To: [email protected]
> Subject: Asyn and a 3rd party API?
>
> Dear Tech-talk,
>
> okay, I am pretty lost right now.
>
> I was hoping to use asyn to use a third party API to
> communicate with
> a power supply. But for the life of me I can't figure out how to do
> this.
>
> The manufacturer supplied a C library of functions to talk with the
> crate and I would like to have asyn use those functions. Is this
> possible?
>
> Could someone point me into the right direction of how to do
> this (an
> example code would be the best but I will take whatever I can get :)
>
> Sincerely,
> Bertrand
>
- Replies:
- Re: Asyn and a 3rd party API? Bertrand H.J. Biritz
- References:
- Asyn and a 3rd party API? Bertrand H.J. Biritz
- Navigate by Date:
- Prev:
Asyn and a 3rd party API? Bertrand H.J. Biritz
- Next:
Re: Asyn and a 3rd party API? Bertrand H.J. Biritz
- 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
- Navigate by Thread:
- Prev:
Asyn and a 3rd party API? Bertrand H.J. Biritz
- Next:
Re: Asyn and a 3rd party API? Bertrand H.J. Biritz
- 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
|