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: 

Generate 40kHz square wave with DAC

Solved!
Go to solution

Hi

 

I want to generate a 40kHz square wave (analog) from my DAC-assistant but I don't really understand what "Samples to write" and "Rate" is supposed be. 

 

I'm using the Generate Signal.vi to produce the square wave with the following parameters:

Frequency = 40kHz

Samples per second = 4M

Numbers of samples = 100

 

is there a way of calculating the "Samples to write" and "Rate" parameters of the DAC-assistant? 

 

 

 

0 Kudos
Message 1 of 3
(3,561 Views)
Solution
Accepted by topic author Wallberg

Hi Wallberg,

 

Generate Signal.vi to produce the square wave with the following parameters:

Frequency = 40kHz, Samples per second = 4M, Numbers of samples = 100

So you want to output a waveform with a samplerate of 4MS/s, consisting of just 100 samples?

What's the content of the waveform? (How does it look like on a graph? How many "squares" does it show?)

 

Hint: If you would use basic DAQmx functions instead of the DAQAssistent ExpressVI it could be much easier than you might think! Examine the example VIs coming with LabVIEW and read about the basics

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(3,552 Views)

You do realize, I hope, that a Digital Waveform is simply an Analog Waveform that takes on two values, typically 0 and +5v.  It is so much simpler to generate Digital Waveforms than Analog (for one thing, you only need to send an output when it changes from low to high or high to low, and your "Data" consist of Booleans instead of Dbls or I32s).  If you need a (fixed) output voltage other than +5v, you can use a (fixed) amplifier or Voltage Divider (a few resistors).

 

Bob Schor

0 Kudos
Message 3 of 3
(3,499 Views)