05-26-2018 04:02 AM
Hello,
I write a labview program to generate an AO and at the same time read data from the AI. The AO terminal is wired to the AI terminal of the NI-USB-6251. However, I found that the AI cannot keep up with the change of AO (The peak value of AO is 2V and the peak value of AI is 1.6V) . Please see the attached files of the front panel and the block diagram. Does anyone know how to solve this problem?
05-26-2018 04:43 PM
Please attach an actual VI rather than PDF's. (Save the acquired data as default in those indicators.)
Are you getting any errors? My thought is that you don't have a synchronization between your input clock and output clocks. Since you are writing and reading at the same rate, you might be getting an aliasing effect on your analog input because it is capturing data while the analog output is transitioning.
05-27-2018 10:21 AM
Hello RavensFan,
Really thank you very much for your kind help. Attached please find the VI written by Labview 7.1.
I did not get any error message when I run the VI. However, I found that the peak voltage of the AO output is always higher than the peak voltage of the AI input by about 0.3-0.4V when I pressed the stop button. Changing either or both AO and AI sampling rates do not help. Do you know what is happening? Your help is much appreciated.
05-29-2018 02:49 PM
I'd be curious if there is any resistance causing this. If you cut the output peak to 1V, is the difference (.4V) halfed as well (to .2V)?
05-29-2018 05:04 PM
Hello Trevor,
Thank you very much for your reply. As the output voltage is increased, the difference between the AO and AI is always about 0.4V. It seems that after the AO executes in the loop, the AI executes in the next round of the loop. There is a delay between the AO and AI.
05-29-2018 06:58 PM
Neither your tasks nor data are as synced as you probably want, nor as synced as you may think.
I've been in a number of similar AO/AI syncing threads, here's one. The initial example illustrates how to get the basics of sync working -- share a sample clock, start the slave task (AI) before the master (AO). The rest of the thread addresses how to avoid a problem similar to what RavensFan warned about in msg #2 of this thread.
There are a few options, a couple from me and one from an NI AE. Try one out and post back if still having trouble with sync.
(Note: don't worry about whether the AO *graph* looks synced with the AI *graph*. There's buffering involved with both tasks so they *won't* look synced. Just compare the AI data that measures the AO to the known data you're trying to generate.)
-Kevin P
06-01-2018 09:58 AM
Hello Kevin,
Thank you very much for your valuable suggestions. I will try it out when I come back to office and will inform you the result later.
Have a nice weekend.
06-04-2018 07:08 AM
Hello Kevin,
I could repeat your example about AO/AI synchronization of the ramp waveform. Please see the attached pdf files and vi. However, what I want is that, AO can generate a ramp waveform from 0 to 1V for 0.5s and during that time AI reads the waveform. Then for the next 0.5s, AO can generate a ramp waveform from 0 to 2V and during that time AI reads the waveform. Then for every 0.5s forward, the AO keeps on generating a ramp waveform 0 to 3V, 0 to 4V and stop at 0 to 5V, AI can read those waveforms in synchronization. I have no idea of how to do that. Could you give me some suggestions? Thank you very much.
Jacob
06-04-2018 07:29 AM
It appears (to me) that your device, the USB-6251, uses "Legacy DAQ", and has (accordingly) been "obsolete" for about a decade. When I started using LabVIEW (about 12 years ago), with LabVIEW 7.0 and lots of DAQ hardware programmed with Legacy DAQ, figuring out how DAQ worked was my biggest headache. Then came DAQmx (which, fortunately, my PXI-based hardware would accomodate) and most of my problems "went away".
You might consider a one-time cost of getting a DAQmx-compatible device, such as the USB-6351 (which seems to have equivalent specs). If you don't need quite the sample speed or bit width, there are less expensive options as well.
In any case, it is much simpler to program and synchronize the new DAQ multi-function devices to do simultaneous AI and AO, with multiple examples in LabVIEW, on the Forums, and on the Web.
Bob Schor
06-04-2018 08:19 AM
Hello Bob,
Thank you very much for your suggestion. Although USB-6251 is very old, it works with NI-DAQmx8.9 without any problem. I am now using NI-DAQmx8.9 with labview 7.1 for programming.
Jacob