Acquisition modes
FIFO Single acquisition mode
(c) Spectrum GmbH
75
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
The total amount of samples per channel that is acquired can be calculated by [SPC_LOOPS * SPC_SEGMENTSIZE]. Please stick to the below
mentioned limitations of the registers.
Difference to standard single acquisition mode
The standard modes and the FIFO modes differ not very much from the programming side. In fact one can even use the FIFO mode to get the
same behavior like the standard mode. The buffer handling that is shown in the next chapter is the same for both modes.
Pretrigger
When doing standard single acquisition memory is used as a circular buffer and the pre trigger can be up to the [installed memory] - [minimum
post trigger]. Compared to this the pre trigger in FIFO mode is limited by a special pre trigger FIFO and hence considerably shorter.
Length of acquisition.
In standard mode the acquisition length is defined before the start and is limited to the installed on-board memory whilst in FIFO mode the
acquisition length can either be defined or it can run continuously until user stops it.
Example FIFO acquisition
The following example shows a simple FIFO single mode data acquisition setup with the read out of data afterwards. To keep this example
simple there is no error checking implemented.
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.
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0); // only one channel activated
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_FIFO_SINGLE); // set the FIFO single recording mode
spcm_dwSetParam_i32 (hDrv, SPC_PRETRIGGER, 1024); // 1 kSample of data before trigger
// in FIFO mode we need to define the buffer before starting the transfer
int16* pnData = new int16[lBufsizeInSamples];
spcm_dwDefTransfer_i64 (hDrv, SPCM_BUF_DATA, SPCM_DIR_CARDTOPC, 4096, (void*) pnData, 0, 2 * lBufsizeInSamples);
// now we start the acquisition and wait for the first block
dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER);
dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_STARTDMA | M2CMD_DATA_WAITDMA);
// we acquire data in a loop. As we defined a notify size of 4k we’ll get the data in >=4k chuncks
llTotalBytes = 0;
while (!dwError)
{
// read out the available bytes
spcm_dwGetParam_i64 (hDrv, SPC_DATA_AVAIL_USER_LEN, &llAvailBytes);
llTota= llAvailBytes;
// here is the right position to do something with the data (printf is limited to 32 bit variables)
printf ("Currently Available: %d, total: %d\n", (int32) llAvailBytes, (int32) llTotalBytes);
// now we free the number of bytes and wait for the next buffer
spcm_dwSetParam_i64 (hDrv, SPC_DATA_AVAIL_CARD_LEN, llAvailBytes);
dwError = spcm_dwSetParam_i32 (hDrv, SPC_M2CMD, M2CMD_DATA_WAITDMA);
}