Skip to main content
Skip table of contents

StreamBurst [LJM User's Guide]

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 or NumAddresses * ScanRate.

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, plus a small amount of overhead (generally milliseconds or tens of milliseconds) to start stream. The method to reduce stream startup overhead that works with LJM_eStreamStart also works with LJM_StreamBurst.

When LJM_eStreamStop is called, Stream Burst mode is disabled and will have to be renabled for the next stream.

For more details about stream, see the LJM_eStreamStart page.

For externally-clocked stream and triggered stream, use LJM_eStreamStart instead of LJM_StreamBurst. LJM_STREAM_SCANS_RETURN is required for long timeouts, but it does not affect LJM_StreamBurst, so LJM_StreamBurst will return LJME_SYNCHRONIZATION_TIMEOUT if the LabJack is not sending scans fast enough or soon enough.

Example

Stream AIN0 and FIO_STATE for 10 scans at 2kHz.

C
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);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.