Scope
A Minimal and Incomplete User’s Manual
             Andri Gretarsson
                                                                                                                     2
                                                      I.    LICENSE
  “Scope” by Andri M. Gretarsson is licensed under a Creative Commons Attribution-Noncommercial-Share Alike
3.0 United States License. A copy of the license is located at http://creativecommons.org/licenses/by-nc-sa/3.0/us/.
                                                II.        DISCLAIMER
  Use the software “Scope” by Andri M. Gretarsson at your own risk. You are responsible for your own equipment.
Use of the software may damage your computer hardware, particularly your sound card. The author
takes no responsibility for any damage. USE AT YOUR OWN RISK. This manual only describes the authors’ guesses
at the best procedures for using the accompanying software. All computer systems are different. The author does not
guarantee that the software will not damage the system on which it is run. Also, the author does not warranty the
software’s suitability for any particular purpose.
                                             III.     INTRODUCTION
  The program Scope is a software rendition of three popular laboratory instruments:
   • Oscilloscope
   • Function Generator
   • Spectrum Analyzer
It uses the stereo “headphone” and “line input” jacks for two channels of analog input and two channels of analog
output respectively. ’Scope is written in LabView and the source code is available online for users who have access to
LabView and wish to modify the program’s behavior.
                                               IV.         LIMITATIONS
   The primary limitation of the code as compared to the operation of stand-alone hardware instruments are the
following.
   • Computer sound cards seem to have a high-pass filter on input ports, such as the line-input. This means that
     the signals are “AC coupled.” DC Coupling doesn’t appear possible.
   • While sound cards can often acquire data at high speeds (e.g. 2, 24 bit channels acquired at 200 kHz) the
     program display does not refresh very fast. The refresh rate is set by the Sample Rate and the # Samples/Ch
     entries but is limited to a few tens of Hertz by the computer speed (for typical current desktop computer speeds).
     This means that to see high-speed transient events, or to resolve high-frequency signals you must zoom in on
     the trace using the zoom tool. For transient events, you will also need to trigger appropriately to “catch” the
     event.
   • In the current realization of the program, output-signal turn-on is abrupt. This leads to turn-on transients and
     to transients when the frequency from the function generator is changed.
   • Since Windows is not a realtime operating system and no specialized hardware is used to acquire the data,
     data loss can occur. The program tries to overcome buffer size limitations for the headphone and line inputs
     by running the reading and writing to/from the jacks in a continuously running while loop. However, if the
     operation of the program is slowed down, either by digitally filtering the signal on the fly (an option in the
     program itself), or by running separate processor-intensive processes, then the while loop may not be able to
     keep up with the requested rate of data acquisition and/or data output and data may be lost. Therefore, we
     recommend closing other processor-intensive applications while running ’Scope.
   • The headphone jack can only put out about a few Volts AC (perhaps 2 VAC ) while the Line Input jacks can
     receive a maximum of about two Volts AC. The nominal levels for these jacks are line level, or about 0.3 Vrms.
     If the system you are working with is likely to expose these terminals to voltages that are significantly higher
     than line level, then we recommend protecting the sound input and output electronics with back-to-back diodes
                                                                                                                    3
     shunted to ground. A buffer circuit on the input and output channels can also solve this problem, and are
     probably a good idea anyway. (See next item.)
   • The output resistance of the headphone channels is fairly significant and these channels cannot drive significant
     capacitive or inductive loads. For most applications therefore, we recommend using a buffer circuit on the
     outputs and also on the inputs. A buffer circuit can be as simple as the following
                                                                100k
                                                    100k
                                                              OP 27
     The back-to-back diodes are for sound-board protection but can be omitted. Red LED’s which will light up and
     become conducting when the input voltage exceeds about 2 volts. Normal diodes and LED’s can be destroyed
     when currents more than a few hundred milliamps flow through them. Don’t allow this to happen, or use a
     more sophisticated circuit protection scheme.
                                              V.   INSTRUCTIONS
  We’ll assume the reader is familiar with the operation of the hardware instruments represented by the program and
with digital data acquisition concepts in general. This renders most of the controls self-explanatory. The following
two lists explain some of the less obvious features and quirks. The first list explains behavior associated with front
panel controls. The second list explains some of the remaining non-obvious behavior.
                                  A.   Configuring the Windows sound settings
  To enable input from the ”Line Input” jack in Windows Vista set the ”Line Input” jack as the default recording
