Hi James,
On 2013-01-07 James F Ross wrote:
> A colleague of mine and I are trying to set up an IOC for an HLT power
> supply. Basically the power supply has an internal memory that will
> remember the voltages that it was set to when it was previously turned
> off. These are changed while the IOC runs for various reasons and it is
> desirable that the IOC also remember what these voltages were.
EPICS output records were designed with this kind of issue in mind, and Mark Rivers' post about Asyn shows that it is possible. It is really up to the device support to read back the current value from the hardware within its init_record() routine, although unfortunately it must be a synchronous operation so this isn't ideal on slow interfaces (it may be easier to use an Asyn device support instead if that's the case, but ask about that here before you start a big conversion project). The record can convert the hardware's raw value back to an engineering units if desired.
If you wrote your own device support here's how the record interfaces work. The simplest example I can find is actually a bo record rather than an ao, but the principle is the same: http://www.aps.anl.gov/cgi-bin/epics/cvsweb/modules/digital/xycom/src/devBoXVme220.c?rev=1.3
In the init_record() routine the xy220_read() call sets value based on what the hardware register is currently programmed to output. If that succeeds the value is put into the RVAL field, and init_record() will return 0 which requests the record to convert RVAL to VAL. If the read failed the return value will be 2, telling the record not to do the conversion, which will leave VAL at whatever it was set to by DOL or the .db file.
HTH,
- Andrew
--
There is no such thing as a free lunch. When invited for lunch,
it is best to check if you are there to eat, or to be eaten.
-- Clive Robinson
|