Acquisition modes
FIFO Single acquisition mode
(c) Spectrum GmbH
73
Card mode
The card mode has to be set to the correct mode SPC_REC_STD_SINGLE.
Memory, Pre- and Posttrigger
At first you have to define, how many samples are to be recorded at all and how many of them should be acquired after the trigger event
has been detected.
You can access these settings by the registers SPC_MEMSIZE, which sets the total amount of data that is recorded, and the register
SPC_POSTTRIGGER, that defines the number of samples to be recorded after the trigger event has been detected. The size of the pretrigger
results on the simple formula:
pretrigger = memsize - posttrigger
The maximum memsize that can be use for recording is of course limited by the installed amount of memory and by the number of channels
to be recorded. Please have a look at the topic "Limits of pre, post memsize, loops" later in this chapter.
Example
The following example shows a simple standard single mode data acquisition setup with the read out of data afterwards. To keep this example
simple there is no error checking implemented.
FIFO Single acquisition mode
The FIFO single mode does a continuous data acquisition using the on-board memory as a FIFO buffer and transferring data continuously to
PC memory. One can make on-line calculations with the acquired data, store the data continuously to disk for later use or even have a data
logger functionality with on-line data display.
Card mode
The card mode has to be set to the correct mode SPC_REC_FIFO_SINGLE.
Length and Pretrigger
Even in FIFO mode it is possible to program a pretrigger area. In general FIFO mode can run forever until it is stopped by an explicit user
command or one can program the total length of the transfer by two counters Loop and Segment size
Register
Value
Direction
Description
SPC_CARDMODE
9500
read/write
Defines the used operating mode, a read command will return the currently used mode.
SPC_REC_STD_SINGLE
1h
Data acquisition to on-board memory for one single trigger event.
Register
Value
Direction
Description
SPC_MEMSIZE
10000
read/write
Sets the memory size in samples per channel.
SPC_POSTTRIGGER
10100
read/write
Sets the number of samples to be recorded after the trigger event has been detected.
int32 lMemsize = 16384; // recording length is set to 16 kSamples
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0); // only one channel activated
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_SINGLE); // set the standard single recording mode
spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, lMemsize); // recording length
spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 8192); // samples to acquire after trigger = 8k
// now we start the acquisition and wait for the interrupt that signalizes the end
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);
void* pvData = new int16[lMemsize];
// read out the data
spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC , 0, pvData, 0, 2 * lMemsize);
spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);
Register
Value
Direction
Description
SPC_CARDMODE
9500
read/write
Defines the used operating mode, a read command will return the currently used mode.
SPC_REC_FIFO_SINGLE
10h
Continuous data acquisition to PC memory. Complete on-board memory is used as FIFO buffer.
Register
Value
Direction
Description
SPC_PRETRIGGER
10030
read/write
Programs the number of samples to be acquired before the trigger event detection
SPC_SEGMENTSIZE
10010
read/write
Length of segments to acquire.
SPC_LOOPS
10020
read/write
Number of segments to acquire in total. If set to zero the FIFO mode will run continuously until it is
stopped by the user.