LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate frequency sweep using daqmx write and also perform read operation in same code.

Hey All, 

I have made this code which can transmit a signal through output channel of the board into the water pipe from one end and then receive the signal from the other end of the pipe into the input channel of the same board. The write and read operations in my code are synchronized. Currently, I am sending a sine burst of 1msec duration followed by 1 second of zero voltage. So, my daqmx write task is sending this wave (sine burst+DC) repeatedly. But I want that mmy output channel should be able to do frequency sweep, ie my first output signal should be sine burst (5KHz) of 1msec + 1 sec DC, immediately after this next signal should be sine burst (6KHz) of 1msec + 1 sec DC......upto sine burst (50KHz) of 1msec + 1 sec DC. Basically, I want to sweep frequency using sine burst (with 1 sec gap between two burst) in step of 1KHz and simultaneously perform the read operation too. I have attached the vi. I have also attached the image which shows the desired output at the output channel. 

How can I continuously update the daqmx write after running the vi so that it can send the desired signal rather than repeating the same signal again and again?

Download All
0 Kudos
Message 1 of 4
(2,959 Views)

Most of my "analog" experience has been with Analog Input, not Analog Output (except for slowly-changing output).  In particular, I've not worked with a AO device that (like your 6281) incorporates a FIFO and a clock to drive the AO signal.

 

Suppose you generate a waveform (say, a single cycle of a sine wave) with, say, 100 points (you can use more points to get better resolution, or you can do a little filtering of the output signal).  If you set up your AO device for Continuous Sampling with FIFO regeneration, and have already loaded the 100 samples into the FIFO, then if you set the output rate to 500KHz and output samples for 1 second, you will generate a 500KHz/100 = 5KHz sinusoid for 1 second.  I haven't looked carefully into the triggering ability of the 6281, but if you can trigger it to start and stop, then your time-critical loop will have almost no processing and will not take appreciable time (so the timing will be accurate).  If you want to output 0 volts, all you need to do is replace the 100-point sinusoid with 100 points of 0 in your FIFO (I'm just doing this to keep the overall-logic as simple as possible).

 

So a sequence could be as follows:

  • Set everything up.  Build the sinusoid, load the FIFO, set up the AO channel for the proper rate.
  • Figure out how you want to handle timing (there are numerous ways to do this -- I'd experiment a little).  The basic idea is you want to call a sub-VI that runs for a second and outputs a 100-point waveform repetetively at some specified frequency (such as 5KHz).
  • Now start your output routine.  Every other call you send it a 100-point sinusoid, with alternate calls having a 100-point DC signal, and every 2 calls you change the desired output frequency from 5KHz to 6KHz to ... 50KHz.

Note that this is only the AO side of the equation.  Take advantage of LabVIEW's parallel nature and run this code in parallel with your AI code.  If you need to synchronize the AI with the 1-second "clock" of the AO, the two loops can use the same Clock Signal.

 

Bob Schor

Message 2 of 4
(2,919 Views)

Thanks a lot for your reply. 

Can you give me some kind of sample vi or related link which can show the basic framework for implementing parallel loops for output and input with continuously changing output? 

0 Kudos
Message 3 of 4
(2,888 Views)

I got your point. For continuously updating the daqmx write, I have to put it in a loop. Now, should I put it in the same loop with daqmx read or in the parallel loop? 

If I will put it in a parallel loop, then will there be synchronization between generation and acquisition like it was earlier? 

0 Kudos
Message 4 of 4
(2,883 Views)