LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read in one AI and send it out two Analog Outputs

Hello, my name is Jason. I am a senior engineering major at UCO in oklahoma.  We are designing a signal splitter and we are trying to simulate it in LabVIEW. I feel like this should be easier than it is, but I can't make it work. Here is what im trying to do.  

 

I want to input a signal on a single analog input, split it in labview, and have it go out both AO0 and AO1 analog outputs at the same time.  So I should be able to input, via a function gen, a sine wave, output that signal on both analog outputs, and monitor those outputs with a o-scope.  I can't make that work.  I can sample it in and send it out one AO and when I change the frequency or amplitude I can see that change on the scope, but how can I do that and have it go out both AO's? 

 

I really appreciate any help on this. I have searched and tried to find an answer, but everything I have found doesn't seem to do exactly what I want. 

 

Thanks a lot, 

Jason 

0 Kudos
Message 1 of 21
(3,064 Views)

If you had included a copy of your code, it would have been easier to tell you what to do.  But I'll try.  When you create an analog output channel, list two channels instead of just one. This will cause two outputs to be generated.  Now you have to duplicate your data for both channels.  If your data is a waveform type, just create an array and wire the waveform into two array elements.  This will cause the first element to go to the first analog output, and the second element to go to the second analog output.  Since the two elements are the same, the outputs will be the same.

Here is a simple example.  There is much left out, like setting up the sine wave frequency and such, and setting up the DAQmx timing, triggering, and such.  But it shows how to output a signal on two analog outputs.

 

Example_VI_BD.png

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 21
(3,059 Views)

Hey tbob, thanks a lot for replying so fast.  I didn't have access to the computer with the code on it or I would have posted it.  (Still don't)

 

The code I have up to now is actually very similar to what you posted.  I am very new to using the individual DAQmx VI's so you will have to forgive me for asking dumb questions. I have taken one of the LV examples and chopped it up and used the pieces I think I need for AO.   I am sampling the AI with a DAQAssist VI and am passing that into the build array VI and then into the DAQmx write VI.  From the example, it looked like I have to input the signal to the timing VI as well, so I did.  

 

Here's my result. As soon as I run the program, the scope shows both signal, one from each AO until I stop the program. (This is what I need)  The only problem at this point is, when I change the signal coming out of the function generator, that change is not reflected on the scope. It continues to show the initial signal.  

 

I need it to be dynamic in the sense that what is getting sampled in, goes out both AO's in real time.  

 

When I monitor the output of the AI DAQAssistant VI I see the wave that I am inputting and I see the changes, so I know the DAQmx write VI is seeing those changes as well but the scope shows neither AO's changing. 

 

Why is the AO not updating when the input signal changes? 

 

Thank! As soon as I get to that computer I will post the code online. 

 

-Jason 

0 Kudos
Message 3 of 21
(3,041 Views)

Without seeing the code, it is hard to tell.  I'm guessing that you are outputing the signal inside a loop, and that the sine wave is being generated before the loop, or that the waveform properties (frequency, amplitude, etc) is being read only one time, before the loop.  To make the change dynamic, you have to put the section that reads the front panel controls (freq, ampl) inside the loop.

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 21
(3,034 Views)

Ok, I will post the code as soon as I can.  

 

I am outputting the signal in a loop so it is continuos, but I am not generating anything.  I am sampling in a sine wave (just because that is what im producing on the function generator) and wanting to send that signal right back out, only on two different outputs instead of one.  So I have no settings for amplitude or frequency settings. Those are defined at the  function generator. 

 

Thanks for helping me out! 

 

-Jason 

0 Kudos
Message 5 of 21
(3,027 Views)

You simple need to create front panel controls for the function generator and place the controls and the function generator inside your loop.  This way, when you change the frequency, it will be read on the next loop iteration and the output will be changed.  Like this:

 

Example_VI_BD.png

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 21
(3,000 Views)

I understand that, if I was generating a signal within labview, but I am reading in a signal generated by an outside function generator and wantig to pass that AI to both AO. I am sampling in the signal with a DAQ Assistant VI.

 

-Jason

0 Kudos
Message 7 of 21
(2,987 Views)

Put your AI read inside the same loop that writes to the AOs.

 

Example_VI_BD.png

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 21
(2,980 Views)

That makes sense. Do I not need the DAQmx timing VI for anything?

 

-Jason

0 Kudos
Message 9 of 21
(2,975 Views)

You don't need timing unless you want to send out the signal at a specific interval.  In you case, the timing is built into the signal and you send it out continuously.  No DAQ timing required.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 21
(2,932 Views)