EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: BI-Directional PVs
From: kuner <[email protected]>
To: [email protected]
Date: Tue, 18 Feb 2003 09:49:30 +0100
I've nearly finished work for an OPC device support, also base3.14 and win32, with the same feature: InOut records. I realised it with the out records. In-records are supported read only with all scan facilities. Out-records will be noticed by a Interrupt service routine if any changes occure:

The opc-callback handler - the "hardware access" - reads the hardware (the hardware is here a class that implements an OPC client), writes the data to VAL/RVAL field and initialises an epics callback:

hwClass::HwCallbackHandler(void)
{ if( recDpvt->isCallback ) // for out-records and in-records with SCAN="I/O Intr"
{ readHw(); // read value
if( recDpvt->isOutRecord ) // out-records are SCAN="passive" so scanIoRequest doesn't work
{ recDpvts->noOut=1; //prevent write value back to HW and cause a infinite loop
callbackRequest(&(recDpvt->callback) );
} else // in-records use scanIoRequest
{ scanIoRequest( recDpvt->ioscanpvt );
}
}
}


The epics callback causes record processing:

static void outRecordCallback(CALLBACK *pcallback)
{ dbCommon *prec;

callbackGetUser(prec, pcallback);
dbProcess(prec);
}

and the write hardware function cares to the noOut-flag

long opcSetScalar(OpcToEpics * pOpc2epics)
{ if(recDpvt->noOut )
{ pOpc2epics->noOut=0;
  return 0;
}
..write hardware and return
}

if there is an attempt to write the hardware from both sides at the same time it may be undetermined which value is realy written, but is this avoidable if there are no priorities defined?

I'm not shure if this is a good way to solve this problem because i'm not very familiar with epics internals, but it works. My code is divided in a devSup.c which does the record dependant stuff - DSET, init and io routines and mask/shift vfor mbb records - and supports all records that have an INP/OUT field and VAL/RVAL. There is a drv.cpp which handles the hardware/OPC side - and allows all C++ features :-). It is intended to be reused for other "hardware" as OPC only, so you could try to use it - if you are interested in.

Gruessle Bernhard






Navigate by Date:
Prev: Re: BI-Directional PVs Marty Kraimer
Next: HOST : WIN32 with IOC:Linux: is there environment variables in HOST? LANGLOIS Florent
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  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: BI-Directional PVs Marty Kraimer
Next: CEXP-1.2 ("valentine") released Till Straumann
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·