Hi,
I have some problems to configure LJ to obtain an stream for analog input in FIO4 (refered to GND). The desired sample rate is 10 KHz and the number of samples 1000. I have trying many configuration (different number of samples, sample rates) but the result is always the same "LabjackUD Error #7 Unable to configure stream".
Any idea?
I use C# on W10, LJ U3-HV.
The same configuration works on w7 but doesn't on w10.
Thanks!
What are you using for software?
Does LJStreamUD.exe work?
Use "config defaults" in LJControlPanel to write factory defaults, then close LJCP and power cycle the U3 and try streaming again.
I use C# language in windows 10.
With LJStreamUD.exe works fine, same analog inputs, same sample rate.
I use an example code from your docs. FIO0-FIO4 are defined as analog inputs, then the code to obtain the stream
AddRequest(ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.STREAM_SCAN_FREQUENCY, 10000, 0, 0);
AddRequest(ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.STREAM_BUFFER_SIZE, 1000, 0, 0);
AddRequest(ljhandle, LJUD.IO.PUT_CONFIG, LJUD.CHANNEL.STREAM_WAIT_MODE, (double)LJUD.STREAMWAITMODES.SLEEP, 0, 0);
AddRequest(ljhandle, LJUD.IO.CLEAR_STREAM_CHANNELS, 0, 0, 0, 0);
AddRequest(ljhandle, LJUD.IO.ADD_STREAM_CHANNEL_DIFF, 4, 0, 32, 0);
GoOne(ljhandle);
eGet(ljhandle, LJUD.IO.START_STREAM, 0, ref rate, 0);//here the error
eGet(ljhandle, LJUD.IO.GET_STREAM_DATA, LJUD.CHANNEL.ALL_CHANNELS, ref numScans, data);
I will try to reset the LJ.
Thanks!
You'll want to make sure FIO4 is configured for analog input. A "LabjackUD Error #7 Unable to configure stream" will occur if you try to stream from an FIO/EIO line as an analog input but it is currently configured as digital I/O.
The example configures FIO0 and FIO1 as analog inputs, and the rest digital I/O. Before configuring and starting stream mode, configure FIO0-FIO4 as analog inputs like so:
// Configure FIO and EIO lines. Start from channel 0 and update all 16 flexible bits.
// FIO0-FIO4 will be analog inputs, and the rest digital I/O (b0000000000011111 = d31).
ePut(ljhandle, LJUD.IO.PUT_ANALOG_ENABLE_PORT, 0, 31, 16);
Ok, I have set FIO4 as analog input just before the configuration of the stream. Then another exception appears, just in the moment of getteing the stream data,
LJUD.eGet(miDAQ.ljhandle, LJUD.IO.GET_STREAM_DATA, LJUD.CHANNEL.ALL_CHANNELS, ref numScans, data);
An unhandled exception of type 'System.AccessViolationException' occurred in LJUDDotNet.dll
Maybe the .dll is not the properly version?
Regards
Use LJUD.eGetPtr instead when reading the samples. LJUD.eGet is not 64-bit safe when passing arrays/pointers which can lead to the error you are seeing. LJUD.eGetPtr is both 32 and 64-bit safe with arrays/pointers. The U3 examples are a bit old and some examples need to be updated with eGetPtr to account for arrays and 64-bit builds. I'll add a todo about updating those.
That was the issue, now it works fine.
Thank you!