Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog input to modulate triggered sine wave analog output

I'm new to Labview and having trouble getting my app to program correctly.
I would like to use an analog input (AI) to modulate the amplitude of a 100 kHz sine wave and output the results to an AO.  This is a real time application: the AI will change every few 10's of ms so during one "cycle" the amplitude will be modulated many times. Plus, the entire AO will be triggered on and off with a digital input TTL trigger. The waveform "cycle" will run continuously and so will the AI.

    I've used an example included with Labview to read the AI and a separate one to generate the sine wave and trigger it on and off, but cannot combine the two together. I assume what I need to do is implement a loop properly but when I try I can only trigger the AO on and off and the AI does nothing or is static. I assume that the vi just takes one point from the AI and uses that to determine the amplitude of the sine wave, but doesn't "redraw" the sine fast enough to respond to the AI changes.

Thanks,
Ethan

0 Kudos
Message 1 of 8
(4,409 Views)

Hi Ethan,

It sounds like you are almost finished with your application.  I think that you are on the right track by looking into the sequencing of your program.

I'm curious to know which version of LabVIEW Real-Time are you currently using for your application and which DAQ boards do you have? It would also help if you could tell me which example programs you are using and provide a description of how your program is currently sequenced.

Regards,
Hal L.

 
0 Kudos
Message 2 of 8
(4,383 Views)

Hal,

I do not think I have Labview Realtime (unless it comes standard with the full version of Labview ). Do I need to have that? I have a 6251 DAQ board.

I've enclosed my program- it has the name of the original included program in its file name so you can see that I didn't do much to change it. I made some changes today (to make it non regeneration) but now can't get the AI to read at all. And I have no idea how to modulate the sine amplitude using the AI.

The sine wave works fine and triggers as needed. The one problem is that the sine wave doesn't end at the same point (phase) each trigger period so during the times between triggers the DC level on the AO is variable (which I do not want). Is there a way to end the sine wave at the same phase (at the zero crossing) while still triggering it with a digital input.

Thanks,

Ethan

 

0 Kudos
Message 3 of 8
(4,371 Views)

Hi Ethan,

I took a look at your code and there were a couple of things that stood out.  With both your analog input and analog output operations, you are reading and writing before you start your tasks. It would be best if you took the DAQmx start task vi's and moved them in front of the while loop. It also looks like you are outputting a completely different set of data than what you are acquiring. I recommend performing modifications of the data you acquire and then wiring that directly into the DAQmx write vi.

I found a simultaneous analog input and analog output example that could help you develop your application.  You will have to modify it, but the vi's are already in the proper order for both the analog input and analog output operations. Go to Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Synchronization >> Multi-Function-Synch AI-AO.vi. 

Regards,

Hal L.

0 Kudos
Message 4 of 8
(4,339 Views)

Hal,

I moved the start VIs in front of the loop. And it didn't change much, yet.

I know that the AI isn't wired to the AO- that's my biggest problem. I want to be able to use the AI amplitudes and run them into the basic function generator.vi to adjust its amplitude, but I can't figure that out. It also appears that I cannot read in the AI now.

Essentially, I want to create a mixer, that uses the AI to control the amplitude of the sine wave that is sent to the AO. When the DI triggers, it looks at the AI and then outputs the modulated signal at the same time.

Thanks,

Ethan

0 Kudos
Message 5 of 8
(4,328 Views)
Hi Ethan,

It sounds like you are trying to take your analog input and send it directly into your analog output for an audio application.  The PCI 6251 card will not be able to support this. There is a way where you will be able to acquire and measure a static tone and scale it to your analog output, but this may not be quite what you are looking for, but please let me know if this will work for you. 
 
Regards,
Hal L.
0 Kudos
Message 6 of 8
(4,298 Views)
Hal,
I don't want to send the input directly to the output; I want to use a sine wave as the output and just use the analog input to modulate it. Of course, neither the input or output will be static. But the sine wave frequency will be constant, only the amplitude will change to follow the analog input. Is this possible with the 6251?
   I've included a .jpg of the general idea.

Ethan

0 Kudos
Message 7 of 8
(4,288 Views)

Hi Ethan,

Unfortunately, this is not possible with the PCI-6251. The properties that are necessary to perform this operation with the PCI-6251are not supported.

Regards,

Hal L.

0 Kudos
Message 8 of 8
(4,259 Views)