[LogoShip]

Home

Daqarta for DOS Contents

Introduction

Downloads

Free Registration

Contact Us
Daqarta for DOS
Data AcQuisition And Real-Time Analysis
Shareware for Legacy Systems
(Use Daqarta for Windows with modern systems)

From the Daqarta for DOS Help system:
 
DAQARTA - STIM3A
ADVANCED STIMULUS SIGNAL GENERATOR

MISC MENU:


Frequency Step Mode and Step Size:

This is a pair of controls to set the mode and resolution of Frequency adjustments. The upper control steps the mode through Direct, StepHz, StepN, Octave, and Music modes. For each mode, the associated step size can be adjusted by the lower control. The mode control also appears just below each main Frequency control in other menus; changing the mode in one location changes it in all others as well. The current mode applies not only to main wave frequencies, but also to modulator frequencies. The mode only affects a frequency being changed; after the change, the set frequency remains even if the mode is changed.

Direct Mode:

In Direct mode, you can always enter any frequency you wish by direct entry; the value of the step size here only applies if you scroll the item with the normal up an down arrows. Note that in Direct mode the step size is applied to whatever value is current; there is no quantization as in StepHz or StepN modes.

As with all normal Daqarta scrolled values, you can use SHIFT-Up/Dn to get a bigger step size, which in this case will be a multiple of the step size selected here. The default multiple is 50, but you can change that via the Fixed cursor step control in the main Key Control menu (CTRL-K). Note that the step multiplier affects cursor operations throughout Daqarta, however, so use some care if you change it.

For Direct mode as well as StepHz mode, you may also use ALT-Up/Dn to change a frequency by the smallest possible amount, independent of the step size set here.

StepHz Mode

StepHz mode is similar to Direct mode, except that values are quantized to the given step size. If that step size is 1.0000 Hz, then any frequency value that is changed will be forced to a multiple of 1 Hz (within the intrinsic resolution limits of STIM3A). This will apply whether the change is by direct keyboard entry or by scrolling: If the initial frequency value is 500.123 Hz, one scroll step up will move to 501 Hz, and one step down will move to 500 Hz. If you directly enter 503.4567, it will be quantized down to 503 Hz.

StepN Mode

