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:



Spectrum Analyzer

Signal Generator

(Absolutely FREE!)


Pitch Tracker


DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Spectral Event

    MHz Frequencies

Data Logger

Waveform Averager


Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls


Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording



Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery


Product test

Contact us about
your application!

Macro Array Edge/Event/Trigger Detection

Command Summary:

Buf0#s=D   Set trigger Slope positive if D<=0, else negative
Buf0#t=L   Set trigger Level to LBuf0#h=H   Set trigger Hysteresis to H
X=Buf0?E   X = index of initial trigger event in Buf0
X=Buf0?e   X = index of next trigger event in Buf0


To obtain the location (sample or array index number) of a Trigger-type event in a waveform in BufN, use the form X=BufN?E to scan for the initial occurrence in the array buffer. Use X=BufN?e to scan for the next occurrence, starting from the previous result.

You may repeat the BufN?e scan for multiple events in the buffer. You may change a buffer's trigger parameters (such as slope) between scans, for example to find the leading and trailing edges of a pulse of either polarity.

The returned value is the position of the trigger event relative to the start of the buffer. If no event is found, the return value is 0. (No valid trigger can ever be found at the 0th element because there must be at least one earlier value to establish that the trigger is on the proper slope.)

The return is a real value that may have a fractional part. It is obtained by interpolation from the value prior to the trigger, the specified trigger level, and the actual value that met or exceeded that level. For example, if the specified trigger level is 1000 on a positive slope, and the array buffer holds a value of 950 at index 123 and 1050 at index 124, the returned value will be 123.500.

You can convert the buffer-relative return value to an absolute sample number by adding the absolute sample number corresponding to the start of the buffer, obtained via Posn?D from the Miscellaneous Position read-only variables. That way, you can measure the distance (and hence time, using the sample rate SmplRate) between triggers found in buffer waveform data acquired on different display updates. This method is used by the _Multi_Mtr_Task of the Multiple Meters mini-app to measure very low frequencies.

Note that when the main display is operating in Triggered mode there is an unknown number of samples between display updates, since the display waits as long as needed for the next trigger event. The array buffers can't obtain data that is not captured for display (even though the main Trigger can examine it), so you may have to toggle Trigger off (Trig=0) when using a Multitasking Macro task to watch for trigger events.

In the untriggered free-running mode, the display typically updates faster than fresh samples arrive from the sound card, so that one display frame (and hence its buffer copy) may include samples that were previously examined. Thus, the absolute sample number is important to prevent double-counting of events.

There is no absolute guarantee that this sample overlap will always take place. With a simple signal (not a lot of large high-frequency signal or noise lines to be drawn) the untriggered display typically updates about every 480 samples at the default 48000 sample rate and 10 msec trace update interval. Since one display frame is 1024 samples (21.3 msec), each frame has about 50% prior data.

Each buffer uses its own 3 internal trigger parameters to specify trigger slope, level, and hysteresis. These parameters are also used with X=BufN?F for Frequency Counting, and are described in detail there. To summarize here:

Buf0#s=V sets the Buf0 slope to Pos if V=0 and to Neg if V = 1.

Buf0#t=V sets the Buf0 trigger level to V, where V is typically in the +/-32767 range.

Buf0#h=V sets the Buf0 trigger hysteresis.

Note that buffer level and hysteresis parameters use "raw" values, not percent or User Units as for the comparable main Trigger Level and Hysteresis.

See also Macro Overview, Macro Arrays Buf0-Buf7


Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved