Hi Will,
On 05/17/2017 08:43 AM, [email protected] wrote:
> I am working on synchronising the timestamp on an IOC with a timestamp
> register on an FPGA. I need access to the 32 bit fixed point nanoseconds
> word that makes up the lower half of the EPICS timestamp. Using the
> “Soft Timestamp” I can only get the value as a floating point number
> (using ai) or a string (using stringin).
> Is there a way of getting it in the fixed point format I want? As I
> understand it “Soft Timestamp” only works with ai and stringin records.
> Ideally I’d like support for longin records as well.
>
> record(ai,"$(SYS)-EVR:EventTimestamp"){
> field(DTYP,"Soft Timestamp")
> field(TSEL,"$(SYS)-EVR:Event-14-SP.TIME")
> }
>
> The record is processed by a forward link from "$(SYS)-EVR:Event-14-SP”
If you aren't too bothered about performance (i.e. this won't be
happening at high speed) then you can get the nanoseconds value from the
timestamop by using the stringin device support with a "%f" conversion
specifier, then fetch the resulting string as an integer (say with a
longin record).
If you need higher performance (i.e. don't want to round-trip through
the string representation), I would use a subroutine record with say the
INPA link pointing to the $(SYS)-EVR:Event-14-SP record and in the
subroutine do something like this:
epicsTimeStamp tick;
if (!dbGetTimeStamp(&prec->lnka, &tick)) {
prec->val = (double) tick.nsec;
return 0;
}
return -1; /* Raise SOFT_ALARM, BRSV */
This will fetch the timestamp from the record that INPA is pointing to
and set the VAL field of the subroutine to the nanoseconds field of that
timestamp.
HTH,
- Andrew
--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon
- References:
- soft Timestamp fixed point support william.smith
- Navigate by Date:
- Prev:
Re: string fanout or stringout after conditional check? Jeong Han Lee
- Next:
Troubleshooting the redirection-to-records feature of streamDevice Kevin Peterson
- 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
- Navigate by Thread:
- Prev:
soft Timestamp fixed point support william.smith
- Next:
caRepeater: Syntax error: ")" unexpected nb
- 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
|