Subject: |
how to process other records in subroutine record by ca link? |
From: |
"Silver" <[email protected]> |
To: |
"tech-talk" <[email protected]> |
Date: |
Sat, 10 Apr 2010 20:06:41 +0800 |
hi,
My case is like this:
1. I can get a waveform value from one PV.
2. After gaining the value, it will FLNK a subroutine record. then I want to do come caculation in subroutine record, such as caculating the steps which motor need move.
3. to drive the motor, I will first set an ao record (motor:steps) a value, than set a bo record (motor:move) to run the motor.
I have used the subroutine/gensub record before, but I don't know how to drive the other record in it, use dbCaPutLink? Where can I find detailed examples? Can anyone help me? thank a lot for your help.
Ps, as I need to set the steps of motor differently each time, so can't just use FLNK in db file. Also I don't want to use Sequencer.
#include <stdio.h>
#include <dbDefs.h>
#include <registryFunction.h>
#include <subRecord.h>
#include <epicsExport.h>
int mySubDebug;
typedef long (*processMethod)(subRecord *precord);
static long mySubInit(subRecord *precord,processMethod process)
{
if (mySubDebug)
printf("Record %s called mySubInit(%p, %p)\n",
precord->name, (void*) precord, (void*) process);
return(0);
}
static long mySubProcess(subRecord *precord)
{
if (mySubDebug)
/* printf("Record %s called mySubProcess(%p)\n",
precord->name, (void*) precord);*/
printf("Record %s called mySubProcess(%p),VAL=%f\n",precord->name, (void*) precord, (precord->a/123.456));
return(0);
}
/* Register these symbols for use by IOC code: */
epicsExportAddress(int, mySubDebug);
epicsRegisterFunction(mySubInit);
epicsRegisterFunction(mySubProcess);
Best regards
Geyang 2010-04-10
- Replies:
- Re: how to process other records in subroutine record by ca link? Eric Norum
- Re: how to process other records in subroutine record by ca link? Eric Norum
- Navigate by Date:
- Prev:
RE: asyn port question Davidsaver, Michael
- Next:
Re: how to process other records in subroutine record by ca link? Eric Norum
- 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:
RE: asyn port question Davidsaver, Michael
- Next:
Re: how to process other records in subroutine record by ca link? Eric Norum
- 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
|