I'm not sure if this will be any less trouble than the solution you're
already pursuing, because it requires a record that is not part of EPICS base.
But if you happen to have the sCalcout record available, you can do this with
an sCalcout and a dfanout. Here's what the database would look like:
scalc.INAA = <link to input string> # string from serial device
scalc.CALC = "int(aa)" # get channel number
scalc.DOPT = "Use OCAL" # evaluate '.OCAL' expression
scalc.OCAL = "dbl(aa[1,-1])" # get value (skip past channel number)
scalc.OUT = "dfanout.VAL PP" # write value to dfanout
dfanout.SELM = "Specified" # only write to link specified via SELL
dfanout.SELL = "scalc.VAL NPP" # scalc calculated link to use
dfanout.OUTB = <link to channel 1 PV> # if scalc.VAL==1, write to <channel 1 PV>
dfanout.OUTC = <link to channel 2 PV> # ...and so on
dfanout.OUTD = <link to channel 3 PV>
dfanout.OUTE = <link to channel 4 PV>
dfanout.OUTF = <link to channel 5 PV>
--
Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab