exodriver: mixed differential and single-ended | LabJack
 

exodriver: mixed differential and single-ended

4 posts / 0 new
Last post
exodriver: mixed differential and single-ended

i'm using a U6-Pro with the exodriver in Linux and am having trouble combining differential and single-ended measurements by hacking the example u6allio.c.  the first two signals are differential followed by four single-ended.  my approach so far has been to comment out the for loop that constructs the numChannels of AIN read commands (lines 167-178) and for now just try to get the first two differentials going, but changing numChannels to 2 in line 13 as well as numIterations to 10 (given the time to read high-res), and using this construct:

    // set AIN read command for +/-X
    sendBuff[7] = 2;                                    // IOType is AIN24
    sendBuff[8] = 0;                                    // positive channel is AIN0
    sendBuff[9] = (uint8)(13&15) + (uint8)((0&15)*16);  // ResolutionIndex (Bits 0-3) = 13, GainIndex (Bits 4-7) = 0
    sendBuff[10] = (uint8)(0&7);                        // SettlingFactor (Bits 0-2) = 0
    sendBuff[10] += (uint8)((1&1)*128);                 // Differential (Bits 7) = 1

    // set AIN read command for +/-Y
    sendBuff[11] = 2;                                   // IOType is AIN24
    sendBuff[12] = 2;                                   // positive channel is AIN2
    sendBuff[13] = (uint8)(13&15) + (uint8)((0&15)*16); // ResolutionIndex (Bits 0-3) = 13, GainIndex (Bits 4-7) = 0
    sendBuff[14] = (uint8)(0&7);                        // SettlingFactor (Bits 0-2) = 0
    sendBuff[14] += (uint8)((1&1)*128);                 // Differential (Bits 7) = 1

isn't doing the trick:

Feedback error (Iteration 0): received errorcode 7 for frame 3 in Feedback response.

i've tried a handful of things but can't seem to make it go.  any suggestions?

thanks!

LabJack Support
labjack support's picture
Try setting sendBuff[15] to 0

Try setting sendBuff[15] to 0, power cycle your U6 (only once after changing the code) and see if that helps.

sendBuff[14] = 0;

If the numChannels is set to 2 in the example, the command will be 16 bytes in size. The IOTypes end on the 15th byte (sendBuff[14]), and the 1 extra byte at the end (sendBuff[15]) needs to be set to 0. Note the command size is a multiple of 2 bytes (a word), hence the extra byte.

If that extra byte is not set to zero, potentially you can get an error like you are seeing. Right now your 15th byte is not set and is a "random" value (malloc doesn't initialize values), and I am guessing that "random" value is the IOType for a timer/counter configuration or read function as error 7 (XBR_CONFIG_ERROR) can occur when trying to use a timer/counter before they are enabled.

Regarding some issues I noticed with the u6allio example, it does not set this extra byte in the command to zero. Also, the U6-Pro only goes up to resolution 12, but we mention 13 in the example and low-level documentation. I need to update the example and documentation in regards to these.

LabJack Support
labjack support's picture
The example and Feedback

The example and Feedback AIN24 IOType documentation have been updated.

yep, setting sendBuff[15] = 0

yep, setting sendBuff[15] = 0 did the trick!  i'm now happily collecting data with two differential and four single-ended sensors (with a resolution of 12).

thanks!