04-03-2017 10:56 AM
Hello dear friends,
I am developing a labview file for real-time monitoring of two analog values from a motor drive with the help of a NI-USB-6211 device. For this, I use a timed loop (see diagramm attached) in which I read the signals with DAQmx, one point at a time and then end the loop on the next sequence with a "Wait until next" block so that I acquire the data precicely every 100ms.
With one signal only it works fine. But with the two signals, I get error -50103. I suscpect that it has to do with the execution order. I would prefer to read the two values simultaneously, but obviously this is not possible. Do I have to rearrange the "error" signal of the blocks? Or do I need to place the two analog read blocks in two sequences? Would it help if I add a sample clock?
Thank you very much.
04-07-2017 01:56 AM - edited 04-07-2017 01:59 AM
Hello Lysandros89,
gladly I'll point you into the right direction. First of all the USB bus is not deterministic and I think this is the wrong subforum.
The error you are seeing comes from the fact that the USB-6211 supports only one analog input task at a time. That means you need to add both your channels to the same task to avoid error -50103. You'll need to change the read VI to multiple channels.
Currently, you are aquiring your data with software timing and it's likely that your 100ms requirement will not be fulfilled due to jitter. You need to use the DAQmx Timing VI and set it to Sample Clock with a rate of 10 Hz which ensure that your samples are acquired hardware-timed.
In all cases, please convert the timed loop to a normal while loop.
Kind regards
04-07-2017 10:39 AM - edited 04-07-2017 10:51 AM
Hello,
thanks for the helpful remarks. I am aware that the USB is not deterministic and that also my 6211 only features one A/D-converter.
Now I added both channels to one task and I think it works now. I just need to figure out how to unbundle the result, because it must be a 1x2-array at each sample.
When I add two channels to the same taks, is my NI-device using both the sample clock and the convert clock for scanning? Is the convert clock automatically adapted to the channel number, so that this runs twice as fast as the sample clock?
Also, the tip for adding a DAQmx-Timing VI with Sample clock to ensure that my acquisition will run with 10Hz, sounds very promising. But since I "read" once in every loop iteration, the acquisition rate cannot be dictated by the Timing VI, because I leave the loop and enter it again after one sample (two channel scans) right?
Thanks and I wish a pleasant weekend
04-10-2017 02:23 AM
Hello,
You can use the "Index Array" VI to get the values of each channel separately.
If you use Sample Clock Timing, by default, DAQmx creates a buffer. You'll need to read fast enough to be able to keep the buffer from overflowing. I would not recommend using the read VI with configuration NChan 1 Samp because you more likely to run into buffer overflow conditions that way. Since you are using a Windows OS and a USB device, hw-timed single point acquisition (without buffer) is not possible.
The convert clock is configured automatically according to your channel and sampling configuration. More information on how the convert clock is determined, you can read up here: http://digital.ni.com/public.nsf/allkb/42484E84DA98053686256D32006E0494
Since you are doing a monitoring application: Where is the problem in reading data in chunks rather than single samples?
Kind regards
04-10-2017 08:47 AM
Thanks for the NI-Paper on the DAQmx-Convert Clock and the remars on the buffer.
Actually it is not a monitoring application, but a real-time motion-control application, so I prefer to read single samples rather than chunks. In the future I will use Veristand & a PXI-Platform and try to communicate with sensors & actuators via EtherCat, which as far as I know, must be a hard real-time deterministic setup, right? 🙂
I know that Windows OS and M-Series devices are not quite suitable, but I am experimenting to see what challenges/probles might come up ahead, more on the hardware/cabling side.
Best regards