StreamConfig
The U3, U6, and UE9 each have a different StreamConfig function.
U3
Stream mode operates on a table of channels that are scanned at the specified scan rate. Before starting a stream, you need to call this function to configure the table and scan clock. Requires U3 hardware version 1.21 or higher.
Command: |
|
|
|
Byte |
|
|
|
0 | Checksum8 |
|
|
1 | 0xF8 |
|
|
2 | NumChannels + 3 |
|
|
3 | 0×11 |
|
|
4 | Checksum16 (LSB) |
|
|
5 | Checksum16 (MSB) |
|
|
6 | NumChannels |
|
|
7 | SamplesPerPacket (1-25) |
| |
8 | Reserved |
|
|
9 | ScanConfig |
|
|
|
| Bit 7: Reserved |
|
|
| Bit 6: Reserved |
|
|
| Bit 3: Internal stream clock frequency. | |
|
|
| b0: 4 MHz |
|
|
| b1: 48 MHz |
|
| Bit 2: Divide Clock by 256 | |
|
| Bits 0-1: Resolution | |
|
|
| b00: 12.8-bit effective |
|
|
| b01: 11.9-bit effective |
|
|
| b10: 11.3-bit effective |
|
|
| b11: 10.5-bit effective |
10-11 | Scan Interval (1-65535) |
| |
12 | PChannel |
|
|
13 | NChannel |
|
|
|
|
|
|
Repeat 12-13 for each channel |
|
| |
|
|
|
|
Response: |
|
|
|
Byte |
|
|
|
0 | Checksum8 |
|
|
1 | 0xF8 |
|
|
2 | 0×01 |
|
|
3 | 0×11 |
|
|
4 | Checksum16 (LSB) |
|
|
5 | Checksum16 (MSB) |
|
|
6 | Errorcode |
|
|
7 | 0×00 |
|
|
NumChannels: This is the number of channels you will sample per scan (1-25).
SamplesPerPacket: Specifies how many samples will be pulled out of the U3 FIFO buffer and returned per data read packet. For faster stream speeds, 25 samples per packet are required for data transfer efficiency. A small number of samples per packet would be desirable for low-latency data retrieval. Note that this parameter is not necessarily the same as the number of channels per scan. Even if only 1 channel is being scanned, SamplesPerPacket will usually be set to 25, so there are usually multiple scans per packet.
ScanConfig: Has bits to specify the stream base clock and effective resolution.
ScanInterval: (1-65535) This value divided by the clock frequency defined in the ScanConfig parameter, gives the interval (in seconds) between scans.
PChannel/NChannel: For each channel, these two parameters specify the positive and negative voltage measurement point. PChannel is 0-7 for FIO0-FIO7, 8-15 for EIO0-EIO15, 30 for temp sensor, 31 for Vreg, or 193-224 for digital/timer/counter channels. NChannel is 0-7 for FIO0-FIO7, 8-15 for EIO0-EIO15, 30 for Vref, or 31 for single-ended. Note that firmware does not support setting the negative channel 199. Instead, specify 31 for single ended measurements. When using the UD driver’s stream functions 199 will be automatically converted to 31 for ease of use.
U6
Stream mode operates on a table of channels that are scanned at the specified scan rate. Before starting a stream, you need to call this function to configure the table and scan clock.
Command: |
|
|
|
Byte |
|
|
|
0 | Checksum8 |
|
|
1 | 0xF8 |
|
|
2 | NumChannels + 4 |
|
|
3 | 0x11 |
|
|
4 | Checksum16 (LSB) |
|
|
5 | Checksum16 (MSB) |
|
|
6 | NumChannels |
|
|
7 | ResolutionIndex |
|
|
8 | SamplesPerPacket (1-25) |
| |
9 | Reserved |
|
|
10 | SettlingFactor |
|
|
11 | ScanConfig |
|
|
|
| Bit 3: Internal stream clock frequency | |
|
|
| b0: 4 MHz |
|
|
| b1: 48 MHz |
|
| Bit 1: Divide Clock by 256 | |
12-13 | Scan Interval (1-65535) |
| |
14 | ChannelNumber (Positive) |
| |
15 | ChannelOptions |
|
|
|
| Bit 7: Differential |
|
|
| Bits 4-5: GainIndex |
|
|
|
|
|
Repeated 14-15 for each channel |
|
| |
|
|
|
|
Response: |
|
|
|
Byte |
|
|
|
0 | Checksum8 |
|
|
1 | 0xF8 |
|
|
2 | 0x01 |
|
|
3 | 0x11 |
|
|
4 | Checksum16 (LSB) |
|
|
5 | Checksum16 (MSB) |
|
|
6 | Errorcode |
|
|
7 | 0x00 |
|
|
NumChannels: This is the number of channels you will sample per scan (1-25).
ResolutionIndex: Resolution index setting of 0-8. 0 corresponds to 1, and is the most common resolution used in stream mode since the data returned is 16-bits per sample. See Section 3.2 for related information. Stream mode is not supported on the hi-res converter (resolutions 9-12 not supported in stream).
SamplesPerPacket: Specifies how many samples will be pulled out of the U6 FIFO buffer and returned per data read packet. For faster stream speeds, 25 samples per packet are required for data transfer efficiency. A small number of samples per packet would be desirable for low-latency data retrieval. Note that this parameter is not necessarily the same as the number of channels per scan. Even if only 1 channel is being scanned, SamplesPerPacket will usually be set to 25, so there are usually multiple scans per packet.
SettlingFactor: Specifies the settling time for all stream channels in 10us increments. If SettlingFactor is set to zero the U6 will attempt to determine the minimum required settling time based on gain and resolution settings. Valid settings are 0 to 255. When set to 0 the U6 will select the minimum required settling time based on gain and resolution settings.
ScanConfig: Has bits to specify the stream clock.
ScanInterval: (1-65535) This value divided by the clock frequency defined in the ScanConfig parameter, gives the interval (in seconds) between scans. While streaming the SPC terminal is toggled to provide information about the stream timing: low at start of scan, high at start of sample, low at end of sample, ..., high at end of scan.
ChannelNumber: This is the positive channel number. 0-143 for analog input channels or 193-224 for digital/timer/counter channels.
ChannelOptions: If bit 7 is set, a differential reading is done rather than single-ended. Bits 4-5 specify the gain:
| GainIndex | Gain | Max V | Min V |
Bipolar | b00 (d0) | 1 | 10.1 | -10.6 |
Bipolar | b01 (d1) | 10 | 1.01 | -1.06 |
Bipolar | b10 (d2) | 100 | 0.101 | -0.106 |
Bipolar | b11 (d3) | 1000 | 0.0101 | -0.0106 |
UE9
Not supported over UDP. Stream mode operates on a table of channels that are scanned at the specified scan rate. Before starting a stream, you need to call this function to configure the table and scan clock.
Command: |
|
|
|
|
|
Byte |
|
|
|
|
|
0 | Checksum8 |
|
|
| |
1 | 0xF8 |
|
|
|
|
2 | NumChannels + 3 |
|
|
| |
3 | 0×11 |
|
|
|
|
4 | Checksum16 (LSB) |
|
|
| |
5 | Checksum16 (MSB) |
|
|
| |
6 | NumChannels |
|
|
| |
7 | Resolution |
|
|
| |
8 | SettlingTime |
|
|
| |
9 | ScanConfig |
|
|
| |
|
| Bit 7: Enable scan pulse output. |
|
| |
|
| Bit 6: Enable external scan trigger. | Minimum | Minimum W/ | |
|
| Bits 4-3: Internal stream clock frequency. | Scan Freq | Divisor | |
|
|
| b00: 4 MHz | 61.1 | 0.239 |
|
|
| b01: 48 MHz | 733 | 2.87 |
|
|
| b10: 750 kHz | 11.5 | 0.045 |
|
|
| b11: 24 MHz | 367 | 1.44 |
|
| Bit 1: Divide Clock by 256 |
|
| |
10-11 | Scan Interval (1-65535) |
|
|
| |
12 | ChannelNumber |
|
|
| |
13 | ChannelOptions |
|
|
| |
|
| Bits 3-0: BipGain |
|
|
|
|
|
|
|
|
|
Repeat 12-13 for each Channel |
|
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
Response: |
|
|
|
|
|
Byte |
|
|
|
|
|
0 | Checksum8 |
|
|
| |
1 | 0xF8 |
|
|
|
|
2 | 0×01 |
|
|
|
|
3 | 0×11 |
|
|
|
|
4 | Checksum16 (LSB) |
|
|
| |
5 | Checksum16 (MSB) |
|
|
| |
6 | Errorcode |
|
|
| |
7 | 0×00 |
|
|
|
|
NumChannels: This is the number of channels you will sample per scan (1-128).
Resolution: Determines the resolution setting for all analog inputs (12-16). See Section 3.2. This function does not support the high-resolution converter on the UE9-Pro.
ScanConfig: If you enable the scan pulse output, Counter1 will pulse low just before each scan (master mode). If you enable the external scan trigger, the UE9 scans the table each time it detects a falling edge on Counter1 (slave mode). Valid combinations for bits 6 and 7 are b00, b01, or b10. You cannot pass b11. Counter1 is automatically enabled and disabled by the stream functions. To provide the highest timing resolution, the scan clock is generally set to the highest setting possible.
ScanInterval: (1-65535) This value divided by the clock frequency defined in the ScanConfig parameter, gives the interval (in seconds) between scans.
ChannelNumber: 0-143 for analog input channels or 193-224 for digital/timer/counter channels.
ChannelOptions: Contains the bipolar setting and gain options for the channel. Following are the nibble values for various gains:
Gain | Unipolar | Bipolar |
*1 | 0×00 | 0×08 |
*2 | 0×01 | NA |
*4 | 0×02 | NA |
*8 | 0×03 | NA |