Feedback and FeedbackAlt (UE9 Only)
A very useful function that writes/reads almost every I/O on the LabJack UE9.
Note: Feedback command should not be called while streaming. FeedbackAlt with no analog inputs is allowed.
Feedback Command: |
|
|
Byte |
|
|
0 | Checksum8 |
|
1 | 0xF8 |
|
2 | 0×0E |
|
3 | 0×00 |
|
4 | Checksum16 (LSB) |
|
5 | Checksum16 (MSB) |
|
6 | FIOMask |
|
7 | FIODir |
|
8 | FIOState |
|
9 | EIOMask |
|
10 | EIODir |
|
11 | EIOState |
|
12 | CIOMask |
|
13 | CIODirState |
|
|
| Bits 7-4: Direction |
|
| Bits 3-0: State |
14 | MIOMask |
|
15 | MIODirState |
|
|
| Bits 6-4: Direction |
|
| Bits 2-0: State |
16 | DAC0 (LSB) |
|
17 | DAC0 |
|
|
| Bit 7: Enabled |
|
| Bit 6: Update |
|
| Bits 3-0: Upper 4 bits output |
18 | DAC1 (LSB) |
|
19 | DAC1 |
|
|
| Bit 7: Enabled |
|
| Bit 6: Update |
|
| Bits 3-0: Upper 4 bits output |
20-21 | AINMask |
|
22 | AIN14ChannelNumber |
|
23 | AIN15ChannelNumber |
|
24 | Resolution |
|
25 | SettlingTime |
|
26 | AIN1_0_BipGain |
|
27 | AIN3_2_BipGain |
|
28 | AIN5_4_BipGain |
|
29 | AIN7_6_BipGain |
|
30 | AIN9_8_BipGain |
|
31 | AIN11_10_BipGain |
|
32 | AIN13_12_BipGain |
|
33 | AIN15_14_BipGain |
|
|
|
|
|
|
|
Response: |
|
|
Byte |
|
|
0 | Checksum8 |
|
1 | 0xF8 |
|
2 | 0×1D |
|
3 | 0×00 |
|
4 | Checksum16 (LSB) |
|
5 | Checksum16 (MSB) |
|
6 | FIODir |
|
7 | FIOState |
|
8 | EIODir |
|
9 | EIOState |
|
10 | CIODirState |
|
11 | MIODirState |
|
12-13 | AIN0 |
|
14-15 | AIN1 |
|
16-17 | AIN2 |
|
18-19 | AIN3 |
|
20-21 | AIN4 |
|
22-23 | AIN5 |
|
24-25 | AIN6 |
|
26-27 | AIN7 |
|
28-29 | AIN8 |
|
30-31 | AIN9 |
|
32-33 | AIN10 |
|
34-35 | AIN11 |
|
36-37 | AIN12 |
|
38-39 | AIN13 |
|
40-41 | AIN14 |
|
42-43 | AIN15 |
|
44-47 | Counter0 |
|
48-51 | Counter1 |
|
52-55 | Timer0 |
|
56-59 | Timer1 |
|
60-63 | Timer2 |
|
IOMask: Mask each bit of digital I/O individually. If a bit is 1, then the new direction and state values will be written to that bit of I/O. If a bit is 0, only a read of state and direction will be done.
IODir: 0 is input, and 1 is output.
IOState: As a write parameter, only has an effect if a line is set to output. For each bit, 0 is output-low, and 1 is output-high. As a read parameter, it returns the current input state of each line where 0 is low and 1 is high.
DAC#: The UE9 has 12-bit analog outputs, so pass an output value between 0 and 4095, plus set bits 6 and 7 of the high byte accordingly. Bit 6 specifies whether the given DAC will be updated with the new value. If Bit7 is set on either DAC, then both are enabled. To disable the DACs (set to high-impedance), bit 7 must be 0 for both DACs.
AINMask: If a bit is 0, the corresponding channel will not be acquired (saving time), and will return 0 as a reading.
AIN14/15ChannelNumber: Generally used to choose one of the internal channels, but any channel can be used.
Resolution: Determines the resolution setting for all analog inputs (12-17). See Sections 2.7, 3.1, and 3.2. This function does not support the high-resolution converter on the UE9-Pro.
SettlingTime: Adds extra settling time before acquiring each channel. The extra delay is this value multiplied by about 5 microseconds.
BipGain: Contains the bipolar setting and gain options for two analog input channels. The high nibble controls the higher channel number. The high bit of each nibble is the bipolar option and the lower 3 bits of each nibble are the gain index. 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 |
AIN#: Returns raw analog input conversions. Regardless of Resolution, the value returned is 0-65520, where 0 is the minimum (unsigned, not 2’s complement).
Counter#: Returns the current count from the counters if enabled. Use the function TimerCounter to enable and configure the counters.
Timer#: Returns the values from the first 3 enabled timer modules. Use the function TimerCounter to enable and configure the timer modules.
The LabJackUD driver for Windows uses a modified version of the Feedback function called FeedbackAlt. This modified function has additional parameters added to specify channel numbers for all 16 analog input reads, making it useful when using extended channels or more than 2 internal channels.
The command for FeedbackAlt is the same as Feedback, except that AINxChannelNumber parameters are added for channels 0-13 (new bytes 34-47). The command number (byte 3) changes to 0x01 and the number of data words (byte 2) changes to 0x15.
The response for FeedbackAlt is the same as Feedback, except that the counter/timer reads are removed, and thus the response is 44 bytes long. The command number (byte 3) changes to 0x01 and the number of data words (byte 2) changes to 0x13.
The order of execution in hardware for either function is:
Write digital I/O.
Read digital I/O.
Write analog outputs.
Read analog inputs.
Read timers and counters (skipped in FeedbackAlt).