Rectifying:
epicsFloat64 div;
pao->eguf = 10.0;
pao->egul = (type == LCN12BMP ||
type == LCN16BMP) ? 0.0 : -10.0;
div = (type == LCN12BMP ||
type == LCN12BBP) ? 4095.0 : 65535.0;
pao->hopr = pao->eguf;
pao->lopr = pao->egul;
pao->eslo = ((pao->eguf) - (pao->egul)) / div;
Bruno Seiva Martins
Another comment:
The linear conversion mechanism is intended to convert the digitized
value into the final engineering units.
You might want to use your A/D converter for signals that correspond
to positions [mm], pressures [mbar], or temperatures [C].
In those cases, the database designer will set EGU, EGUL and EGUF to
e.g. "mm", -5 and 25, meaning that -10V are equivalent to -5mm, and
+10V are equivalent to +25mm. To limit the range that is shown in
the GUI, the designer might also want to set e.g. LOPR to -2 and
HOPR to +2, so that graphs and meters show the "interesting" range,
-2mm to +2mm.
To have this work correctly, setting EGUF, EGUL, HOPR and LOPR in
your device support may actually not be a good idea.
Normally, I would just set ESLO and EOFF.
Cheers,
~Ralph