Returns a buffer with the specified digitizer group acquired data.
Gx3748DigitizerReadWaveform (nHandle, nDigitizerGroup, pdWaveform, pdwWaveformSize, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX3748 board. |
nDigitizerGroup |
SHORT |
Each of the digitizer inputs has a dedicated group of input channels, specified the digitizer’s group number, number are as follows:0. GX3748_DIGITIZER_GROUP0: Group 0 input channels 0-15.1. GX3748_DIGITIZER_GROUP1: Group 1 input channels 0-15.2. GX3748_DIGITIZER_GROUP2: Group 2 input channels 0-15. |
padWaveform |
PDOUBLE |
Buffer to hold the waveform array of Doubles. |
pdwWaveformSize |
PDWORD |
When calling this function, it should hold the number of elements in pvWaveform. On return, the function will return the actual number of elements copied to the array. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
The function clears the specified event capture memory content and set the memory counter to zero.
The Gx3748 has 3 input groups (0-2) each with 16 channels (48 total input channels). The digitizer has 3 independent inputs, all 3 has the same programmable sample period. Sample period can be set by calling Gx3748DigitizerSetSamplesPeriod() API. Each of the 3 digitizer inputs can record up 87,300 samples, the number of samples to acquired are set by calling Gx3748DigitizerSetSamplesCount() API. Each of the digitizer inputs can have a programmable trigger mode, trigger mode can be set by calling the Gx3748DigitizerSetTriggerMode() API. The user can set programmatically the trigger threshold for each of the digitizer inputs by calling the Gx3748DigitizerSetTriggerThreshold() API. Acquisition progress and total number of samples acquired of each of the digitizers inputs can monitor at any time by calling the Gx3748DigitizerGetSamplesCounter() API. Each of the digitizer inputs can armed or disarmed by calling the Gx3748DigitizerArm() API.
The user can halt the acquisition at any time by calling the Gx3748DigitizerHalt() API.
Once acquisition is done, to verify use Gx3748DigitizerGetGroupStatus() and Gx3748DigitizerGetStatus() APIs, the user can read back the acquired data by calling Gx3748DigitizerReadWaveform() API. The acquired data also record the time when the trigger was detected, user can get the time stamp by calling the Gx3748DigitizerReadTriggerTimestamp() API.
Each of the digitizer inputs has a dedicated group of input channels:
Digitizer Group 0: user can select programmatically the source to be one of Group 0 channels 0-15 by calling Gx3748DigitizerSetSource() API.
Digitizer Group 1: user can select programmatically the source to be one of Group 1 channels 0-15 by calling Gx3748DigitizerSetSource() API.
Digitizer Group 2: user can select programmatically the source to be one of Group 2 channels 0-15 by calling Gx3748DigitizerSetSource() API.
The following set each group and acquire data:
SHORT nHandle, nStatus, nMode;
SHORT nSamplesPeriod, nGroup, nSource, nAcquisitionStatus;
DWORD dwSampleCounter, dwSampleCount, dwActualSampleCount;
DOUBLE dTriggerTimestamp, dThreshold;
DOUBLE adData[200];
// Reset all 3 diitizer group channels, source=group channel 0, trigger mode=rising, trigger threshold=0.0V, sample period=2uSec, sample count=1
Gx3748DigitizerReset(nHandle, &nStatus);
// Reset the time stamp counter, the time stamp counter value will be recorded whenever trigger takes place
Gx3748EventCaptureResetTimestampCounter(nHandle, &nStatus);
// sample period is 2uSec = 500 KS/Sec
Gx3748DigitizerSetSamplesPeriod (nHandle, GX3748_DIGITIZER_SAMPLE_PERIOD_2USEC, &nStatus);
// Settings for GX3748_DIGITIZER_GROUP0
Gx3748DigitizerSetSamplesCount(nHandle, GX3748_DIGITIZER_GROUP0, 40, &nStatus);
Gx3748DigitizerSetSource (nHandle, GX3748_DIGITIZER_GROUP0, GX3748_GROUP_CH0, &nStatus);
Gx3748DigitizerSetTriggerThreshold (nHandle, GX3748_DIGITIZER_GROUP0, 0.5, &nStatus);
Gx3748DigitizerSetTriggerMode (nHandle, GX3748_DIGITIZER_GROUP0, GX3748_DIGITIZER_TRIGGER_RISING_EDGE, &nStatus);
// Settings for GX3748_DIGITIZER_GROUP1
Gx3748DigitizerSetSamplesCount(nHandle, GX3748_DIGITIZER_GROUP1, 80, &nStatus);
Gx3748DigitizerSetSource (nHandle, GX3748_DIGITIZER_GROUP1, GX3748_GROUP_CH0, &nStatus);
Gx3748DigitizerSetTriggerThreshold (nHandle, GX3748_DIGITIZER_GROUP1, 1.5, &nStatus);
Gx3748DigitizerSetTriggerMode (nHandle, GX3748_DIGITIZER_GROUP1, GX3748_DIGITIZER_TRIGGER_FALLING_EDGE, &nStatus);
// Settings for GX3748_DIGITIZER_GROUP2
Gx3748DigitizerSetSamplesCount(nHandle, GX3748_DIGITIZER_GROUP2, 120, &nStatus);
Gx3748DigitizerSetSource (nHandle, GX3748_DIGITIZER_GROUP2, GX3748_GROUP_CH0, &nStatus);
Gx3748DigitizerSetTriggerThreshold (nHandle, GX3748_DIGITIZER_GROUP2, 2.5, &nStatus);
Gx3748DigitizerSetTriggerMode (nHandle, GX3748_DIGITIZER_GROUP2, GX3748_DIGITIZER_TRIGGER_LEVEL_HIGH, &nStatus);
// Arm all 3 digitizer group channels
Gx3748DigitizerArm(nHandle, 0x7, &nStatus);
// Wait for all 3 digitizer group channels acquisition to be done
while (TRUE)
{ Gx3748DigitizerGetStatus(nHandle, &nAcquisitionStatus, &nStatus);
if (nAcquisitionStatus==GX3748_DIGITIZER_STATUS_DONE)
break;
};
// Get the sum of all 3 digitizer group channels recorded samples
Gx3748DigitizerGetSamplesCounter(nHandle, &dwSampleCounter, &nStatus);
printf("total samples count=%i", dwSampleCounter);
// Get Samples Period
Gx3748DigitizerGetSamplesPeriod (nHandle, &nSamplesPeriod, &nStatus);
switch(nSamplesPeriod)
{
case GX3748_DIGITIZER_SAMPLE_PERIOD_2USEC:
printf("sample period is 2uSec = 500 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_4USEC:
printf("sample period is 4uSec = 250 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_8USEC:
printf("sample period is 8uSec = 125 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_16USEC:
printf("sample period is 16uSec = 62.5 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_32USEC:
printf("sample period is 32uSec = 31.250 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_64USEC:
printf("sample period is 64uSec = 15.625 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_128USEC:
printf("sample period is 128uSec = 7.8125 KS/Sec");
break;
case GX3748_DIGITIZER_SAMPLE_PERIOD_256USEC:
printf("sample period is 256uSec = 3.90625 KS/Sec");
break;
}
// Read the data
for (nGroup = GX3748_DIGITIZER_GROUP0; nGroup<= GX3748_DIGITIZER_GROUP2; nGroup++)
{ printf ("** Group %i Data **", nGroup);
// Get group's channel
Gx3748DigitizerGetSource (nHandle, nGroup, &nSource, &nStatus);
printf ("** Group %i channel = %i", nGroup, nSource);
// Get threshold value
Gx3748DigitizerGetTriggerThreshold (nHandle, nGroup, &dThreshold, &nStatus);
printf ("** Group %i Threshold= %f", nGroup, dThreshold);
// Get group's channel Trigger Mode
Gx3748DigitizerGetTriggerMode (nHandle, nGroup, &nMode, &nStatus);
if (nMode==GX3748_DIGITIZER_TRIGGER_LEVEL_HIGH)
printf ("** Group %i Trigger Mode: level mode high, triggers if input voltage is above threshold", nGroup);
else if (nMode==GX3748_DIGITIZER_TRIGGER_LEVEL_LOW)
printf ("** Group %i Trigger Mode: level mode high, triggers if input voltage is below threshold", nGroup);
else if (nMode==GX3748_DIGITIZER_TRIGGER_RISING_EDGE)
printf ("** Group %i Trigger Mode: rising edge trigger mode, input voltage is crossing the threshold up", nGroup);
else if (nMode==GX3748_DIGITIZER_TRIGGER_FALLING_EDGE)
printf ("** Group %i Trigger Mode: falling edge trigger mode, input voltage is crossing the threshold up", nGroup);
// Get the trigger time stamp
Gx3748DigitizerReadTriggerTimestamp(nHandle, nGroup, &dTriggerTimestamp, &nStatus);
printf ("** Group %i Trigger Timestamp = %f", nGroup, &dTriggerTimestamp);
// Get how many did we ask for
Gx3748DigitizerGetSamplesCount(nHandle, nGroup, &dwSampleCount, &nStatus);
// Get how many actual samples did we get
Gx3748DigitizerReadSampleCount (nHandle, nGroup, &dwActualSampleCount, &nStatus);
printf ("** Group %i: Ask for %i samples Data, actual samples = %i", nGroup, dwActualSampleCount, dwActualSampleCount);
// Read Waveform
Gx3748DigitizerReadWaveform(nHandle, nGroup, adData, &dwActualSampleCount, &nStatus);
}
Gx3748DigitizerArm, Gx3748DigitizerGetGroupStatus, Gx3748DigitizerGetStatus, Gx3748DigitizerHalt, Gx3748DigitizerReadSampleCount, Gx3748DigitizerReadTriggerTimestamp, Gx3748DigitizerReset, Gx3748DigitizerSetSamplesCount, Gx3748DigitizerSetSamplesPeriod, Gx3748DigitizerSetSource, Gx3748DigitizerSetTriggerMode, Gx3748DigitizerSetTriggerThreshold, Gx3748DigitizerSetTriggerMode, GxFpgaGetErrorString