Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Macro Array Display Operations
The contents of any array buffer uf0-7 can be displayed graphically. The display is redrawn when the main Daqarta input and output channel displays are updated at each Trace Update Interval. (You can toggle any or all of the main channel displays off to reduce screen clutter. The BufN displays will still be updated at the same rate.)
Besides data display, constant-filled buffers can also be used as indicator lines to show range limits or center, or the highest peak previously encountered. See Display Line Style and Custom Color, below.
There are separate display commands for waveform and Spectrum modes; each buffer can be shown in only one mode. (But you can copy its contents to a second buffer and set it to display in the other mode.) Note that in Spectrum mode only the first 512 points of the buffer are displayed, corresponding to the 512 spectral lines that are shown for main channel spectra on the same display. To display a magnitude spectrum from 512 Re,Im raw FFT pairs (perhaps obtained by array copy operation Buf0="<=S1" from a main channel FFT, or from a waveform that you have taken the FFT of using spectrum operation Buf0="<fB1"), you must first use magnitude operation Buf0="<mB1".
In addition, the display command must specify whether the buffer should be shown as bipolar (typical for waveform displays) or unipolar (typical for Spectrum displays). The display commands all have a d immediately after the < caret. Here are examples for Buf0:
Buf0="<dWB" Waveform Bipolar Buf0="<dWU" Waveform Unipolar Buf0="<dSB" Spectrum Bipolar - linear only Buf0="<dSU" Spectrum Unipolar - linear or dB Buf0="<dSu" Spectrum Unipolar - linear only
As given above, the buffer would be displayed with a solid line style in the color of the main input or output channel that has the same number (0-3) as the buffer number. (Buf4-7 are shown using the same colors as 0-3.) You can retain the same colors but specify a different line style by appending a digit 0-4, as in Buf0="<dWU1". (It must be a single digit, not a variable or expression.) The line style numbers are:
0 = Solid 1 = Dash 2 = Dot 3 = Dash-dot 4 = Dash-dot-dot
Alternatively, you can change the line style without changing the display mode or color via Buf0#Y=n, where n is the line style number.
You can further specify a custom color by providing the RGB (Red, Green, Blue) color triplet in parentheses after the line style digit. For example, Buf0="<dWU1(255,0,0)" would specify pure red. Unlike the line style digit, each of the three values may be a constant, variable, or math expression. Each color component is limited to the 0-255 range.
You can also specify only the color, without changing the current line style, by simply omitting the line style digit as in Buf0="<dWU(255,0,0)".
Alternatively, you can use a single constant, variable, or expression to set the color, as in Buf0="<dWU2(X<<8)" or Buf0="<dWU(hFF00FF)". Only the low 24 bits of the value are used. The low 8 are Red, the middle 8 are Green, and the next 8 are Blue... so for a hexadecimal value the colors are in BBGGRR order, the opposite of the above (R,G,B) order.
To change only the color, without affecting the display mode or line style, use Buf0#C=X<<8 or Buf0#C=hFF00FF instead of the above. (There is no 3-value RGB equivalent.)
You can obtain the color value of any main Daqarta trace via the ColorNum macro, as in Buf0="<dWU(ColorNum?L)" to use the Left Input color. To get the color value that corresponds to the current Channel Select Ch setting, use ColorNum?c.
If you use empty parentheses, as in Buf0="<dWU1()" or Buf0="<dWU()", it resets back to the default main channel color that corresponds to the buffer number.
The above Buf0="<dSU" (Spectrum Unipolar) display mode will show Buf0 data as linear magnitude or as dB, depending on the Y-log toggle state.
In dB mode, you can specify that another buffer be associated with the display buffer to apply a calibration or curve function to the data. Buf0="<dCN" sets the Buf0 display to use BufN for this purpose, where N is any buffer except Buf0.
The EQ_Curve macro mini-app uses this method to display the shape of the curve it has computed. It first fills Buf1 with a constant-magnitude (flat) spectrum, then computes the target curve in Buf2. Then it uses Buf1="<dC2" to apply that curve to Buf1, and Buf1="<dSU" to display the result.
Alternatively, you can copy a loaded Spectrum Curve file via Buf1="<=Vn", where n is curve (not channel) 0-3. The curve may be a Memory Curve created by a macro script for on-the-fly frequency response corrections or modifications of displayed data.
Instead of using a buffer as the curve source, you can use Buf0="<dcn" (note lowercase 'c'), to specify that Buf0 be shown with the total calibration that is currently active for main channel n. This can include User Units calibration plus a Spectrum Curve or Tilt.
The use of a specified curve while displaying a particular buffer will persist as long as that buffer is displayed (see Persistent Display, below). The association, via a <dCN or <dcn command, only needs to be made once, after which you can change either the buffer contents or the curve contents (or both) and the display will automatically be updated on the next trace update.
If a new <dCN or <dcn command is given for the display buffer (Buf0 in these examples), it replaces any prior association... you can't combine multiple curves via multiple commands. (If you want to do that, add individual curves together separately via Buf1="<+BufN".)
To remove all curve associations from a specific buffer display, use Buf0="<dCx".
The display command is persistent, so you only need to give it once. After that, whenever you change the contents of the buffer, the display will automatically reflect those changes on the next trace update. You don't need to give the display command again until you want to modify the command parameters (waveform/spectrum, unipolar/bipolar, line style, or color).
Typically, you might give the display command at the same time you set up Macro Multitasking for a buffer, via an initial Task command. Then on each trace update the task can update the contents of the buffer before the display is automatically updated.
When you end the task, you can manually disable the display via Buf0="<d-".
Buf0#Z=K sets the vertical (zero) position of the Buf0 display to the value of K, which may be a constant, variable, or expression. The screen range for K is +127 to -128, rounded to integer values. In Bipolar mode, this is relative to the vertical center of the trace area. Thus, Buf0#Z=64 would cause the Buf0 display to be shifted up by a quarter of the height of the trace area. Displays are always clipped as needed to limit them to the trace area.
In Unipolar mode, the screen range for K is relative to the bottom of the trace area. Note that the maximum of +127 only goes to mid-trace. Negative values would place the zero position below the bottom of the trace area, but since off-screen values are clipped you could still see positive peaks.
Normally, as for main Daqarta channels, the PgUp/PgDn keys control display magnification. You can override this and set a different magnification for any buffer via Buf0#G=M, where M is a magnification range value that may be a constant, variable, or expression. Results are rounded to integer range numbers.
Note that more-positive values result in less magnification. Each integer step increase halves the magnification while each integer decrease doubles it. Please note that the actual values are quite different for each display mode: In normal waveform display mode, the range is -30 to +12, with 8 resulting in a full-scale waveform just filling the trace area vertically.
In Spectrum mode, the useful range is -17 to +25, with 21 resulting in a full-scale peak for a sine wave whose frequency falls exactly on a spectral line.
Histogram averages use a range of -31 to +11, with 7 giving a full-scale display.
Note that this custom buffer magnification only applies to waveform and linear Spectrum modes, not Y-log Spectrum (dB vertical axis).
Setting a value of 1000 or more restores the default PgUp/PgDn magnification control for the buffer.
You can specify the horizontal and vertical display axis ranges, as well as the vertical units. These settings only apply to multitasking macros, and will remain in effect until until the last task in uninstalled.
There are analogous commands for setting ranges and units when saving buffers as .DQA files, so they will appear the same way when the file is later opened.
Buf0#R=n sets the effective sample Rate to n for the waveform display X axis. The normal uneXpanded axis shows time points from 0 to 1023, assuming each time point is the reciprocal of the effective Sample Rate (including any Decimate Factor, if active). Here, you can set a dummy effective rate to get a specific unexpanded axis range. This only affects the display, not the real sample rate.
For example, a chart recorder macro may scroll at only 0.1 seconds per update, which is 10 samples per second. You'd use Buf0#R=10 to set the waveform display to show the proper time for the chart recorder trace. This will give a maximum time point of 0.1 * 1023 = 102.3 seconds, and the unexpanded X axis will be marked and labeled in 20 second steps up to 100 seconds... exactly as if observing a normal input waveform with a sample rate of 10 Hz. (It will likewise respond to eXpand properly, as well.)
Buf0#Rs=n sets the effective sample Rate to n for the spectrum display X axis. Here the normal uneXpanded axis runs from 0 to just under half (511/1024) of the effective sample rate, so you can use this to set an arbitrary apparent frequency range.
Buf0#V=n sets the Vertical range to +/-n for waveform display mode. Note that it only takes effect when User Units mode is active, so you can toggle back and forth to the normal vertical axis with the ALT+U hot-key combination.
Buf0#Vs=n sets the Vertical range to n for spectrum magnitude display mode; it does not affect the Y-log power spectrum (dB) mode.
Buf0#U="Deg" sets the vertical Units to Deg for waveform display mode, while Buf0#Us="Deg" does the same for spectrum display. As for Vertical range, these units are only seen in User Units mode.
Buf0="<dX1" sets the Buf0 display to use Buf1 as the X axis. This only applies to waveform mode. A value of 0 corresponds to the left edge of the display, while 511 corresponds to the right.
The Lissajous (X vs. Y) Mini-App uses this command to set X-Y display mode in the main Lissajous Macro Listing.
Alternatively, in this and any buffer command that uses a source (right side) buffer number, you may use an expression to specify the source by enclosing it in parentheses, as in Buf0="<dX(P+Q)".
A typical application might obtain the X-axis values from an input or output waveform, which has a +/-32767 range. To fit that range onto the display, you would first divide by 128 to get +/-256, then add 256. Since the signals can change continuously, you would do this in a Multitasking Macro that is run before every trace update:
Buf0="<=W0" ;Copy Left In to Buf0 Buf1="<=W1" ;Copy Right In to Buf1 Buf1="</(128)" ;Divide Buf1 by 128 Buf1="<+(256)" ;Add 256 to Buf1
Note that X-Axis eXpand has no effect on the X-axis of the buffer trace, but it still operates on other traces.
Buf0="<dX-" restores normal X-axis operation for Buf0.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved