EasyManuals Logo

LabJack U3 User Manual

LabJack U3
120 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #70 background imageLoading...
Page #70 background image
Following is
example pseudocode to configure a 2-channel stream.
e.
ddRequest (lngHandle, LJ_ioPUT_CONFIG, LJ_chSTREAM_SCAN_FREQUENCY, scanRate, 0, 0);
LJ_ioPUT_CONFIG, LJ_chSTREAM_BUFFER_SIZE, scanRate*2*5, 0, 0);
d retrieve the desired amount of data.
_ PUT_C EEP, 0, 0);
ended AIN2 then differential AIN3-AIN9.
STREAM_CHANNEL_DIFF, 3, 0, 9, 0);
m
s eam.
ctualSampleRate = 2*dblValue;
(single channel) to retrieve. The x1 parameter should be a pointer to an array that has
een initialized to a sufficient size. Keep in mind that the required number of elements if
data
data.
) is the trigger that causes the block of data to be removed from the
uffer. This means that if three channels are streaming, 0, 1 and 2 (in that order in the scan
list), d then channel 1, then channel 0 again, the request
for c n e will return same data as the first request. New data will not be
retrie d l 2 is read, since channel 2 is last in the scan list. If the first get
strea d 1, the reads from channels 0 and 2 also
//Set the scan rat
A
//Give the UD driver a 5 second buffer (scanRate * 2 channels * 5 seconds).
AddRequest (lngHandle,
//Configure reads to wait an
AddRequest (lngHandle, LJ io ONFIG, LJ_chSTREAM_WAIT_MODE, LJ_swSL
//Define the scan list as singled
AddRequest (lngHandle, LJ_ioCLEAR_STREAM_CHANNELS, 0, 0, 0, 0);
AddRequest (lngHandle, LJ_ioADD_STREAM_CHANNEL, 2, 0, 0, 0);
AddRequest (lngHandle, LJ_ioADD_
//Execute the requests.
GoOne (lngHandle);
Next, start s : the trea
/Start the tr/
e
Get(lngHandle, LJ_ioSTART_STREAM, 0, &dblValue, 0);
//The actual scan rate is dependent on how the desired scan rate divides into
//the LabJack clock. The actual scan rate is returned in the value parameter
//from the start stream command.
actualScanRate = dblValue;
a
Once a stream is started, the data must be retrieved periodically to prevent the buffer from
overflowing. To retrieve data, add a request with IOType
LJ_ioGET_STREAM_DATA. The Channel
parameter should be
LJ_chALL_CHANNELS or a specific channel number (ignored for a single
channel stream). The Value parameter should be the number of scans (all channels) or
samples
b
retrieving all channels is number of scans * number of channels.
Data is stored interleaved across all streaming channels. In other words, if two channels are
streaming, 0 and 1, and
LJ_chALL_CHANNELS is the channel number for the read request, the
will be returned as Channel0, Channel1, Channel0, Channel1, etc. Once the data is read it is
removed from the internal buffer, and the next read will give new
If multiple channels are being streamed, data can be retrieved one channel at a time by passing
a specific channel number in the request. In this case the data is not removed from the internal
buffer until the last channel in the scan is requested. Reading the data from the last channel
(not necessarily all channels
b
an data is requested from channel 0,
ha nel 0 the second tim
ve until after channe
m ata request is for 10 samples from channel
70

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the LabJack U3 and is the answer not in the manual?

LabJack U3 Specifications

General IconGeneral
Analog Outputs2
Analog Output Resolution10 bits
Digital I/O20
Counter/Timers2
InterfaceUSB
Operating Voltage5 V
ManufacturerLabJack Corporation
Analog Inputs16
Analog Input Resolution12-bit
Max Sample Rate50 kHz