Hi:
When using the stream device, I'm seeing a problem where both the '@init' mechanism and the support for LINR work as described, but not when both are used with the same AO record.
This is the protocol:
getFreq {
out "freq?";
in "%i";
}
setFreq {
out "freq %i";
@init { getFreq; }
}
The raw number read and written is some frequency in units of Hz, while we'd like to use MHz for the records and the display.
So added LINEAR conversion to the records:
record(ai, "getFreq")
{
field(DTYP, "stream")
field(INP, "@proto getFreq PS1")
field(LINR, "LINEAR")
field(ESLO, "0.000001")
field(EGU, "MHz")
field(PREC, "3")
field(SCAN, "1 second")
}
record(ao, "setFreq")
{
field(DTYP, "stream")
field(OUT, "@proto setFreq PS1")
field(LINR, "LINEAR")
field(ESLO, "0.000001")
field(EGU, "MHz")
field(PREC, "3")
}
That works well at runtime, but at initialization time, the stream device '@init' mechanism seems to be unaware of the LINEAR conversion.
So when I write "402.5" to the AO record, it correctly writes "freq 402500000" to the device.
The AI record reads "402500000" from the device and correctly scales that into "402.500 MHz" based on LINR, ESLO, PREC and EGU.
But right after bootup of the IOC, the '@init' mechanism reads "402500000" from the device into the AO RVAL, then puts that without scaling into the AO VAL.
Just in case, I tried LINR==SLOPE, but that has the same effect: Works fine when writing to the record, but skips the linear conversion for '@init'.
Am I missing something in the stream device usage?
Thanks,
Kay
|