For information about streaming under Windows using the LabJackUD driver, see Section 4.3.7.
In general, a low-level (not using the LabJackUD driver) Ethernet stream is done as follows:
Open TCP connection on port number PORTA.
Call FlushBuffer.
Open TCP connection on port number PORTB.
Call StreamConfig on PORTA to set the scan rate and load the scan table (list of channels to be sampled each scan).
Call StreamStart on PORTA to start the stream.
The UE9 will begin sending StreamData packets to the host using PORTB.
Call StreamStop on PORTA to stop the stream.
3.2.1 - External Triggering
The internal scan clock normally initiates each scan in stream mode. Optionally, an external pulse (falling edge) on the Counter1
FIO line can initiate each scan. In the low level StreamConfig function, this is enabled by setting bit 6 of byte 9. In the LabJackUD
Windows driver this is controlled with the put_config special channel
LJ_chSTREAM_EXTERNAL_TRIGGER
.
One application of external triggering is for synchronized streaming from multiple devices. In such a case, set bit 7 of byte 9 on the
main unit to enable scan pulse output. In the LabJackUD Windows driver this is controlled with the put_config special channel
LJ_chSTREAM_CLOCK_OUTPUT
. The main unit will then use the internal scan clock to initiate each scan, and output a pulse
per scan on the Counter1 FIO line. The output is normally high, goes low at the beginning of each scan, and stays low for about 6
microseconds. All other synchronized units are then configured for an external scan trigger.
Something that could be useful is the ability to define a scan with multiple samples from the same channel. So for instance, a scan
could be defined as channels 0/1/0/1/0/1 or 0/0/1/1 or whatever. This can provide a small burst of samples for each external
trigger. The scan list can have up to 128 channels. When using the LabJackUD driver, duplicate channels in a scan only works if
reading all channels simultaneously, as channel-by-channel stream reads are specified by channel number.
One thing to consider when using external triggering is the buffering that takes place within the UE9 and PC. If the external signal is
fairly continuous, such as in synchronized streaming, this is not a problem, but if the external trigger is more of a one-time pulse the
buffering must be considered to get the data when desired. For instance, each UE9 stream data packet contains 16 samples, so
if there is only 1 sample per scan the UE9 will not send any data until it has accumulated 16 scans. Some applications might
resolve this by defining each scan as 16 samples, even if it is just 16 samples of the same channel (see previous paragraph).
Another buffering issue will come into play if the LabJackUD driver is used with USB communication, as the driver reads 4
packets at a time (64 samples).
Streaming always uses Counter1 internally, and thus Counter1 is not available for counting while streaming. Additionally, if clock
output or external triggering is enabled, the normal Counter1 FIO line will be claimed, which is the next FIO available after all other
enabled timers/counters. If no other timers/counters are enabled, FIO0 will be used for stream clock output or input.
When using external stream clock output or input, the timer/counter configuration should not be changed after starting the stream,
as that could cause a glitch or could even cause the Counter1 FIO pin number to change.
Enabling clock output causes the FIO line to be set to output when the configuration command is executed, but the clock output will
not actually begin until the stream is started. Enabling clock input causes the FIO line to be set to input when the configuration
command is executed, but interrupts will not occur until the stream is started.
Note that external triggering causes 1 scan per trigger pulse. It is not used where a single pulse starts a continuous stream or a
burst of multiple scans, as that type of trigger is better handled in software. In software, an arbitrarily complex set of trigger
conditions can be watched for in continuous stream data, and when the trigger occurs the software can “keep” a specified number
of scans, “keep” all scans while the trigger is true, or whatever other behavior is desired. In addition, the software can maintain a
history buffer and “keep” a specified number of scans before the trigger (pre-trigger scans). Since stream data can consist of
analog, digital, and timer/counter inputs, the trigger conditions can use any or all of those.
3.2.2 - Streaming Digital Inputs, Timers, and Counter0
There are special channel numbers that allow digital inputs, timers, and Counter0, to be streamed in with analog input data.
Table 3-6. Special Stream
Channels
Channel#
193
EIO_FIO
194
MIO_CIO
200
Timer0
201
Timer1
202
Timer2
203
Timer3
204
Timer4
205
Timer5
210
Counter0
224
TC_Capture
Channel number 193 returns the input states of 16 bits of digital I/O. FIO is the lower 8 bits and EIO is the upper 8 bits. This
channel is generally used to acquire digital input data in stream mode. Channel 194 is the same thing for the CIO and MIO lines
(Control firmware V1.69 or higher). The CIO are in the lower byte and the MIO are in the upper byte.
Channels 200-205 and 210 retrieve the least significant word (LSW, lower 2 bytes) of the specified timer/counter. At the same
time that any one of these is sampled, the most significant word (MSW, upper 2 bytes) of that particular timer/counter is stored in
an internal capture register (TC_Capture), so that the proper value can be sampled later in the scan. For any timer/counter where
the MSW is wanted, channel number 224 must be sampled after that channel and before any other timer/counter channel. For
28
Summary of Contents for UE9
Page 84: ...84 ...