NI-SCOPE has two kinds of functions that acquire data—Read and Fetch functions. For simplicity, this example uses a Read function.

LabVIEW Example—Acquiring the Data

The channels input parameter specifies the channel or channels that NI-SCOPE acquires data from.

C Example—Acquiring the Data

This example includes additional functions and parameters not needed in LabVIEW. You need to call niScope_ActualRecordLength to get the actual record length that NI-SCOPE uses so you can create enough space for the waveform array. You can then initiate the acquisition and fetch the data with niScope_Read. After fetching the data, you need to pass a pointer to extract and plot the acquired data. The method you use to do this varies depending on your ADE.

// Get the actual number of samples to be acquired niScope_ActualRecordLength (vi, &actualRecordLength);

// Get the number of waveforms available for the // given channelList niScope_ActualNumWfms (vi,channelList, &numWfm);

// Allocate space for the waveform information wfmInfoPtr = malloc (sizeof (struct niScope_wfmInfo) * numWfm);

// Allocate space for the waveform array wfmPtr = malloc (sizeof (ViReal64) * actualRecordLength * numWfm);

// Check if allocations succeeded if (!wfmPtr|| !wfmInfoPtr)

   return NISCOPE_ERROR_INSUFFICIENT_MEMORY;

// Read the data (Initiates an acquisition and fetches // the data) niScope_Read (vi, channelList, timeout, actualRecordLength, wfmPtr, wfmInfoPtr);

About the Parameters

The channelList parameter specifies the channel or channels that NI-SCOPE acquires data from. The wfmInfoPtr parameter returns the values needed to display a waveform: relative initial x is the time of the first point in the waveform with respect to the trigger and is expressed in seconds; absolute initial x is the absolute timestamp of the first point in the waveform; and x increment is the length of time between points in the waveform in seconds. The wfmPtr parameter is a buffer into which NI-SCOPE stores the waveform it reads. The units for the individual array elements are volts.