EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: genSub tutorial needed
From: Tim Mooney <[email protected]>
To: Dennis Nicklaus <[email protected]>
Cc: [email protected]
Date: Sun, 19 Feb 2006 18:15:09 -0600


Dennis Nicklaus wrote:
Can someone please give me a step-by-step explanation of how to use
the genSub records? I've read the record reference manual entry for them and
I still don't get it.
Here's what I want to do: 1. Have a function which would create two arrays, I and Q, of N points each, using several input parameters (values of other PVs) whenever any of the other PVs is set.
2. Copy these 2 arrays out to two separate VME memory address locations
(I'm copying an array to an array of addresses, not each-element-in-the-array-to-the-same-address as in a FIFO).
3. Process other records as with an FLNK link.

Some background: The genSub record has inputs (A-U) and outputs (VALA-VALU), and there is no association between A and VALA, etc. The inputs have associated INP* links, and the outputs have associated OUT* links. Both inputs and outputs have type fields (FTA-FTU, FTVA-FTVU) and number-of-element fields (NOA-NOU, NOVA, NOVU).

The genSub record does not talk to device support.  If you want to
write to hardware, you have to get some other record to do it.

Here's a recipe:

1. Write a database:

  record(genSub, "gs") {
    # set up array PV VALI and VALQ to write to waveform records, which
    # will do the actual output to hardware.
    field(FTVI, "LONG")
    field(NOVI, "$(N)")
    field(OUTI, "myWaveform_1 PP NMS")
    # ...and similarly for VALQ

    # set up scalar PVs A, B, and C.  Note that the input PV's (A-U)
    # are not PP fields (writing to them from a CA client will not
    # cause the record to process), so we must arrange another way
    # for the genSub record to process when its input values change.
    field(FTA, "DOUBLE")
    field(NOA, "1")
    field(INPA, "mySourceInfo1.VAL CP NMS")
    # ...and similarly for B and C
  }

   Write the subroutine.  See examples in the genSub module.  You may
not need an init routine, because the genSub record will allocate storage
for the array PVs.  The process subroutine does stuff like the following:

   for(i=0; i<prec->nova; i++) {
     prec->vali[i] = prec->a + prec->b + prec->c;
     /* ...and similarly for valq */
   }

2. Write device support for the waveform record to write the arrays
to hardware.  Probably you'll want to use a setup routine, callable
from st.cmd, to give the waveform records their target address.

3. You could wither forward link from the genSub record, or from one
of the waveform records it causes to process.

--
Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab.

Replies:
Re: genSub tutorial needed Jim Thomas
References:
genSub tutorial needed Dennis Nicklaus

Navigate by Date:
Prev: RE: segmentation fault in ca_task_initialize running in Linux Jeff Hill
Next: Re: genSub tutorial needed Jim Thomas
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: genSub tutorial needed Dennis Nicklaus
Next: Re: genSub tutorial needed Jim Thomas
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  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 ·