![Spectrum M2i.3010 Скачать руководство пользователя страница 119](http://html.mh-extra.com/html/spectrum/m2i-3010/m2i-3010_hardware-manual_1344389119.webp)
Mode Gated Sampling
Programming examples
(c) Spectrum GmbH
119
Channel window trigger for long inner signals
The analog input is continuously sampled with the selected
sample rate. The upper and the lower levels define a win-
dow. Every time the signal enters the window from the out-
side, the pulsewidth counter is started. If the signal leaves
the window before the pulsewidth counter has stopped, no
trigger will be detected.
When the pulsewidth counter stops and the signal is still in-
side the window, the gate will start.
When the signal leaves the window from the inside to the
outside, the gate will stop.
Channel window trigger for long outer signals
The analog input is continuously sampled with the selected
sample rate. The upper and the lower levels define a win-
dow. Every time the signal leaves the window from the in-
side, the pulsewidth counter is started. If the signal enters
the window before the pulsewidth counter has stopped, no
trigger will be detected.
When the pulsewidth counter stops and the signal is still out-
side the window, the gate will start.
When the signal enters the window from the outside to the
inside, the gate will stop.
Programming examples
The following examples shows how to set up the card for Gated Sampling in standard mode for Gated Sampling in FIFO mode.
Register
Value
Direction
set to
Value
SPC_TRIG_CH0_MODE
40610
read/write
SPC_TM_WINENTER | SPC_TM_PW_GREATER
04000020h
SPC_TRIG_CH0_LEVEL0
42200
read/write
Set it to the upper trigger level relatively to the channel’s input range.
board dependant
SPC_TRIG_CH0_LEVEL1
42300
read/write
Set it to the lower trigger level relatively to the channel’s input range.
board dependant
SPC_TRIG_CH0_PULSEWIDTH
44101
read/write
Sets the pulsewidth in samples. Values from 2 to 65535 are allowed.
2 to 65535
Register
Value
Direction
set to
Value
SPC_TRIG_CH0_MODE
40610
read/write
SPC_TM_WINLEAVE | SPC_TM_PW_GREATER
04000040h
SPC_TRIG_CH0_LEVEL0
42200
read/write
Set it to the upper trigger level relatively to the channel’s input range.
board dependant
SPC_TRIG_CH0_LEVEL1
42300
read/write
Set it to the lower trigger level relatively to the channel’s input range.
board dependant
SPC_TRIG_CH0_PULSEWIDTH
44101
read/write
Sets the pulsewidth in samples. Values from 2 to 65535 are allowed.
2 to 65535
spcm_dwSetParam_i32 (hDrv, SPC_CARDMODE, SPC_REC_STD_GATE); // Enables Standard Gated Sampling
spcm_dwSetParam_i32 (hDrv, PRETRIGGER, 256); // Set the pretrigger to 256 samples
spcm_dwSetParam_i32 (hDrv, POSTTRIGGER, 2048); // Set the posttrigger to 2048 samples
spcm_dwSetParam_i32 (hDrv, SPC_MEMSIZE, 8192); // Set the total memsize for recording to 8192 samples
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_POS); // Use external trigger (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_GATE); // Enables FIFO Gated Sampling
spcm_dwSetParam_i32 (hDrv, PRETRIGGER, 128); // Set the pretrigger to 128 samples
spcm_dwSetParam_i32 (hDrv, POSTTRIGGER, 512); // Set the posttrigger to 512 samples
spcm_dwSetParam_i32 (hDrv, SPC_LOOP, 1024); // 1024 gates will be recorded
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_EXT0_MODE, SPC_TM_NEG);// Use external trigger (falling edge)
spcm_dwSetParam_i32 (hDrv, SPC_TRIG_ORMASK, SPC_TMASK_EXT0);// and enable it within the trigger OR-mask