3.2.2 Special Stream Modes [T-Series Datasheet]
Useful sub-modes for stream operation.
Burst Stream
Burst stream is when stream collects a pre-determined number of scans, then stops. To set the stream burst size, write to STREAM_NUM_SCANS:
The LJM library collects burst stream data with the StreamBurst function.
It may be beneficial to set STREAM_BUFFER_SIZE_BYTES to a large value for fast burst stream.
T7-Pro only: Burst stream is well-suited for WiFi connections, because WiFi has a lower throughput than other connection types.
Externally Clocked Stream - T7/T8
Externally-clocked stream allows T-series devices to trigger a stream scan from an external clock pulse instead of the internal clock.
The primary use case of this feature is synchronizing the stream scans of multiple LabJacks.
This can also be used to control stream scanning based on any clock source. Even a variable or non periodic clock source.
Normal stream rate limitations do apply, so check the Stream Timing datasheet for more information.
Clock Source
Normally the scan rate is generated from the internal crystal oscillator, but the following register provides the option to specify the scan rate based on an external clock supplied to the appropriate pin (T7: CIO3, T8: FIO2).
To subdivide the external clock pulses for a slower scan rate, use STREAM_EXTERNAL_CLOCK_DIVISOR.
LJM Configuration
To properly use this stream mode, it is recommended that you configure LJM stream timeout appropriately.
By setting LJM_STREAM_RECEIVE_TIMEOUT_MODE to 2, and LJM_STREAM_RECEIVE_TIMEOUT_MS to 0, you can have an indefinite wait between stream scans for non periodic stream pulses.
You can learn more about LJM timing configs and LJM stream configs at the provided links.
Using a DIO_EF as a Clock Source
One option to generate a stream clock is to use the PWM DIO_EF. The clock signal from a single PWM output could be shared between multiple devices. For example, configure a 50 kHz output with 50% duty cycle on the FIO0 terminal of one LabJack. Jumper FIO0 to the appropriate pin (T7: CIO3, T8: FIO2) for use with externally clocked stream. The following pseudocode for the T7 demonstrates the configuration that is required:
STREAM_CLOCK_SOURCE = 2 # Configure externally clocked stream on CIO3
DIO_EF_CLOCK0_ENABLE = 0
DIO_EF_CLOCK0_DIVISOR = 1 # No divisor, the base clock is 80 MHz on the T7
DIO_EF_CLOCK0_ROLL_VALUE = 1600 # 80 MHz / 1600 = 50 kHz output
DIO_EF_CLOCK0_ENABLE = 1
DIO0_EF_ENABLE = 0
DIO0_EF_INDEX = 0 # PWM output on FIO0/DIO0
DIO0_EF_OPTIONS = 0 # Use DIO_EF_CLOCK0 (50kHz output configured above)
DIO0_EF_CONFIG_A = 800 # 800 / 1600 = 50% duty cycle
DIO0_EF_ENABLE = 1
Triggered Stream - T7/T8
T7 minimum firmware: 1.0186
T8 minimum firmware: 1.0021
Stream can be configured to start scanning when a trigger is detected. Trigger sources are DIO_EF modes:
Frequency In (requires two edges to trigger)
Pulse Width In (requires two edges in either direction to trigger)
Conditional Reset (requires one edge to trigger)
Frequency In and Conditional Reset allow you to select rising or falling edges and Pulse Width In will trigger from either edge.
See Appendix A for hysteresis voltage information.
Configuring stream to use a trigger requires setting up a DIO_EF and adding the STREAM_TRIGGER_INDEX register to normal stream configuration. Note that it is not necessary to set any DIO_EF_CONFIG registers; it is only necessary to change the index and enable the feature.
STREAM_TRIGGER_INDEX (address 4024):
0 = No trigger. Stream will start when Enabled.
2000 = DIO_EF0 will start stream.
2001 = DIO_EF1 will start stream.
2002 = DIO_EF2 will start stream.
2003 = DIO_EF3 will start stream.
2006 = DIO_EF6 will start stream.
2007 = DIO_EF7 will start stream.
The delay between the trigger and the first collected sample is one scan period.
To use triggered stream with LJM, see the triggered stream section of the LJM User's Guide.
A more complicated stream trigger can be implemented with a Lua script. For example, a Lua script could check for an arbitrary stream trigger condition in conjunction with triggered stream being started as normal. Once the Lua script detects that the stream condition is fulfilled, it writes a pulse to a digital out (such as DIO3) which is then detected by the normal trigger (as specified by STREAM_TRIGGER_INDEX).
Sub Stream - T8
T8 minimum firmware: 1.0050
Sub Stream is a special stream mode for T8 that allows two separate stream rates at the same time. This feature was primarily developed to measure thermocouples while stream is collecting data at high rates. This limitation exists because the T8’s analog channel temperature sensor cannot be sampled faster then 250Hz with T8’s analog hardware.
To setup a Sub Stream:
Set your normal stream resolution and rate with
STREAM_RESOLUTION_INDEX
andSTREAM_SCANRATE_HZ
.Set which channels you want to run in Sub Stream mode with either the
STREAM_SUB_AIN_MASK
orSTREAM_SUB_AIN#
.Check Sub Stream resolution and rate with
STREAM_SUB_AIN_RESOLUTION_INDEX
andSTREAM_SUB_AIN_RATE
.Start stream normally.
LJM_eStramRead will return your stream channel list each call, but the Sub Stream channels will have repeated values in between updates.