Analog input while streaming timer values

6 posts / 0 new
Last post
IanMcCutcheon
IanMcCutcheon's picture
Analog input while streaming timer values

I've setup my U3 to run two timers (one for a 8 bit PWM output and the other to measure the time between external pulses).  To get the time values I have a C# application that reads the stream every 100 ms from a system timer callback.  This has been working fine.  I've now added reading an analog input using the LJUD.eAIN function within the same timer callback.  If I run the stream by itself it works fine.  If I run the analog input by itself it works fine.  But if I run them both I get a Communications failure exception thrown by LJUDDotNet.DLL when performing the analog input.  Any idea what is going on?

Thanks

 

LabJack Support
LabJack Support's picture
Stream mode takes over the

Stream mode takes over the analog input system, even if you are not streaming any analog inputs.  While a stream is active, you can't do command-response reads of analog inputs.

I would have expected a more precise errorcode, but I just tested and get the same 1008 errorcode.

 

IanMcCutcheon
IanMcCutcheon's picture
Thank you for your really

Thank you for your really prompt feedback.  Do I have any option available to me as I would really like to be able to read the analog channel?

 

 

LabJack Support
LabJack Support's picture
The 2 options I see are add

The 2 options I see are add the analog input to your stream or use a 2nd LabJack.

IanMcCutcheon
IanMcCutcheon's picture
Thanks - that is what I

Thanks - that is what I figured.  Adding it to the stream works.

Thanks again.

LabJack Support
LabJack Support's picture
In regards to the first post

In regards to the first post and the "Communications failure" (1008) error, as pointed out there will be an error when using command-response reads while stream mode is running. "Communication failure" is being returned in general when there is a specific error from U3, but it should have been the "Stream is running" (25) error. This will be fixed in an upcoming release. Thanks for making us aware of this.