Showing results for 
Search instead for 
Did you mean: 

Analog signal staircase help

Go to solution

Hello all,


I'm still new to LabVIEW, but I've played around enough to create a simple analog waveform generator. The signals produced appear staircased when displayed on an oscilloscope, but are smooth when I reread the signals into an analog input (as shown by the waveform graph). How can I change my program settings so that I can view this staircased signal?


I run LabVIEW 2010, and use a USB X Series Multifunction DAQ.





0 Kudos
Message 1 of 11

I've replaced the NI-DAQmx code with the DAQ Assistant for convenience. Updated version below.

0 Kudos
Message 2 of 11



More than likely, it is the sampling rate of the oscilloscope. If you are not sampling fast enough, this would cause the waveform to appear "stepped".


Have you tried using some of the LabVIEW Example Finder (LabVIEW » Help Menu » Find Examples... » Browse Tab » Hardware Input and Output » DAQmx » Analog Generation) examples to generate a sine wave and then acquire that signal? This is a good way to eliminate any programming errors that might have been made.


If you generate a sine wave with Cont Gen Voltage Wfm-Int, do you still see the jagged edges when acquiring with the scope?


Let me know if you have further thoughts or questions.






National Instruments
0 Kudos
Message 3 of 11

Thanks for your help. The sampling rate does play a role in the number of steps displayed, but I've found that altering a combination of the DAQ sampling rate, the number of samples outputted, and the duration and frequency of the signal also influences the resolution. However, I don't know the exact relationship between these four controls and, furthermore, the signal becomes distorted when the duration involves a decimal. Can you explain how these factors affect the resolution, and how I can avoid distorting the output signal? I've attached several pictures to describe my situation below.

Download All
0 Kudos
Message 4 of 11



Thank you for posting. I am a little unclear about what some of the front panel controls are in you're images, but I will explain the best that I can about what I believe is going on.


Take a look at the following images.


Generating a 1kHz sine wave:


Cont Gen Voltage 1kHz


Acquiring at 100kHz:

Acq Voltage Faster.PNG

Acquiring at the Nyquist Frequency (2X the input signal's frequency):

Acq Voltage Slower Nyquist.PNG



What I am trying to demonstrate here is that you are only going to see a smooth signal if you are sampling fast enough. For instance, if you generate a 1kHz and sample at 2kHz, you will only see two samples per period. This will give you an accurate period and frequency, but nothing else. Because an analog to digital converter is used here, you must sample at a much faster rate to get a "smooth" signal. In my above 100kHz acquisition, you see that we are getting 100 samples per period which produces a much smoother waveform. I would suggest that you acquire a 5kHz signal at something on the order of 500kHz to see a smooth signal.


Let me know if you have further questions!





National Instruments
0 Kudos
Message 5 of 11

I don't think my error concerns the sampling rate so much as the resolution of my generated signal. Even at high sampling rates, the acquired signal physically appears 'stepped' (you can view the acquired signal on the right in my previous pictures) as opposed to jumping from point to point as a result of a low sampling rate. Is there a way to manipulate the frequency or clock rate to maximize the resolution of the generated signal?


Also, I noticed that the LabVIEW example voltage generator uses 'Basic Function Generator'.vi to create a signal, while I use 'Signal Generator by Duration'.vi. Is there any significant difference between these two VI's?

0 Kudos
Message 6 of 11



The signal's resolution is maximized by default when it is output. Do you mind posting you're example VIs or screenshots of the block diagrams so that I can take a look at you're DAQmx configuration?


Thank you,


National Instruments
0 Kudos
Message 7 of 11

Here are updated copies of my Waveform Reader and Generator, along with a picture of my issue.

0 Kudos
Message 8 of 11



The issue is in you're waveform generation VI. I would suggest that you take a look at the way the Cont Gen Voltage Wfm-Int example VI is constructed (I know this example produces the correct behavior). I would also suggest that you use Waveform Buffer to produce the waveform.  I believe that the stepped behavior is because of the way you constuct you're waveform that is input into the DAQ Assistant. The examples are located in the Example Finder: LabVIEW » Help Menu » Find Examples... » Browse Tab » Hardware Input and Output » DAQmx » Analog Generation | Analog Measurements » Voltage


This is how I would run the test:


1. Connect an Analog Output channel of you're DAQ card to an Analog Input channel.

2. Run the example Cont Gen Voltage Wfm-Int Select the appropriate device and channel. Leave the remaining parameters as default.

3. Run the example Acq&Graph Voltage-Int with the appropriate selections made for you're device and channel. Change the Sample Rate to 20kHz.






National Instruments
0 Kudos
Message 9 of 11

Even using the LabVIEW examples, the waveform still appears staircased at low frequencies. Is this simply normal behavior for a produced signal?


My parameters are:


Cont Gen Voltage Wfm-Int Clk

Desired Frequency = 100


Cont Acq&Chart Samples-Int Clk

Rate = 20k

Samples to Read = 1000

X-scale = 0 to 0.002

Y-scale = -1 to 1


Everything else is default

0 Kudos
Message 10 of 11