106
M3i.48xx / M3i.48xx-exp Manual
Programming examples
Mode Multiple Recording
Using the trigger counter information one can determine how many Multiple Recording segments have been acquired and can perform a
memory flush by issuing Force trigger commands to read out all data. This is helpful if the number of trigger events is not known at the start
of the acquisition. In that case one will do the following steps:
• Program the maximum number of segments that one expects or use the FIFO mode with unlimited segments
• Set a timeout to be sure that there are no more trigger events acquired. Alternatively one can manually proceed as soon as it is clear from
the application that all trigger events have been acquired
• Read out the number of acquired trigger segments
• Issue a number of Force Trigger commands to fill the complete memory (standard mode) or to transfer the last FIFO block that contains
valid data segments
• Use the trigger counter value to split the acquired data into valid data with a real trigger event and invalid data with a force trigger event.
Programming examples
The following example shows how to set up the card for Multiple Recording in standard mode.
The following example shows how to set up the card for Multiple Recording in FIFO mode.
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_MULTI); // Enables Standard Multiple Recording
spcm_dwSetParam_i32 (hDrv, SPC_SEGMENTSIZE, 1024); // Set the segment size to 1024 samples
spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 768); // Set the posttrigger to 768 samples and therefore
// the pretrigger will be 256 samples
spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, 4096); // Set the total memsize for recording to 4096 samples
// so that actually four segments will be recorded
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_POS); // Set triggermode to ext. TTL mode (rising edge)
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); // and enable it within the trigger OR-mask
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_FIFO_MULTI); // Enables FIFO Multiple Recording
spcm_dwSetParam_i32 (hDrv, SPC_SEGMENTSIZE, 2048); // Set the segment size to 2048 samples
spcm_dwSetParam_i32 (hDrv, SPC_POSTTRIGGER, 1920); // Set the posttrigger to 1920 samples and therefore
// the pretrigger will be 128 samples
spcm_dwSetParam_i32 (hDrv, SPC_LOOPS 256); // 256 segments will be recorded
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_NEG); // Set triggermode to ext. TTL mode (falling edge)
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT0); // and enable it within the trigger OR-mask