Depending on the format type, different record fields are used
for output and input. The variable x
stands for the
written or read value.
%f
):x=(VAL-AOFF)/ASLO
VAL=(x*ASLO+AOFF)*(1.0-SMOO)+VAL*SMOO
ASLO==0.0
, it is treated as 1.0
.
Default values are ASLO=1.0
, AOFF=0.0
,
SMOO=0.0
.UDF
is cleared.
%i
):x=RVAL
RVAL=x
VAL=(((RVAL+ROFF)*ASLO+AOFF)*ESLO+EOFF)*(1.0-SMOO)+VAL*SMOO
if LINR=="LINEAR"
.
ESLO
and EOFF
might be set in the record
definition. StreamDevice does not set it. For example,
EOFF=-10
and ESLO=0.000305180437934
(=20.0/0xFFFF) maps 0x0000 to -10.0, 0x7FFF to 0.0 and 0xFFFF to 10.0.
Using unsigned formats with values ≥ 0x800000 gives different results
on 64 bit machines.
If LINR=="NO CONVERSION"
(the default), VAL
is directly converted from and to long
without going through
RVAL
. This allows for more bits on 64 bit machines.
To get the old behavior, use LINR=="LINEAR"
.
%{
):%s
):
During initialization, the @init
handler is executed, if present.
In contrast to normal operation, in DOUBLE input SMOO
is ignored
(treated as 0.0
).