« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.4.4 - StreamBurst

Initializes a stream burst and collects data. This function combines LJM_eStreamStart, LJM_eStreamRead, and LJM_eStreamStop, as well as some other device initialization.

Syntax

LJM_ERROR_RETURN LJM_StreamBurst(
                int Handle, 
                int NumAddresses,
                const int * aScanList,
                double * ScanRate,
                unsigned int NumScans,
                double * aData)

Parameters

Handle [in]
A device handle. The handle is a connection ID for an active device. Generate a handle with LJM_Open or LJM_OpenS.
NumAddresses [in]
The number of addresses in aScanList. The size of the aScanList array.
aScanList [in]
An array of addresses to stream. The scan list is the list of data addresses that are to be buffered by LJM and returned in aData. Find addresses in the Modbus Map. For example, to stream AIN3 add the address 6 to the scan list.
ScanRate [in/out]
A pointer that sets the desired number of scans per second. Upon successful return of this function, ScanRate will be updated to the actual scan rate that the device used. Keep in mind that data rate limits are specified in Samples/Second which is equal to NumAddresses * Scans/Second.
NumScans [in]
The number of scans to collect. This is how many burst scans are collected and may not be zero.
aData [out]
An array that contains the values being read. Returns all channels interleaved. Must be large enough to hold (NumScans * NumAddresses) values.

Returns

LJM errorcodes or 0 for no error.

Remarks

LJM_StreamBurst does not write to STREAM_BUFFER_SIZE_BYTES.

Address configuration such as range, resolution, and differential voltages must be handled by writing to the device.

This function will block for (NumScans / ScanRate) seconds or longer.

Having trouble with stream? See our troubleshooting guide.

Example

[C/C++] Stream AIN0 and FIO_STATE for 10 scans at 2kHz.

int err;
int numChannels = 2;
int aScanList[2] = {0, 2500};
double scanRate = 2000;
int numScans = 10;

unsigned int numSamples = numChannels * numScans;
double * aBurstSamples = malloc(sizeof(double) * numSamples);

err = LJM_StreamBurst(handle, numChannels, aScanList, &scanRate, numScans,
	aBurstSamples);
if (err != LJME_NOERROR) {
	// Handle error
}

// Print the scans in aBurstSamples

free(aBurstSamples);