StepN mode forces frequencies to take on values related to the FFT spectral line spacing. If the step size is set to 1.0000 (default), then changes to any frequency will cause it to fall exactly on a spectral line, assuming the FFT size is N1024. The StepN step size value always assumes that the number of samples is 1024, even if you are only using 512 or 256. (That way it doesn't jump around when you toggle the N-key.) You just have to remember to set StepN to multiples of 2 for N = 512 and to multiples of 4 for N = 256, if you only want waves that land exactly on spectral lines.

The spectral line spacing is equal to the sample rate divided by the number of samples N in the FFT data run. Example: For N = 1024 samples at a 20 kHz sample rate, it would be 20000 / 1024 = 19.53 Hz.

However, you CAN set StepN to get waves that land between the lines, with a resolution of 1/64 of a line at N1024. This is equivalent to 1/128 line at N 512 or 1/256 line at N 256.

The minimum StepN value is limited by the available buffer samples to 1024 / BufferSamples. The equivalent frequency step for this value is SampleRate / BufferSamples.

The ability to place frequency components exactly on spectral lines is a very powerful tool, because it can eliminate the need for windowing: There are no spectral leakage "skirts" whatsoever when viewing these frequencies. And if a fundamental frequency falls exactly on a line, then all harmonics will do so as well. What's more, the intermodulation distortion products generated by two primary tones will also fall on spectral lines. This can greatly increase the ability to resolve low-level products that would otherwise be buried in leakage skirts, even when reduced by windowing.

The other powerful advantage of StepN is that it makes it simple to use Static RTime to generate continuous waves. When a frequency falls exactly on a spectral line, that means that an exact integer number of cycles fit into each N samples acquired. That's exactly what's needed to insure that there are no discontinuities when the buffer playback wraps from the last to the first sample to make a continuous wave.

Although the use of Dynamic RTime allows setting any frequency without the need for this StepN trick, you may nevertheless still need Static RTime to allow faster sample rates (or even oversampling), epecially on slower CPUs.

Octave Mode

It is often useful to work with octaves rather than linear frequencies. The term "octave" derives from music theory, where a step of 8 "whole notes" (white keys on a piano), say from one C to the next higher C, represents a doubling of frequency. This is due to the exponential nature of the human auditory system, where a change from 500 to 600 Hz, for example, sounds the same "size" as a change from 5000 to 6000 Hz.

Many physical systems have a response proportional to frequency or a power of frequency; a filter whose response falls proportional to 1/f will have its output level halved (-6 dB) for each doubling (octave) of frequency. This accounts for the common 6 dB/octave response spec of simple filters.

RATIOS AND OCTAVES:
To determine the number of octaves represented by a given ratio, take the base-2 logarithm of that ratio. Since your pocket calculator probably only has base-10 (common log) and base-e (natural log or ln), note that:

                   log(X)         ln(X)
     log2(X)  =   --------   =   -------
                   log(2)         ln(2)
Conversely, to go from an octave value to a ratio, just raise 2 to that power.

Octave mode allows direct entry of any arbitrary value; no quantization is applied. Only during scrolling is the octave step applied, and the result is always relative to the original value.

Music Mode

Use Music mode to produce tones that fall on exact musical note frequencies, whether you use scrolling or direct entry. Equal note spacing is assumed here, with the default being the standard "equal tempered" system used in most Western music. This system has 12 twelfth-octave steps per octave, each step being 2^(1/12) times the one below it, an increase of about six percent (2^1/12 = 1.05946). The standard reference frequency is 440.000 Hz at the A above middle C on a piano, sometimes known as "concert A".

The step size for Music mode is given in "cents", or percent of one twelfth-octave step. The default is 100.00 cents to get normal equal tempered tuning. Most listeners require a change of at least 2 cents (about 0.1%) in order to detect a difference between two tones under ideal conditions.

Organ Mode

This is a special mode that you enter from Octave or Music mode. Begin as though you were going to change the frequency normally (hit ENTER), but instead of hitting the up or down arrow keys, hit ALT-up or -down. The mode indicator will change to Organ, but there will be no other immediate changes.

Now the computer keyboard is used like an organ keyboard, allowing you to quickly change frequencies just by hitting different keys. The layout is such that the C-key is middle C, and the E-key is E an octave above. "Concert A" (440 Hz) is the comma key, while the Z-key is 220 Hz and the Y-key is 880 Hz. Think of this as a split keyboard:

        2 3   5 6 7   9 0   =       Black Keys
       Q W E R T Y U I O P [ ]      White Keys

        A S   F G   J K L   '       Black Keys
         Z X C V B N M , . /        White Keys

SHIFT with any key raises the frequency an octave, and ALT lowers it an octave. If you also hit CTRL, the change is two octaves. To exit this mode, hit ENTER or ESC and the most recent frequency will be retained.

Although it is possible to play this Organ like a musical instrument, this is really more appropriate for instrument tuning or equipment calibration. There is no "keying" function, merely a change in frequency of an ongoing tone. The tone doesn't start when you press a key, and doesn't stop when you lift it. If you set up tone bursts, they will repeat as ususal whether you press a key or not... they keys only change the tone frequency.

Note that this mode assumes that the Music step size is 100 Cents. With another size, the 440 Hz reference used here (comma key) will be the nearest quantized step size, and all the keys will be crowded or stretched depending on the step size.

If invoked during Octave entry, this mode behaves differently. There the reference frequency (comma key) is whatever frequency was set before ALT-Up/Dn was hit. To use similarly to Music Organ mode, set the Octave step size to 0.0833333 (1/12). This allows equal-tempered tuning with an arbitrary reference, equivalent to shifting the keyboard (musically) to the right or left. Setting a larger or smaller step will squeeze or stretch the keyboard, as for Music Organ.

If you want to start with a particular exact note reference, first select normal Music, set the note, then go to Octave Organ. Or you may want to start with an exact note from Music, then detune it slightly by going to Direct, then go to Octave Organ.


Oversampling Factor:

Allows the stimulus sample rate to exceed the acquisition sample rate. This is important when the stimulus must have good time resolution, but where the response to the stimulus is much slower.

The Factor option is only available on boards that support it. This currently excludes sound cards, which require the ADC and DAC to run at the same rate. Future drivers may nonetheless support this by running both at the higher rate, then reducing the effective ADC rate in software by a process known as decimation or sample rate conversion.

At present, only boards that can operate via an intrrupt on each sample can use Factor. This includes all lab-type boards, plus the LPTX and DEMO drivers.

A typical application is with auditory evoked responses using high frequency tone bursts as stimuli. If the subject is a dog or rodent, for example, you may want to give stimulus tone frequencies that are well over 20 kHz, which will require running the DAC sample rate at well over 40 kHz to get decent sine waves without external filtering. You may also be interested in "late" responses that are observed several tens of milliseconds after the stimulus onset.

Suppose you want to deliver 30 kHz tones, so you set the sample rate to 80 kHz. The waveform mode display will show the first 6.4 msec of the response with the number of acquisition samples N = 512, or the first 12.8 msec with N = 1024. You could use trigger delay to observe response peaks later than this, but then you would not see the earlier responses. Since the response contains only low frequency components mostly below 1 kHz, you could actually acquire the data at a much lower rate... say 40 kHz, 20 kHz, or even less, if the stimulus sample rate could be kept high.

The Factor setting specifies the number of stimulus output samples per acquisition input sample, or "oversampling" factor. In the above example, you could set the acquisition sample rate to 20 kHz using the normal X-axis menu item, then set the Factor to 4 to get a stimulus sample rate of 80 kHz. Depending on the board used, the acquisition will actually proceed at the higher rate, also producing a stimulus output on each active channel for every input sample. The driver would then discard 3 out of every 4 input samples.

There are, of course, limits to this. Since most boards must actually acquire samples at the higher rate, that rate is limited to the board's maximum acquisition rate. If the oversampling Factor times the normal acquisition sample rate exceeds the board limit, Daqarta will retain the factor as set, but reduce the acquisition rate to insure that the true sample rate remains within limits. This will be obvious since the X-axis will change.

However, some board drivers (DAS8X, DAS8JR, and DAS16X, for example) allow "hypersampling", where the stimulus sample rate may actually exceed the limits of the ADC. This is possible since DACs and especially digital outputs are typically much faster than the ADCs used on the boards.

In either case, the amount of oversampling you can use may be limited by the speed of your system. If you try to increase the Factor too much at any sample rate, you may get an alert and an error message:

    'Sample rate overrun!'
 
If RTime mode is active, it will be switched back to Sequential. In Sequential mode, however, you must take action to reduce either the Factor or the X-axis sample rate. The above warning will be repeated after changing either of those, if needed.

Although the Factor multiplies the sample frequency, in reality this entails dividing the count of a pacer timer by the Factor. Since the actual count supplied to the timer chip must be an integer, it is not always possible to apply the Factor without affecting the acquisition rate.

For example, if the board master clock is 10 MHz and the acquisition sample rate is 20 kHz, then the pacer counter divides 10 MHz by 500 when the Factor is 1. Setting a Factor of 3 would require dividing by 500 / 3 = 166.667, which will be rounded to 167 to give an oversampling rate of 59880.24 Hz. The acquisition sample period would be 3 × 167 or 501 counts, giving a new acquisition rate of 19960.08 Hz instead of 20 kHz.

Daqarta will always report the actual acquisition values for sample period and frequency in the X-axis control menu, and will adjust the X-axis as needed, so you might notice a slight shift when you change the Factor. Upon returning to a Factor of 1, there will typically be no readjustment of the acquisition rate (or the X-axis) back to the initial values, since the required pacer count will always be an integer. In the above example, the acquisition sample rate would remain at 19960.08 Hz.

When you change the oversampling Factor, the values set in the DAC wave component and Digital Output menu pages do not change. Tones will have the same frequencies (since the Freq settings are unchanged), but since duration parameters are stored internally in units of output samples, not time, all actual durations will change. The correct duration times will always be reported when the Smpls/Sec control is in the Sec mode.

So if you increase the Factor from 1 to 2, for example, each tone burst will be half as long and have rise/fall durations that are half as long as well. Similarly, all Digital Output timing will be twice as fast. The rule here is thus that you should determine the Factor that you need and set it FIRST, then set up your particular stimuli.

Although the Freq settings themselves don't change when Factor is used, the maximum values are increased proportionally. The limit is always half of the actual DAC output sample rate, so with a Factor of 2 (for example) you can set Freq as high as the ADC sample rate.

However, as noted previously the Freq setting is not changed when you change Factor. That means that if you raise the Freq setting manually when Factor is active, and then reduce Factor, it is possible to get an erroneous Freq value. For example, if the sample rate is 20 kHz you are normally limited to Freq values less than 10 kHz (the Nyquist limit). If you set Factor = 2, then you may set Freq values up to 20 kHz (half of the new effective DAC sample rate). Suppose you set Freq to 12 kHz, then set Factor back down to 1. The Freq setting is then 2 kHz above the limit, so the actual output will be an "alias" tone equal to the difference frequency of 2 kHz.

DDisk and Factor:
When running in Dynamic RTime mode, only Factor values that divide evenly into 1024 (1, 2, 4, 8, and other powers of 2) will allow the DDisk option. At other settings DDisk will be shown disabled.


Save Setup:

Since there are a LOT of controls in STIM3A, you may want to save all the settings to a file so you can return to the same setup by loading the file in another session, or even later in the same session. Just toggle this control and you will be prompted for a file name for the setup. The setup file saves only information about the configuration of STIM3A, not the main Daqarta program. In particular, it does not save the state of the RTime option or the current sample rate.

STIM3A setup files use a default file extension of .S3A, though you can use another extension if you prefer. However, sticking with .S3A makes it easy to see what setups you have already saved: Just hit ENTER at the default '*.S3A' file prompt, and you will see all the files with that extension, without having to edit the prompt string. The S: parameter on the STIM3A.GEN line in the DQA.CFG file will allow you to change the default file extension.

Each setup file takes about 4500 bytes.

Note that in addition to this manual Save, you will also be prompted at Quit time to save the setup if there have been any changes. However, this prompt will not appear if you have only made changes to the setups of DAC or DigOut outputs that were not active.


Load Setup:

You can activate this at any time to change the setup to one you have previously saved. The default file name is '*.S3A', so if you just hit ENTER at the filename prompt, you will see all the setups you can choose from in the current directory.

You can change the default file name using the S: parameter on the STIM3A.GEN line in the DQA.CFG file. You can also use this with a '+' notation to load a default file at start-up.

You may choose to load setups from any directory, but note that any Arb and/or Play files included in the setup are assumed to reside in the current directory.

A setup includes the names of any Arb and Play files it uses, and when you load the setup, those files are loaded as well. But if those files are no longer present or have errors, the load process will report this and prompt you for confirmation. You can't ESC from the load at this point, since things would be left with an unstable partial setup. You just have to hit a key to confirm the error, and when the setup is done loading, any problem files will be missing. If any had been selected to be active on any page of the setup, that page will have Sine selected instead.

Note that when you are loading Arb/Play files "manually" from their respective menus, you can specify an arbitrary path. However, only the file name itself is saved in a setup file, and the directory is always assumed to be the current directory that holds Daqarta.

The moral of this story is to make sure you don't delete, move, or rename any Arb or Play files that you are using for a setup. If you want to run the same setup on another system, you must make sure you copy all these files, and keep them in the Daqarta directory.

Another possible source of the above errors is if less of the system memory is free. Arb files use low DOS memory, so if you subsequently load TSRs or other resident software and try to run Daqarta again, there may not be enough room for all the Arb files. Similarly, Play files use extended (XMS) memory, so if you install a RAM disk, or move everything to a different system with less total RAM (or no HIMEM.SYS loaded), there may not be room for your Play files.

Since the setup file only saves STIM3A settings, and not the state of the main Daqarta RTime option, you may need to toggle that manually to get the desired overall setup. Also, you may have to adjust the main sample rate if the setup was stored with a different rate than is currently in use.

After loading the setup, the system will be Paused. Just hit the P-key to unPause, and output will begin... assuming that you saved the setup originally with the desired outputs active, including the Master output.

Note that this is different from auto-loading the same setup via the S:+ parameter. In that case, the Master output control is forced off as a safety feature, to prevent immediate output at start-up. If that's what you really want, you will need to use the Auto-Initialization Key Macro to toggle Master on.

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
25 Years of Innovative Instrumentation
© Copyright 1999 - 2006 by Interstellar Research