Previous Assignment

A04: Waveform Generation subVI

Next Assignment  
 


Printout (described below) is due in class on Tuesday, February 4, 2003

Create a Virtual Instrument that will be used to generate an arbitrary waveform from user specified information.  Your subVI should have the following controls and indicators.  Default values are given in brackets when appropriate.

Controls

  • Waveform Type - Used to select the type of waveform (sine wave, triangular wave, sawtooth wave, square wave).  Use an enumerated data type. [Sine Wave]
  • Amplitude - The peak amplitude of the waveform.  Use a double-precision floating point value. [1.00]
  • Frequency (Hz) - The frequency in Hz (i.e. cycles/sec) of the waveform. Use a double-precision floating point value. [10.0]
  • DC Offset - A constant offset of the waveform from zero. Use a double-precision floating point value. [0.0]
  • Sampling Info - A cluster containing:
    • Sampling Rate (Fs = samples/sec) - This is the number of samples (points) per second in the waveform. Use a double-precision floating point value. [1000]
    • Number of Samples (#s) - The total number of samples (points) in the waveform. Use an long integer (I32) [1000]
  • Duty Cycle - The percent of time a square wave remains high over one complete period.  This control will be used for square waves only. Use a double-precision floating point value. [50 %]
  • Error In - The standard Error In cluster. 

Indicators

  • Waveform Out - The waveform described by the parameters Waveform Type, Amplitude, Frequency, DC Offset, Sampling Rate, Number of Samples, and Duty Cycle.  Display this waveform on a waveform graph on the front panel.  Use a waveform data type.
  • Error Out - The standard Error Out Cluster.

You will need to use the waveform generation VIs named Sine Waveform.vi, Triangle Waveform.vi, Sawtooth Waveform.vi, and Square Waveform.vi.  

Refer to the help files for additional information about these VIs.  You will probably notice that there is a "waveform function generator VI" in the same palette as these VIs.  Your waveform generator will be MUCH simpler because I am not asking you to keep track of the phase of the signal.  In fact, you should hard wire a TRUE Boolean constant to the Reset Phase? input and a 0.0 to the Phase Input of the Waveform subVIs. 

If Error In contains an error then your VI should do nothing except return the error.  Use standard Error I/O from the waveform subVIs to pass appropriate values to the Error Out cluster of your VI.

You will later use this subVI to generate a waveform of a selected frequency that is exactly one cycle long.

 

  

   Additional Requirements

  • Document the controls and indicators on this virtual instrument.  

  • Create an icon for your subVI and connect the controls and indicators to terminals on the icon so it can be called by a top-level VI in a later exercise.

  • Document the subVI by entering a description in the VI Properties dialog box. 

  • Print your subVI with the "Complete Documentation" option of the print dialog and hand the printout in during class.