
Timestamps
Combination of Memory Segmentation Options with Timestamps
(c) Spectrum Instrumentation GmbH
165
Combination of Memory Segmentation Options with Timestamps
This topic should give you a brief overview how the timestamp option interacts with the options Multiple Recording and ABA mode for which
the timestamps option has been made.
Multiple Recording and Timestamps
Multiple Recording is well matching with the timestamp option. If timestamp
recording is activated each trigger event and therefore each Multiple Re
-
cording segment will get timestamped as shown in the drawing on the right.
Please keep in mind that the trigger events are timestamped, not the begin
-
ning of the acquisition. The first sample that is available is at the time position
of [Timestamp - Pretrigger].
The programming details of the timestamp option is explained in an extra
chapter.
The following example shows the setup of the Multiple Recording mode together with activated timestamps recording and a short display of
the acquired timestamps. The example doesn’t care for the acquired data itself and doesn’t check for error:
Gate-End Alignment
Due to the structure of the on-board memory, the length of a gate will be rounded up until the next card specific alignment:
So in case of a M4i.22xx card with 8bit samples and one active channel, the gate-end can only stop at 32Sample boundaries, so that up to
31 more samples can be recorded until the post-trigger starts. The timestamps themselves are not affected by this alignment.
// setup of the Multiple Recording mode
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_MULTI); // Enable Standard Multiple Recording
spcm_dwSetParam_i64 (hDrv, SPC_SEGMENTSIZE, 1024); // Segment size is 1 kSamples, Posttrigger is 768
spcm_dwSetParam_i64 (hDrv, SPC_POSTTRIGGER, 768); // samples and pretrigger therefore 256 samples.
spcm_dwSetParam_i64 (hDrv, SPC_MEMSIZE, 4096); // 4 kSamples in total acquired -> 4 segments
// setup the Timestamp mode and make a reset of the timestamp counter
spcm_dwSetParam_i32 (hDrv, SPC_TIMESTAMP_CMD, SPC_TSMODE_STANDARD | SPC_TSCNT_INTERNAL);
spcm_dwSetParam_i32 (hDrv, SPC_TIMESTAMP_CMD, SPC_TSMODE_RESET);
// now we define a buffer for timestamp data and start the acquistion. Each timestamp is 128 bit = 16 bytes.
int64* pllStamps = (int64*) pvAllocMemPageAligned (16 * 4);
spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_TIMESTAMP, SPCM_DIR_CARDTOPC, 0, (void*) pllStamps, 0, 4 * 16);
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_EXTRA_STARTDMA);
// we wait for the end timestamps transfer which will be received if all segments have been recorded
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_EXTRA_WAITDMA);
// as we now have the timestamps we just print them and calculate the time in milli seconds
// for simplicity only the lower 64 bit part of the 128 bit stamp is used, hence only every
// second array element of pllStamps is used here.
int64 llSamplerate;
double dTime_ms;
spcm_dwGetParam_i64 (hDrv, SPC_SAMPLERATE, &llSamplerate);
for (int i = 0; i < 4; i++)
{
dTime_ms = 1000.0 * pllStamps[2 * i] / llSamplerate);
printf ("#%d: %I64d samples = %.3f ms\n", i, pllStamps[2 * i], dTime_ms);
}
Table 98: Spectrum API: gate end alignement in Gated Sampling mode
M2i + M2i-exp
M4i + M4x
M2p
Active Channels
8bit
12/14/16 bit
8bit
14/16 bit
A/D and D/A
16bit
DIO
1 channel
4 Samples
2 Samples
32 Samples
16 Samples
8 Samples
---
2 channels
2 Samples
1 Samples
16 Samples
8 Samples
4 Samples
---
4 channels
1 Sample
1 Samples
8 Samples
4 Samples
2 Samples
---
8 channels
---
1 Samples
---
---
1 Samples
---
16 channels
---
1 Samples
---
---
---
8 Samples
32 channels
---
---
---
---
---
4 Samples
Image 76: drawing of Multiple Recording Acquisition with Timestamps
Summary of Contents for M2p.59 Series
Page 190: ......