Skip to Navigation

Waveform Generation (App Note)

This application note is about creating output waveforms.  For square or rectangular waveforms you would typically use a timer on a U3/U6/UE9, set to PWM or Frequency Output mode.  If a sinusoid is needed, but fixed frequency and amplitude is sufficient, you can output a square wave and use a simple RC filter to create a decent sinusoid.  For arbitrary waveforms, though, they need to be created with multiple DAC (analog output) updates.

First, determine if the bandwidth of the DAC (digital to analog converter, or analog output) channel hardware can handle your desired maximum signal frequency.  As of this writing, the -3 dB cutoff frequency of U3 and U6 is about 16 Hz and 500 Hz respectively.

If the hardware can handle the signal frequency you want, the next question is whether you can update the DAC fast enough to build your desired waveform.  You need to determine your required DAC update rate.  Take the max signal frequency you want to make, and multiply it by how many updates per cycle you require (i.e. how "smooth" you need the signal to be).

The typical method of updating the DAC is command/response mode.  Best case timing information can be found in Section 3.1 of the U3, U6, or UE9 User's Guide.  For example, in Section 3.1 of the U3 User's Guide it says that with a USB high-high connection it takes about 0.6 ms to update one or both DACs, which is about 1600 updates/second.  Whether you can make a program that can iterate a loop at that interval has to do with many factors.

The UE9 has a feature called Stream-DAC that allows DAC channels to be updated in stream mode.  You specify a buffer of 1-128 update values, and the UE9 will step through this buffer (continuously rolling back to the start) sending each value to a DAC at the stream scan rate (which can be up to 50 kscans/second or even more).

 

Comments

#1

The appnote says:

As of this writing, the -3 dB cutoff frequency of U3 and U6 is about 16 Hz and 500 Hz respectively.

Should it be 1600 Hz? It is because the appnote also says:

For example, in Section 3.1 of the U3 User's Guide it says that with a USB high-high connection it takes about 0.6 ms to update one or both DACs, which is about 1600 updates/second.

Can you post sample code for C/C++?

 

#2

Two different things.  For the U3, you might be able to update the value of the DAC 1600 times per second, but the bandwidth of the output hardware is only 16Hz.  So, for example, if you update it 1000 times per second to make a 10Hz waveform it will work well, but if you update it 1000 times to try to make a 100Hz waveform you will not get much output.

For examples start here.

#3

Greetings,

 

The UE9 has a feature called Stream-DAC

 

How about U6?

#4

The U6's hardware is not setup for Stream-DAC.

#5

I would like to post your application note and example code on our web site, so I have tried to find example code, but I cannot find.

 

Can you please let us know where it is?

#6

Looks like the only example right now is for LabVIEW.  We will work on an example for VC6, as that is where we usually make the most core examples that can be adapted to other languages.