41-610 Arbitrary Waveform Generator

Note: The 41-610 is under no longer in production so this page is provided for support purposes. 

Creating Waveforms

It is helpful to add a few definitions to the code:
enum {ARB_SINE, ARB_SQUARE, ARB_TRIANGLE};          // Definitions of waveshapes, 0 = Sine, 1 = Square, 2 = Triangle
#define MAX_AMP 65535             // Maximum DAC output
#define MID_AMP 32768             // Middle DAC output == 0 Vdc
Then, taking the example in the help document as a starting point (no error checking for ease of understanding):


    pg14102_Init(4, 11, &vi);
    pg14102_SetActiveChannel(vi, 1);
    pg14102_SetLockMode(vi, 0);
    pg14102_SignalAdd(vi, ARB_SINE, 1.0, 1, 0, 50);    // vi, type, ampl, periods, phase, symm
    pg14102_SetStartAddress(vi, 0);
    pg14102_SetStopAddress(vi, 999);            // stop-start+1 = samples
    pg14102_SetClockDivider(vi, 100);                // Divide 100MHz by this
    pg14102_SetAttenuator(vi, -6);
    pg14102_SetDCOffsetVoltage(vi, 0);
    pg14102_SetFilter(vi, 1);
    pg14102_SetClockSource(vi, 1);
    pg14102_SetTriggerMode(vi, 8, 0);
    pg14102_ConnectCard(vi, 1);
    pg14102_SetSoftwareTriggerStatus(vi, 1);

Note that rather than using 1024 samples as shown in the manual, 1000 are used, this made the calculations simpler.
Now, using the 100MHz clock and dividing by 100, we get a 1MHz sample rate, and so with 1000 samples we end up with a 1KHz signal repetition rate, in the above case we get a 1KHz sinewave. Simply change ARB_SINE to ARB_SQUARE or ARB_TRIANGLE to select one of the other predefined waveforms.


Next, some arbitrary waveforms. While they may not be what you are looking for, they help understanding how the ARB works and should allow you to create any waveform you wish.


Replacing the lines SignalAdd through SignalToRam with this:
    ViUInt32 data[1000];
    for(int i=0; i< 1000; i++)
        data[i] = (i<10)? MAX_AMP:MID_AMP;            // Create 10 wide pulse ( 1% m-s ratio)
    pg14102_SetStartAddress(vi, 0);
    pg14102_WriteRamBuffer(vi, 1000, data);
    pg14102_SetStopAddress(vi, 999);                // stop-start+1 = samples

Produces a 1kHz rate, 10% pulse width signal at maximum amplitude for 10% of the period and 0V for the rest


Change the calculation to this:
    for(int i=0; i< 1000; i++)
        data[i] = (i<100)? MID_AMP*(1+(double)i/100):MID_AMP;    // Create ramp in first 100 samples
To produce a linear ramp, 0V to maximum amplitude over 10% of the period and 0V the remainder.


Change the calculation to this:
    for(int i=0; i< 1000; i++)
        data[i] = (i<100) ? MID_AMP*(1+sin(3.142*i/100)): MID_AMP; // Create half sine in first 100 samples

To produce a half sine wave in the first 10% of the period and 0V in the rest


And to this:
    for(int i=0; i< 1000; i++)
        data[i] = (i<200) ? MID_AMP*(1+ sin(3.142*2*i/200)): MID_AMP; // Create full sine in first 100 samples
To produces a full sine wave in the first 20% of the period and 0V in the rest


The general principles in creating an arbitrary waveform are:
  • Decide how many samples are needed to create the waveform with sufficient fidelity
  • Set the clock and divider to define a suitable sample rate
  • Set the RAM to 32768 for a DC level of 0
  • Set values 0 through 65535 for the waveform

APH, May 21, 2009 

Need help?

Support knowledgebase

Have questions or need some help? While we enjoy talking to you, you can find technical information for our entire product range here.

Technical know-how 

Long-term support

Because we manufacture our products in-house, we are able to provide you with guaranteed long-term support and low obsolescence.

Our support

Resource center

From success stories and product literature to newsletters, find the information you need about our switching and simulation solutions.

Get the resources you need

Worldwide presence

We supply and support our products across the globe, with seven offices in the Americas, Europe and Asia as well as additional representation. 

Find a local office or agent near you