LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to continuously write to analog output and read from analog input

Solved!
Go to solution

Hi all-

 

I had a question regarding continuously writing to analog output while simultaneously reading from an analog input.

 

This is my first time posting a message to the community, so please let me know if I make any mistakes.

 

I am using Labview 2011, with a NI-DAQ USB 6215.

 

I am attempting to generate a waveform, and continuously write it to an analog output. This is then connected to an analog input on the DAQ, from which I am trying to sample the signal. ( I realize this is a trivial system, but I am hoping to build on it once I get it to work).

 

The task of reading from the analog input works fine, as I have tested it in several other cases. I am having a problem writing to the analog output.

 

For this task, I have tried to follow  the "Cont Gen Wfm Int Clck" VI to generate the waveform and start the task. I then try to write to the analog output in the timed loop. However, it does not seem to transmit a signal, and does not give me any errors.

 

I have attached the VI as well as a screenshot.

 

Please let me know if anyone has any ideas. I would really appreciate the help!

 

Thanks, 

 

Peter Borgstrom

 

Download All
0 Kudos
Message 1 of 3
(6,517 Views)
Solution
Accepted by topic author npborgstrom

Let's consider your tasks one at a time.  First, the Waveform Generation/Analog Output task.  You generate a Waveform (I'm uncertain from your VI if this is a fixed Waveform or not) and send it to an Analog Output function set to output a Waveform continuously, using N channels and N samples (where you've defined these previously).  You should not put this inside a Timed loop, as the DAQ hardware has its own clock -- if you put it simply into a While loop (with a Stop to get out of the loop), the loop will call the function for the first N points, wait until all N have been output, then call it again for another N points (until you push Stop).

 

Assume, now, that you have the output voltage connected to a load (say a suitable resistor).  You can wire the Input terminals of your A/D converter across the same load, and set up a similar Analog Input loop, running in parallel (i.e. in its own While loop, independent of the AO loop).  You could start them together (by having, say, a merged Error Line from the initialization code of the AI and AO loops become the Error Lines into the "sampling loops" described above), but you might want to delay (slightly) the AI loop so that the AO has a chance to set the voltage before the AI reads it.

 

Hope this helps.

 

BS

Message 2 of 3
(6,489 Views)

Thank you Bob! 

 

That was very helpful!

 

Peter

0 Kudos
Message 3 of 3
(6,479 Views)