device. See the figure below.
This setting can be accessed from: Control Panel –> Sounds –> Recording Tab. In Windows XP, the input device
is activated from the ”File” menu in the Mixer: File–>Properties–>Recording (I think–I don’t have a copy of XP
running at the moment). Then select (check) the appropriate boxes to display the right inputs in the mixer and then
set the default input as Line Input by checking it in the mixer panel.
                                                                                                                   4
  1. The line input jack often has a light blue border on newer machines. The headphone jack has a lime green
     border.
  2. On some machines (especially those running Vista), the headphone and line input jacks are not recognized by
     the program unless there is actually something plugged into them. If the program starts with an error similar
     to ”Error 4800 occurred at Sound Input Configure.vi->scope.vi. Possible reason(s): LabVIEW: (Hex 0x12C0)
     Selected Device is Invalid.” This may simply be because either the headphone jack or line-input jack has nothing
     plugged into them.
                              B.   Behavior Associated with Front Panel Controls
  The image below, shows the list entry number associated with the corresponding control. Self-evident controls are
not explained. (Image below shows a version of the program used during testing. It is slightly different from the
current version.)
  1. This button turns on the amplitude versus time display. Note that signals are being acquired and can be
     recorded (see Item 4 below) regardless of whether the display is active. However, the trace on the display can
     only be exported (see next item) or saved (see Item 3) when the display itself is active.
  2. To export the data corresponding to the trace(s) currently being displayed press this button. The data is
     exported as preformatted text in column format. The first column is the time variable (seconds) for Trace 1
                                                                                                                     5
   (line-input, left channel). The second column is the voltage for Trace 1. The third column is the the time for
   Trace 2, if present, and the fourth column is the voltage for Trace 2.
 3. This is a set of controls that allow you to manipulate the zoom, move the plot marker, and save the traces to a
    image file. You can also choose several other options by right-clicking in the area of the plot-window itself. In
    particular, you can choose which items are visible (cursor position, axes type: log/linear, etc.)
 4. The record button starts recording the two channels of data in .wav format. The recording can be stopped
    and restarted by pressing record button more than once. (Think of this like the ”record” button on a tape
    player.) The light indicates whether or not the recording button is active. To end the recording and write it to
    a permanent file, deactivate the recording button and press the ”Close Recording” button.
 5. Trigger sensitivity is the hysteresis required for a signal to cause a trigger. Once the signal reaches the set
    trigger point, the trigger occurs. However, we don’t want the trigger to be constantly be activated on noise
    alone. Thus, once the trigger threshold point has been reached and the trigger activates, the instrument won’t
    re-trigger until the signal once again falls below the trigger point by the amount shown here.
 6. In single trigger mode, this button resets the trigger to the untriggered state.
 7. The function generator runs in parallel to the oscilloscope and spectrum analyzer. This button controls whether
    or not any output waveform is calculated or written to the audio output buffers (accessed via headphone jacks.)
    Note that this button must be on for the in order for the swept sine waveform to be calculated.
 8. This turns on a swept sine mode that (providing the function generator is on–see above) calculates the complex
    ratio of the two input traces (L,R). If the spectrum analyzer display is also on, the chosen result (see next item)
    is plotted in the Spectrum Analyzer window. Note that for a swept sine to work, the output and input sampling
    rates should be the same. Similarly #Samples/Ch should be the same for the output and input channels. This
    is the default setting, but can be changed.
 9. These “radio buttons” allow the user to choose which part of the Bode-plot to display, magnitude and/or phase.
    One can also choose to look directly at the power spectrum of the two traces separately by choosing “power
    spectrum” here. Note that choosing “power spectrum” here renders irrelevant any selection of magnitude or
    phase.
10. This button turns on/off the calculation and display of the spectrum and/or swept sine displays.
11. The rightmost button on these controls allows you to choose between logarithmic or linear display. Usually,
    log-log is best for power spectra while for the swept sine display, it is generally a good idea to leave the y-axis
    linear
12. This button allows you to exit the program cleanly and may need to be pressed twice. One can also exit the
    program using the Labview controls (arrow/stop-sign at the top of the window).
                                        C.   Other non-obvious behavior
 1. Right-clicking on the graph windows (displaying the time-traces or frequency-traces) and selecting ”visible
    items” allows you to chose which display controls are shown.
 2. At times the program will stop acquiring or writing sound and will generate an error. This is usually due to
    the fact that the computer is busy doing other things and the sound buffers overflow or are emptied. If this
    happens, use the LabView controls to stop and restart the program.
 3. Don’t try to set the #Samples/Ch much lower than is shown in the default settings or the program will spend
    all it’s time trying to keep up with the settings requested and will become sluggish and difficult to respond to.
    The program may also stop running and need to be restarted.