EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: aiRecord conversion
From: Eric Norum <[email protected]>
To: Bruno Seiva Martins <[email protected]>
Cc: "[email protected] Talk" <[email protected]>
Date: Tue, 28 Aug 2012 10:08:35 -0700
On Aug 28, 2012, at 9:42 AM, Bruno Seiva Martins <[email protected]> wrote:

In fact, setting EOFF did the trick, now the conversion is happening as expected.

Eric, I trusted the top Google result because the URL looks fine and suggests, at least to me, that it's the official documentation for the current version. I will take more care in the future :) I believe it would be more clear if a warning would be put on top of that old page, saying that the most up to date documentation can be found at the wiki.

Yep, I hope that someone can ensure that that ancient document can, "Join the choir eternal"...


Dirk, the 'type' variable was already defined in a private structure, so it agrees with your suggestion. I had created a custom function (not specialLinconv()) to setup those conversion parameters. Is there any special reason to use specialLinconv() instead of a custom function? I thought that EPICS would call specialLinconv() every time a conversion was needed (for, say, weird conversion rules), apparently that's not the case. 


The documentation at https://wiki-ext.aps.anl.gov/epics/index.php/RRM_3-14_Analog_Input#special_linconv describes this pretty well:

special_linconv(precord,after)

This routine is called whenever any of the fields LINR, EGUF, EGUL or ROFF is modified. To support linear conversion, EOFF and ESLO must be set accordingly. The record support sets EOFF to EGUL before calling this routine, which is the very common case when RAWL is zero below.

A useful formula for calculating EOFF and ESLO is this one:

EOFF = (RAWF * EGUL - RAWL * EGUF) / (RAWF - RAWL)
ESLO = (EGUF - EGUL) / (RAWF - RAWL)

Here, RAWL and RAWF are the lowest resp. highest possible raw value. For instance, a 16 bit bipolar ADC might have RAWL=-0x7fff, RAWF=0x7fff.


-- 
Eric Norum
[email protected]


Replies:
Re: aiRecord conversion Michael Davidsaver
References:
aiRecord conversion Bruno Seiva Martins
Re: aiRecord conversion Eric Norum
Re: aiRecord conversion Bruno Seiva Martins
Re: aiRecord conversion Eric Norum
Re: aiRecord conversion Ralph Lange
Re: aiRecord conversion Bruno Seiva Martins

Navigate by Date:
Prev: Fwd: EDM X Error on Linux Lucas Russo
Next: Re: aiRecord conversion Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: aiRecord conversion Bruno Seiva Martins
Next: Re: aiRecord conversion Michael Davidsaver
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·