Quantcast
Channel: Digital I/O topics
Viewing all articles
Browse latest Browse all 2176

read multiple analog inputs at the same time

$
0
0

Hello all,

 

I am using USB-6001 and want to develop a multiple task app in C++. I am trying to read multiple analog inputs at the same time, but get some errors. To make it simple, I copy one of the example code to read in analog data in one channel then turn it into a function. Then I call this function in thread with different pin names (such as Dev1/ai0, Dev1/ai1) and I come cross this error:

 

"The specified source is reserved. The operation could not be complete as specified"  status code -50103

 

I search the forums, this may because I use hardware timing in this function, and this hardware timing cannot be use at the same time by several tasks. I may have to put all lines I want to read in one single task (such as Dev1/ai0:1). In this way I can read two lines at the same time. However, when I try this, I meet other error:

 

"buffer is too small to fit read data" status code -200299

 

So, here is my question, what should I do if I do want to read multiple analog inputs at the same time? Is the thing that hard timing cannot be use by multiple tasks true? If I have to read multiple lines at a single task, how do I set the parameters?


Viewing all articles
Browse latest Browse all 2176

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>