Timestamps
General information
(c) Spectrum GmbH
107
Timestamps
General information
The timestamp function is used to record trigger events relative to the beginning of the measurement, relative to a fixed time-zero point or
synchronized to an external reset clock. The reset clock can come from a radio clock a GPS signal or from any other external machine.
The timestamp is internally realized as a very wide counter that is running with the currently used sampling rate. The counter is reset either
by explicit software command or depending on the mode by the start of the card. On receiving the trigger event the current counter value is
stored in an extra FIFO memory.
This function is designed as an enhancement to the Multiple Recording mode and is also used together with the ABA mode option but can
also be used without these options with plain single acquisitions.
Each recorded timestamp consists of the number of samples that has been counted since the last
counter reset has been done. The actual time in relation to the reset command can be easily calcu-
lated by the formula on the right. Please note that the timestamp recalculation depends on the cur-
rently used sampling rate. Please have a look at the clock chapter to see how to read out the
sampling rate.
If you want to know the time between two timestamps, you can simply calculate this by the for-
mula on the right.
The following registers can be used for the timestamp option:
Example for setting timestamp mode:
The timestamp mode consists of one of the mode constants, one of the counter and one of the feature constants:
Register
Value
Direction
Description
SPC_TIMESTAMP_STARTTIME
47030
read/write
Return the reset time when using reference clock mode. Hours are placed in bit 16 to 23, minutes are
placed in bit 8 to 15, seconds are placed in bit 0 to 7
SPC_TIMESTAMP_STARTDATE
47031
read/write
Return the reset date when using reference clock mode. The year is placed in bit 16 to 31, the month
is placed in bit 8 to 15 and the day of month is placed in bit 0 to 7
SPC_TIMESTAMP_TIMEOUT
47045
read/write
Set’s a timeout in milli seconds for waiting of an reference clock edge
SPC_TIMESTAMP_AVAILMODES
47001
read
Returns all available modes as a bitmap. Modes are listed below
SPC_TIMESTAMP_CMD
47000
read/write
Programs a timestamp mode and performs commands as listed below
SPC_TSMODE_DISABLE
0
Timestamp is disabled.
SPC_TS_RESET
1h
The counters are reset. If reference clock mode is used this command waits for the edge the timeout time.
SPC_TSMODE_STANDARD
2h
Standard mode, counter is reset by explicit reset command.
SPC_TSMODE_STARTRESET
4h
Counter is reset on every card start, all timestamps are in relation to card start.
SPC_TSCNT_INTERNAL
100h
Counter is running with complete width on sampling clock
SPC_TSCNT_REFCLOCKPOS
200h
Counter is split, upper part is running with external reference clock positive edge, lower part is running with sampling
clock
SPC_TSCNT_REFCLOCKNEG
400h
Counter is split, upper part is running with external reference clock negative edge, lower part is running with sam-
pling clock
SPC_TSXIOINC_ENABLE
2000h
Enables the trigger synchronous acquisition of the two 10 bit incremental counters with every stored timestamp in the
upper 20 bit of the timestamp data.
SPC_TSXIOACQ_ENABLE
1000h
Enables the trigger synchronous acquisition of the BaseXIO inputs with every stored timestamp in the upper byte.
SPC_TSXIOACQ_DISABLE
0
The timestamp is filled up with leading zeros as a sign extension for positive values.
SPC_TSFEAT_NONE
0
No additional timestamp is created. The total number of stamps is only trigger related.
SPC_TSFEAT_STORE1STABA
10000h
Enables the creation of one additional timestamp for the first A area sample when using the optional ABA (dual-time-
base) mode.
// setting timestamp mode to standard using internal clocking
spcm_dwSetParam_i32 (hDrv, SPC_TIMESTAMP_CMD, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL | SPC_TSFEAT_NONE);
// setting timestamp mode to start reset mode using internal clocking
spcm_dwSetParam_i32 (hDrv, SPC_TIMESTAMP_CMD, SPC_TSMODE_STARTRESET | SPC_TSCNT_INTERNAL | SPC_TSFEAT_NONE);
// setting timestamp mode to standard using external reference clock with positive edge
spcm_dwSetParam_i32 (hDrv, SPC_TIMESTAMP_CMD, SPC_TSMODE_STANDARD | SPC_TSCNT_REFCLOCKPOS | SPC_TSFEAT_NONE);
t
Timestamp
Sampling rate
----------------------------------------------------------
=
t
∆
Timestamp
n
1
+
Timestamp
n
–
Sampling rate
-----------------------------------------------------------------------------------------------------------------------------
=