74
M2i.30xx / M2i.30xx-exp Manual
Standard Single acquisition mode
Acquisition modes
Standard Single acquisition mode
The standard single mode is the easiest and mostly used mode to acquire analog data with a Spectrum acquisition card. In standard single
recording mode the card is working totally independent from the PC, after the card setup is done. The advantage of the Spectrum boards is
that regardless to the system usage the card will sample with equidistant time intervals.
The sampled and converted data is stored in the on-board memory and is held there for being read out after the acquisition. This mode allows
sampling at very high conversion rates without the need to transfer the data into the memory of the host system at high speed.
After the recording is done, the data can be read out by the user and is transferred via the bus into PC memory.
This standard recording mode is the most common mode for all an-
alog and digital acquisition and oscilloscope boards. The data is
written to a programmed amount of the on-board memory (mem-
size). That part of memory is used as a ring buffer, and recording
is done continuously until a trigger event is detected. After the trig-
ger event, a certain programmable amount of data is recorded
(post trigger) and then the recording finishes. Due to the continuous
ring buffer recording, there are also samples prior to the trigger
event in the memory (pretrigger).
When the card is started the pre trigger area is filled up with data first. While doing this the board’s trigger
detection is not armed. If you use a huge pre trigger size and a slow sample rate it can take some time after
starting the board before a trigger event will be detected.
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 register 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.
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 per channel 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);