U6 exodriver stream | LabJack

U6 exodriver stream

2 posts / 0 new
Last post
akselk's picture
U6 exodriver stream

Hi! I'm trying to use the exodriver stream example (u6Stream.c) to get measurements from two 3 axis magnetometers.

This requires me to read either 3 or 6 channels by differential in a stream. In the example it is stated that nr of channels must be and even multiple of 25 (samplesPerPackage). Is there any way around this? 

File Attachment: 
LabJack Support
labjack support's picture
When streaming you can set

When streaming you can set SamplesPerPacket to 25 and have 3 or 6 channels. In general SamplesPerPacket is recommended to be 25 for efficiency, and will work with any number of NumChannels (that are valid).

The u6Stream.c example is just trying to be simple when it mentions SamplesPerPacket needing to be a multiple of NumChannels, and makes the math work out nicely for array sizes. If it is not a multiple, make sure to update this line of code:

double voltages[(SamplesPerPacket/NumChannels)*readSizeMultiplier*numReadsPerDisplay*numDisplay][NumChannels];

Since SamplesPerPacket/NumChannels is using integer math and will round down, causing the voltages array to be too small leading to array access being out of bounds.

Also, take a look at our differential readings app note:


It can help determine if differential readings are needed, or if single-ended is what you want.