From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ - Analog Output - Output arbitrary number of periods

Hi all,

 

I am using the analog output on a PCI-6229 card to control three piezoelectric actuators.  I currently generate three out of phase sawtooth waves with the Simulate Signal Express vi.  I route these signals to a DAQ Assistant Express vi.  I would like to have the ability to output N periods of the sawtooth waveform.  Ideally, I would like each waveform to complete one full period.  The code I currently have can does not perform this function correctly..  That is, I click the "Run N Times" button with N=1, and can verify that an incorrect number of periods of the waveform appear on the DAQ's analog output.  If I set the frequency to 10 Hz, then I can see the correct number of periods.  At 20 Hz, the number of periods output is doubled, and three periods are output at f=30 Hz.  Is there a setting to change in the Simulate Signal vi to allow this behavior? I realize that this is probably related to the "Samples per Second" option set in the Simulate Signal settings.  It seems reasonable that this number could be changed.  However, it would be much more favorable if this were handled automatically.

 

I have attached my vi for your reference (LabVIEW 10.0).  Thank you in advance for your help.

 

-M

0 Kudos
Message 1 of 3
(2,134 Views)

Hey MStresh,

 

You are correct in thinking that this would be very difficult to do with the express VIs because you can't programatically change the samples per second. So, here is an example of some code that will generate as many periods of a sawtooth wave as you want. You should be able to adapt this to your needs pretty easily.

 

MStresh.png

 

Have a great day!

John B.
Embedded Networks R&D
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 2 of 3
(2,119 Views)

Thanks John,  I'll try this out--it looks promising.

 

-M

0 Kudos
Message 3 of 3
(2,110 Views)