![Spectrum M2i.3010 Скачать руководство пользователя страница 120](http://html.mh-extra.com/html/spectrum/m2i-3010/m2i-3010_hardware-manual_1344389120.webp)
120
M2i.30xx / M2i.30xx-exp Manual
General information
Timestamps
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 (or at the start and at the
end of a gate interval when using Gated Sampling mode) the current counter value is stored in an extra FIFO memory.
This function is designed as an enhancement to the Multiple Recording and the Gated Sampling mode and is also used together with the ABA
mode but can also be used without these modes with plain single acquisitions. If Gated Sampling mode is used, then both the start and end
of a recorded segment are timestamped.
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 and the oversampling factor. Please have a look at the clock chapter to
see how to read out the sampling rate and the oversampling factor
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 mode:
Writes to the SPC_TS_RESET register can only have an effect on the counters, if the cards clock generation is
already active. This is the case when the card either has already done an acquisition after the last reset or if
the clock setup has already been actively transferred to the card by issuing the M2CMD_CARD_WRITESETUP
command.
Example for setting timestamp mode:
The timestamp mode consists of one of the mode constants, one of the counter constants and 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
Sets a timeout in milliseconds 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 the reference clock mode is used, this command will waits for the edge to occur for the time
defined by the SPC_TIMESTAMP_TIMEOUT register before issuing a timeout error.
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_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
0h
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 ABA (dual-timebase)
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 * Oversampling
--------------------------------------------------------------------------------------------------------------------------------
=
t
∆
Timestamp
n
1
+
Timestamp
n
–
Sampling rate * Oversampling
--------------------------------------------------------------------------------------------------------------------------------
=