LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Discreet amplitude sweep with a pause between each amplitude

I am working on a discreet amplitude sweep: the program will output a set number of cycles of a sine wave at with an increasing amplitude.  The number of cycles will be set by the sampling rate and the number of samples.  I want to insert an adjustable pause between each amplitude during which the program will output 0 Volts.  I cannot get this part to work.  I tried using the Time Delay VI, but it behaved eratically.  The output is sent to a USB cDAQ-9172 and I am using LabVIEW 8.5. Any suggestions?

 

Thank you.

0 Kudos
Message 1 of 6
(3,177 Views)

Howdy Clark!

 

Have you tried using a second DAQmx Write in every iteration of the for loop to write an array of zero values to the buffer after writing each sine wave section?  You could use the Initialize Array function to create an array of length (Pause Length)*(Sampling Rate) containing all zeros.

 

Regards,

Barron
Applications Engineering
National Instruments
0 Kudos
Message 2 of 6
(3,142 Views)

Hi,

 

Thanks for the suggestion.  I used the Initialize Array and Append Waveform VIs to put the appropriate number of 0s to the end of each segment of the signal.  I still have two issues. 

 

I have added a digital trigger to the VI.  This is sent with a 9401 module in slot 6 of the Compact DAQ.  I would like the analog output to be synchronized with the digital trigger.  I want the voltage singal to start with the leading edge of the digital output.  I have looked at the synchronization examples that came with LabVIEW as well as http://zone.ni.com/devzone/cda/tut/p/id/3615#toc3, and several previous threads on the message boards including http://forums.ni.com/t5/Multifunction-DAQ/USB-Hardware-suggestion-for-syncing-a-short-digital-pulse-...  But I don't seem to be able to adapt any of these to my program.  Any suggestions?

 

The second (and more minor) issue is that for some pause lengths and sampling rates, the final iteration of the For Loop doesn't complete an integer number of cycles and return to 0 Volts.  I didn't really explore this vary systematically though. 

 

I have attached an updated version of my VI.  It is written in LabVIEW 8.5.

 

Thanks.

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

You can use the DAQmx Triggering VI to configure a Start trigger for both of your DAQmx tasks.  The first link that you posted shows this in several of the images.

 

To guarantee that the output always ends at zero you could insert a DAQmx Write after the for loop, before the DAQmx Stop Task, to write a single point of zero to the output.

 

On a side note, all four output terminals on the for loop are configured for auto-indexing and you are then using the Index Array function to pull out the first entry.  Just disable auto-indexing on those terminals (Right click the terminal>>disable auto-indexing) and you won't need to use the Index Array function.  This will improve your program's efficiency.

 

 

Barron
Applications Engineering
National Instruments
0 Kudos
Message 4 of 6
(3,060 Views)

Hello,

 

Thanks for the suggestions. 

 

I added a DAQmx Triggering VI but the two signals are still not quite synchronized.  I am not sure what I am missing or doing wrong. 

 

Also, when I disable indexing on the terminals out of the For loop, I get errors when the program runs. 

 

I have attached the VI and an image of the block diagram. 

 

Thanks.

 

 

Download All
0 Kudos
Message 5 of 6
(2,984 Views)

Try using the DAQmx Export Signal VI to export the counter output to a PFI line.  Then use the PFI line as the trigger source for the analog input task.

Barron
Applications Engineering
National Instruments
0 Kudos
Message 6 of 6
(2,960 Views)