Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

read multiple analog inputs at the same time

Solved!
Go to solution

Now tried to do as the document via 1 Daq Assistant  but still not working. (Example simple queue) Any Ideas? with this?

0 Kudos
Message 11 of 14
(2,852 Views)
Chairat,

Please use your own thread. You hijacked this one about coding DAQmx with c++ and you are just confusing things. Not a very polite way to post.
0 Kudos
Message 12 of 14
(2,847 Views)
Hongkun,

Look at the help for the DAQmxCreateAIVoltageChan function to see how to configure diff or rse. You can also configure this in MAX.
0 Kudos
Message 13 of 14
(2,841 Views)
Solution
Accepted by topic author Hongkun

Thank you for your reply! It is very helpful! I have checked the DAQmxCreateAIVoltageChan function and learn how to set the correct configuration. So I think I have solved completely my analog input problem. 

 

To sum up:

1, you need to read in multiple analog input lines at the same time in one single task (e.g. set the line address to Dev1/ai0:1)

2, configure the channel to the correct mode in the DAQmxCreateAIVoltageChan, such as DAQmx_Val_RSE or DAQmx_Val_Diff. Be careful, in the example code "Acq-IntClk" installed with the drive, this mode is set to "DAQmx_Val_Cfg_Default", which means the default mode is used. I strongly adviced not using this mode unless you are sure what is actually going on. Personally I find the result is changing every time even I measure the same constant signal.

3, set the correct size of the data array into which  you want to put the acquired data. For example, you are reading 2 lines, each line you want 100 samples, then set this array to data[200] otherwise a buffer error will show up.

 

Hope this can help the others!

0 Kudos
Message 14 of 14
(2,833 Views)