[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:
 

STIM3 STIMULUS GENERATOR v2.00:


INTRODUCTION:

This module allows you generate output signals using any supported laboratory-type board that provides Digital-to-Analog Converter (DAC) outputs and / or digital outputs. It also supports full-duplex sound cards that use the SB16.ADC driver, but these have no digital output capabilities.

STIM3 supports only laboratory-type ADC boards and full-duplex sound cards like the SB16/32/64. Other sound cards use their built-in synthesizers for stimulus generation. See the help system of your particular card for full details.

Two DAC channels of up to 16 bits each are supported, plus a digital output of up to 8 bits. These may be used simultaneously in any combination.

Each DAC channel allows up to 4 different tone components to be generated, with full control over the frequency, phase, and level, as well as onset delay, sustain duration, and rise / fall durations. By controlling the timing of each component, the four can be made to occur sequentially or concurrently during a single data acquisition sweep. The components may also be grouped for output on two separate alternating sweeps or four sequential sweeps. The two DAC channels are completely independent, so up to 8 tones can be used.

The digital output allows individual control of each of the 8 bits. Each bit output may be set to provide either one pulse or a train of pulses, with complete control over the timing and polarity. When the stimulus generator is set to an alternating stimulus mode, complete control is available for two or four different 8-bit digital sequences.

It is not essential that the digital outputs be provided by the same board that provides the DAC outputs, nor is it required that any of these be provided by the acquisition board... there can be separate drivers for each, if needed. A special driver to utilize a standard printer port for digital output is planned.

The stimulus generator works in synchrony with the data acquisition process. At each sample time, an output sample is given from each active stimulus source in the order

    DAC 0, DAC 1, DigOut
before the analog input sample data is read. The stimulus samples are precomputed and stored, in the same sequence they will be used, in one large memory buffer of up to 64 Kbytes in size. Whenever any stimulus parameter is changed, the entire stimulus buffer is recomputed.

In Sequential acquisition mode, the stimulus output begins at the start of each acquisition sweep and continues to the end of the specified number of acquisition samples N or the end of the specified stimulus, whichever is greater. Processing and display are then performed, and the cycle is repeated. If a stimulus Cycle time has been set via the Trigger control menu, the stimulus and data acquisition start will be delayed until the proper time for the start of the cycle.

Whenever any stimulus output is active, the Trigger Source is forced to Stim, making the start of the stimulus the effective trigger event. (A special Pulse option allows the same effect as the normal Trigger Source Pulse option, if you choose not to use the full Digital Output capabilities.)

In RTime mode, the stimulus output just repeats continually. If the Trigger Source is set to Stim, then the N samples displayed will be synchronized with the first sample of the stimulus. You can generate continuous background tones by proper setup of the stimulus parameters.

In either mode, you can look at events that take place before or after the start of the stimulus cycle by setting the Trigger Delay to negative or positive values, respectively.

Longer stimulus memory buffers allow longer stimuli, or longer cycles in RTime mode. The default size for the buffer is 16 Kbytes. To change the buffer size, change the invocation line in DQA.CFG to read:

    STIM3.GEN  B:n
where n is a number from 8 to 64 representing memory Buffer size in Kbytes.

Alternately, you may specify the buffer size using the same B:n notation on the INIT (first) line of DQA.CFG. This is intended for use with boards like the Sound Blaster SB16/32/64 that can use DMA for both input and output. Since DMA accesses must never cross an absolute 64K memory boundary, Daqarta will take care of the alignment without wasting any memory. It does this by juggling the locations of several program segments to get an optimum fit, but it must do this before any modules are loaded... thus, the INIT line at the start of the configuration.


SAMPLES vs. MEMORY BUFFER SIZE:

The maximum number of time samples (ie. a sample each from all active outputs) versus buffer size in Kbytes is:
 Memory Buffer size:         8K    16K    32K    64K

                            ----- Time samples ------

 One DAC, 8-bit:            8192  16384  32768  65536
 One DAC, 16-bit:           4096   8192  16384  32768

 Both DACs, 8-bit:          4096   8192  16384  32768
 Both DACs, 16-bit:         2048   4096   8192  16384

 Digital only:              8192  16384  32768  65536

 8-bit DAC + DigOut:        4096   8192  16384  32768
 16-bit DAC + DigOut:       2730   5461  10922  21844

 2 x 8-bit DACs + DigOut:   2730   5461  10922  21844
 2 x 16-bit DACs + DigOut:  1638   3276   6552  13104


SPEED:

On slower CPUs, use of the stimulus generator may reduce the maximum sample rate possible from a given acquisition board, especially a high speed board. The board driver may be limited internally to the maximum acquisition rate specified for its Analog-to-Digital Converter (ADC), but that presumes that the CPU can keep up... which it may not be able to do along with stimulus generation, especially if multiple outputs are active.

Conversely, faster systems may be able to use the stimulus oversampling Factor control to get higher stimulus sample rates than the board's ADC allows for acquisition alone.

In RTime mode, an additional speed loss may come from lack of DMA capability during stimulus generation. DMA (Direct Memory Access) allows a board to acquire a sample and automatically transfer it to memory without software intervention. It allows faster RTime sample rates with most CPUs except 286s. However, for many boards DMA can be used only for acquisition. Others, including most sound cards, allow it to be used for either acquisition or DAC output generation, but few have the dual DMA hardware to allow both at the same time. For this reason, the Daqarta stimulus generator presently uses the slower interrupt-driven sampling mode, not DMA mode, for RTime operation.


DEMO BOARD:

You can use the DEMO.ADC "dummy" acquisition board driver with the stimulus generator. When the stimulus is on, certain input channels are connected to certain stimulus outputs, as follows:
    Input           Stimulus
    CH0             DAC 0
    CH1             DAC 1
    CH2 -  CH7      Normal DEMO ramp signal
    CH8             DOUT bit 0
    CH9             DOUT bit 1
    CH10            DOUT bit 2
    CH11            DOUT bit 3
    CH12            DOUT bit 4
    CH13            DOUT bit 5
    CH14            DOUT bit 6
    CH15            DOUT bit 7
The "signals" acquired in this way may then be used as though they were real-world signals acquired by a real board. This allows testing of preliminary experimental designs, as well as the opportunity to become familiar with the spectra of certain complex signals.


SETUP:


SETUP INTRODUCTION:

Before activating any of the stimulus outputs, you need to set them to your particular requirements. You do this by entering a special Adjust submenu for each output you intend to use: DAC 0, DAC 1, or DigOut. The appropriate submenu will pop up over the main Stimulus Generator menu.

Each submenu has multiple pages. For DAC 0 and DAC 1, there are four pages each, labeled A through D, which control four different components of the stimulus. The components are presented according to the ALL, PAIR, or EACH setting of the Pg Mode option. You change pages via CTRL-PgUp or CTRL-PgDn from the submenu.

For DigOut there are typically 8 pages, labeled A0 through A7, for the 8 individual bits of the output port. As above, you change pages with CTRL-PgUp or CTRL-PgDn. However, you may elect to have four separate SETS of pages (A0-A7, B0-B7, C0-C7, and D0-D7 corresponding to the different Pg Mode settings) via the Dig Pg control on the Misc menu page. In that case, CTRL-ALT-Pg keys move between sets.

NOTE: The stimulus parameters can only be changed when the Stimulus Generator menu is active to rebuild the stimulus buffer. If you go to the X-axis menu and double the sample rate, for example, the same samples will come out of the buffer at twice the rate... doubling the stimulus tone frequency and halving its duration. As soon as you return to the Stimulus Generator menu the buffer will be updated to match the parameters you had previously set... in this case, creating twice as many samples to compensate for the doubled sample rate. The rule is to set sample rate FIRST, then set the stimulus.

Also note that during DDisk recording or signal averaging you will be prevented from changing the stimulus. The cursor won't move to any output control. You can bring up the DAC 0, DAC 1, and DigOut control submenus in order to review the settings, but the cursor will be missing to prevent any changes.


Master On / Off:

When Master is On, all selected stimulus outputs are active, at the effective sample rate determined by the normal X-axis (acquisition) rate times the Factor setting. The trigger source is forced to Stim, so each sweep will start in sync with the stimulus start.

This is the only trigger source available for sequential operation (and probably the only one that makes sense most of the time), but for RTime operation you can also select the Internal source to trigger on features of the input signal. This might be needed if the response you are observing is not highly correlated with the stimulus, such as an increase in "spontaneous" responses to a long stimulus tone.

If you set Master to On but there are no outputs selected, there is no change... no outputs are active.

When Master is Off, all analog and digital stimulus outputs are off and the input trigger source reverts to Internal instead of Stim. Trigger mode reverts to Auto.

The Factor value is ignored in the Off state.


Pg Mode:

This determines how the four tone component pages specified for each DAC channel will be deployed, and likewise enables multiple digital output sequences.

ALL:

All four tone components A, B, C, and D are summed to create a single stimulus for each DAC channel. Only one 8-bit digital output sequence is active.

PAIR:

Components A and B are summed, and components C and D are summed separately to create two stimuli for each DAC channel that are presented on alternate sweeps. Similarly, the digital outputs can alternate between two different 8-bit sequences if the Dig Pg control (in the Misc menu) is set to Ind.

EACH:

Each of the four tone components A, B, C, and D is used as a separate stimulus on four successive sweeps. Four separate 8-bit digital output sequences are also available if Dig Pg is set to Ind.


DAC 0 or DAC 1:

Activates or disables the corresponding DAC channel output. The item will be highlighted when that channel is active.

To activate any DAC output, at least one of its tone component pages must be active or you will get an alert and warning:

    'Must have at least one active page per output.'

Adjust DAC 0 or DAC 1 Submenus:

Invokes the Tone Component Adjust submenu system for each DAC channel. Each channel allows adjustment of up to four tone component pages, each page with parameters for On/Off, Frequency, Phase, Start delay, Rise, Sustain, and Fall durations, and Level. Use CTRL-PgUp or CTRL-PgDn to move between pages, or ESCape to return to this Adjust item.


DigOut:

Activates the 8 bit digital output stream. To do this, at least one bit menu page must be active or you will get an alert and warning:
    'Must have at least one active page per output.'

Adjust DigOut Submenus:

Invokes the Digital Output Adjust submenu system, with a separate menu page for each of 8 output bits. Use CTRL-PgUp or CTRL-PgDn to move between bit pages, or ESCape to return to this Adjust item.

When Pg Mode is set to ALL, there is only one set of bit pages available, labeled A0 through A7.

When Pg Mode is PAIR there are two sets of bit pages, A0-A7 and C0-C7. The A set controls the stimulus sequence that will be presented at the same time as the A+B components from the DACs, while the C set controls the alternate sweeps when the C+D components are being generated. CTRL-ALT-PgUp or CTRL-ALT-PgDn moves between the two sets, while keeping the same relative bit page (from A3 to C3, for example). Dig Pg (in the Misc menu page) must be Ind to allow this independent set control, since the Lock A default forces all sets to mirror the A set.

With Pg Mode set to EACH there are four sets of bit pages, A through D, corresponding to DAC components A through D. As for PAIR mode, the CTRL-ALT-Pg keys move between sets if Dig Pg is Ind.


Sample 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. A typical application is with auditory evoked responses using high frequency tone bursts as stimuli. If the subject is a 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 if you want 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 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 used 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 tone 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 in units of output samples, not time, all actual durations will change. 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.


Stimulus Display:

This controls the image of the stimulus that appears superimposed over the trace area when you are in waveform display mode. There is a small "trace" for each active DAC channel and for each of the 8 bits of the digital output if DigOut is active.

Repeated ENTERs on this item change it between On, Off, and Expand. The Expand mode is intended for use when the Factor is greater than one. In that case, Expand shows all the output samples, whereas On only shows those that would correspond to each input sample. You would use On to compare the response features and timing to features of the stimulus, whereas Expand would allow you a better view of the stimulus when adjusting its features relative to each other.

Since the stimulus may often be longer than the number of acquisition samples N, especially with the Factor and Expand active, you can use trigger delay to view the later portions.

The Display traces are shown in ALT trace color, which you can change from the main color control menu invoked by CTRL-C.

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