1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 <2006> 2007 2008 2009 2010 2011 2012 2013 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 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Sequencer embedded C code question |
From: | Maren Purves <[email protected]> |
To: | Ned Arnold <[email protected]> |
Cc: | [email protected] |
Date: | Thu, 29 Jun 2006 11:06:37 -1000 (HST) |
And: this is one of the examples where EPICS can make one's work either really difficult or really easy. (I sent Jiro the string-splitting genSub and the .db it's in, but that's much longer, especially as I sent the whole .db)
Wow, that's cool.
Tim Mooney wrote:Jiro Fujita wrote:Hello, This is probably really an elementary question, but we have been trying to interface an RS-232 device to EPICS soft IOC on Linux. We are using EPICS 3.14.8.2 with Asyn 4.6 (devGpib) via serial port. The response from the device looks like this:
1+32.23 2-50.01 3+23.98 ... ...
It has five channels, reads one value a second, contiunally sending the message through the serial port (that seems to be a typical thing here at STAR/BNL). We need to have the data sorted into five different PVs, based upon the channel names. In the end, the example above should look like this:
channel 1: 32.23 channel 2: -50.01 channel 3: 23.98
Because we need the channel number and the + or - sign in the raw data, I am taking the data into the IOC as string, having the sequencer split the channel number, based upon that, we are trying to put the value into the database.
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>