Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

Sound Card Channel Difference Mini-App

Introduction:

The Diff_Chan macro mini-app is included with Daqarta. To run it, hit the F8 key followed by the 'C' key, or hit CTRL+F8 to open the Macro Dialog and double-click on Diff_Chan in the Macro List.

Diff_Chan displays the difference (or sum) of the waveforms or spectra of any two selected channels. In waveform display mode this is analogous to the A - B mode of a benchtop oscilloscope.

Note that in spectrum mode the display is not the spectrum of the difference (or sum) of the two raw waveforms.

Diff_Chan launches a Custom Controls dialog that allows you to select A and B channels and operation mode (A-B, B-A, or A+B), change the vertical screen position of the difference (or sum) trace, and adjust its color and line style. The _Diff_Ctrls macro handles the control changes.

Note that you can open this Help topic at any time by right-clicking anywhere in the Diff_Chan control dialog.

Diff_Chan also installs _Diff_Task as a multitasking macro to actually compute and display the difference (or sum) trace each time the main traces are updated. This task is uninstalled when the dialog is closed.

The channel select controls are identical to those in the Chart_Recorder macro mini-app. They use the Slider Control with Read-Only Edit method discussed in the Custom Controls Command Summary.

The mode and line style buttons use the M-type momentary type discussed under Button Type under that same topic, where the mode button is used as an example.

The Line Color control uses Ctrl3="<p(0)" to set the displayed decimal places to zero for an integer display, but otherwise is a standard S-type edit control with slider. The color spectrum is controlled from the _Diff_Ctrls handler via Buf0="<dWB(colr(Ctrl3))", which uses the Color Function discussed in Macro Math Functions. This command redundantly sets the buffer display mode to Waveform Bipolar; since only the color is being changed you could use the simpler Buf0#C=colr(Ctrl3) instead.

Further information can be obtained by following the links in the macro listings below:


Diff_Chan Macro Listing:

;<Help=H4903
Sgram=0

Ctrls="<<Channel Difference"
Ctrl0="<r(0,3)"
Ctrl0="<<A Channel"
UU=2
Ctrl0#s=UU
Ctrl0="< " + UU(c)

Ctrl2="<r(0,3)"
Ctrl2="<<B Channel"
UL=3
Ctrl2#s=UL
Ctrl2="< " + UL(c)

Ctrl1="<<Zero Position"
Ctrl1="<S(-128,+128)"
Ctrl1=0

Ctrl3="<<Line Color"
Ctrl3="<S(0,1791)"
Ctrl3="<p(0)"
Ctrl3=0

Btn0="<M(2)"
Btn0="A - B"

Btn1="<M(4)"
Btn1="Solid Line"

Btn2="<X"
Btn3="<X"

Task="_Diff_Task"

US=0
Buf0#Y=US
Buf0#Z=Ctrl1
@_Diff_Ctrls=Ctrls
Task="-_Diff_Task"
Buf0="<d-"
Buf0#Y=0


_Diff_Ctrls Macro Listing:

;<Help=H4903
IF.Ctrls=0                          ;Ctrl0, A chan scroll
    UU=(UU+Ctrl0?u) & 3
    Ctrl0#s=UU
ENDIF.

IF.Ctrls=h80                        ;Ctrl0, A chan slider
    UU=Ctrl0?s
    Ctrl0="< " + UU(c)
ENDIF.

IF.Ctrls=2                          ;Ctrl2, B chan scroll
    UU=(UL+Ctrl2?u) & 3
    Ctrl2#s=UL
ENDIF.

IF.Ctrls=h82                        ;Ctrl2, B chan slider
    UL=Ctrl2?s
    Ctrl2="< " + UL(c)
ENDIF.

IF.Ctrls=1                          ;Ctrl1 Zero Posn
    Buf0#Z=Ctrl1
ENDIF.

IF.Ctrls=3                          ;Ctrl3 Line Color
    Buf0="<dWB(colr(Ctrl3))"
ENDIF.

IF.Ctrls=4                          ;Btn0 Mode
    IF.Btn0=0
        Btn0="A - B"
    ENDIF.
    IF.Btn0=1
        Btn0="B - A"
    ENDIF.
    IF.Btn0=2
        Btn0="A + B"
    ENDIF.
ENDIF.

IF.Ctrls=5                          ;Btn1 Line Style
    IF.Btn1=0
        Btn1="Solid Line"
    ENDIF.
    IF.Btn1=1
        Btn1="Dashed Line"
    ENDIF.
    IF.Btn1=2
        Btn1="Dotted Line"
    ENDIF.
    IF.Btn1=3
        Btn1="Dash-Dot Line"
    ENDIF.
    IF.Btn1=4
        Btn1="Dash-Dot-Dot Line"
    ENDIF.
    Buf0#Y=Btn1
ENDIF.


_Diff_Task Macro Listing:

;<Help=H4903
IF.Spect=1
    Buf0="<mS(UU)"
    Buf1="<mS(UL)"
    Buf0="<dSU(colr(Ctrl3))"
ELSE.
    Buf0="<=W(UU)"
    Buf1="<=W(UL)"
    Buf0="<dWB(colr(Ctrl3))"
ENDIF.

IF.Btn0=0
    Buf0="<-B1"
ENDIF.
IF.Btn0=1
    Buf0="<~B1"
ENDIF.
IF.Btn0=2
    Buf0="<+B1"
ENDIF.


See also Macro Examples and Mini-Apps

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved