10-06-2017 09:30 AM
Hi everyone,
I am trying to set up a relatively straightforward system which repeatedly outputs a pre-defined array of analogue voltage values via terminal ao0 while simultaneously reading corresponding (synchronised) input voltage levels from a voltage sensor attached to an analogue input terminal ai7.
It is mostly working except the measured input V data shows a kind of "compressed" version of the expected signal. The signal is acquired but with much smaller number of data points than has been defined, and seemingly over a much shorter time than defined (see attached screenshot example). The attached front panel screenshot shows some numerical conditions including the number of data points requested and the number received.
I can force the number of samples to be read to the original higher amount by re-defining it at the DAQmx Read VI in the loop but this just extends the data array acquired to include a longer trail of noise after the signal is measured. I have set an example sample number and rate of 20k so as to expect 1s time per loop. The output terminal ao0 is clocked via the OnboardClock. The input terminal ai7 is clocked and triggered via the output sample clock. I have a feeling the issue is related to these settings and the way I am queuing the data perhaps.
I am using an NI PCI-6221 DAQ connected to the sensor and output scanner via a NI breakout board. LabVIEW version is 2014.
Any and all help much appreciated! Many thanks in advance.
Ross
Solved! Go to Solution.
10-06-2017 09:51 AM
When I run your VI with a simulated PCI-6221 it works perfectly. My only improvement recommendation would be that you request exactly 1s of data from your DAQmx-Read VI:
Your screenshot of your frontpanel also indicates that an error occured, but the error-code number that you put as an indicator in your VI is not shown in the screenshot. I recommend to evaluate that error code number...
Regards, Jens
10-06-2017 11:20 AM
I see some other issues to consider:
1. You need to start the AI task *before* the AO task to be sure their start times are sync'ed. Then the AI task will be started and "aware" when the AO task asserts its start trigger and first sample clock pulse. (BTW, you really don't need to configure AI triggering. The shared sample clock alone will be at least as effective, possibly better, once you sequence the DAQmx Start's.)
2. It's unclear to me why you have an AO task configured to allow regeneration, but then you keep feeding it the same data repeatedly anyway via DAQmx Write.
3. The way you write, read, and display are probably misleading you a bit.
-Kevin P
10-11-2017 08:02 AM - edited 10-11-2017 08:02 AM
Many thanks guys, this has helped solve the issue and better equip me for projects in future.
Best wishes,
Ross