Gx3722DigitizerReadWaveformEx

Purpose

Reads the Digitizer Waveform memory including pre-triggered data.

Syntax

Gx3722DigitizerReadWaveformEx (nHandle, nChannel, padWaveform, dwWaveformArraySize, pdwPreTriggerSize, pdwPostTriggerSize, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX3722 board.
nChannel
SHORT
Channel number:
1.      GX3722_DIGITIZER_CH1: Read the acquired data from channel 1.
2.    GX3722_DIGITIZER_CH2: Read the acquired data from channel 2.
pdwWaveformSize
PDOUBLE
Buffer to hold the waveform array of Doubles.
dwWaveformArraySize
PDWORD
Waveform array size, array size should be >=pdwPreTriggerSize + pdwPreTriggerSize.
pdwPreTriggerSize
PDWORD
Pre trigger data size, returns actual pre-trigger recorded data size, max pre trigger buffer size is 8191. Size can be set from 0 (GX3722_DIGITIZER_PRE_TRIGGER_COUNT_MIN) to 8191 (GX3722_DIGITIZER_PRE_TRIGGER_COUNT_MAX).
pdwPostTriggerSize
PDWORD
Post trigger data size, returns actual Post trigger recorded data size. Past trigger data cane be from 1 (GX3722_DIGITIZER_COUNT_MIN) to 262143 (GX3722_DIGITIZER_COUNT_MAX).
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

The function reads the Digitizer Waveform memory including pre-triggered data.

Digitizer memory cannot not be written to and read from at the same time.  Use Gx3722GetSampleStatus() API to ensure that the digitizer is not operating before calling this function.

In order to get as much pre-trigger data as possible, allocate the full 8191 data size to the buffer in addition to the required post trigger data, as it was set by the Gx3722DigitizerSetSampleCount() API.

Example

The following example is recording a single pulse using the ARB Pulse generator channel 1, including pre trigger data:

 

DWORD dwWaveformArraySize=10240:

DWORD dwPreTriggerSize=8191;

DWORD dwPostTriggerSize = 2048;

SHORT nSampleStatus;

SHORT nTriggerStatus;

DOUBLE adWave[10240];

 

Gx3722Reset(nHandle, &nStatus);

// Fill channel 1 with a 1mSec pulse period, and 0.5mSec pulse width, low

// amplitude is 0V, peak amplitude is 2V

Gx3722ArbPulseWaveform (nHandle, GX3722_DIGITIZER_CH1, 0, 2.0, 1, 0.5, &nStatus);

// Set Mode to Single Shot

Gx3722ArbSetMode (nHandle, GX3722_ARB_MODE_SINGLE_SHOT, &nStatus);

// Set sample rate to 10MPerSec

Gx3722DigitizerSetSampleRate (nHandle, GX3722_DIGITIZER_SAMPLE_RATE_10MS_SEC&nStatus);

 

// Set Trigger threshold to +1.5V

Gx3722DigitizerSetTriggerThreshold(nHandle, 1.5, &nStatus);

// Set Trigger Source channel 1

Gx3722DigitizerSetTriggerSource(nHandle, GX3722_DIGITIZER_TRIGGER_SOURCE_CH1, &nStatus);

// Set Trigger to rising edge

Gx3722DigitizerSetTriggerMode(nHandle, GX3722_DIGITIZER_TRIGGER_RISING_EDGE, &pnStatus);

// Set Sample Count

Gx3722DigitizerSetSampleCount (nHandle, dwSize, &nStatus);

// Enable Digitizer Channel1 for acquisition

Gx3722DigitizerSetState (nHandle, GX3722_DIGITIZER_CH1, GX3722_DIGITIZER_CH_STATE_ENABLE, &nStatus);

 

// Arm

Gx3722DigitizerArm(nHandle, &nStatus);

 

// Start the pulse

Gx3722ArbStart (nHandle, GX3722_ARB_CH1&nStatus);

 

Gx3722DigitizerGetTriggerStatus (nHandle, &nTriggerStatus, &nStatus);

 

do

{

    Sleep(10);

    Gx3722DigitizerGetTriggerStatus (nHandle, &nTriggerStatus, &nStatus);

} while (nTriggerStatus== GX3722_DIGITIZER_NO_TRIGGER)

 

do

{

    Sleep(100);

    Gx3722DigitizerGetSampleStatus (nHandle, &nSampleStatus, &nStatus);

} while (nSampleStatus==GX3722_DIGITIZER_STATUS_BUSY);

Gx3722DigitizerReadWaveformEx (nHandle, GX3722_DIGITIZER_CH1, adWave, dwWaveformArraySize, &dwPreTriggerSize, &dwPostTriggerSize, &nStatus);

 

See Also

Gx3722DigitizerArm, Gx3722DigitizerHalt, Gx3722DigitizerSetTriggerSource, Gx3722DigitizerSetTriggerMode, Gx3722DigitizerSetTriggerThreshold, Gx3722DigitizerSetSampleCount, Gx3722DigitizerTrigger, Gx3722DigitizerReadWaveform, Gx3722DigitizerSetPxiTrigger, Gx3722DigitizerGetState, Gx3722DigitizerGetSampleStatus, Gx3722DigitizerGetTriggerStatus, GxFpgaGetErrorString