Daqarta for DOS Contents
The analog input can thus have "infinite" resolution, but the ADC output will be limited according to the number of bits it can use to represent the value. If the ADC has 8 bits, for example, it can only encode 256 possible values (2^8 = 256). If these must handle the entire +/-10 Volt range (20 Volts), then resolution will be 20 / 256 or 0.078125 Volts at best. So our analog input example might be encoded as 15/256 * 20 = 1.171875 Volts, or maybe as 16/256 * 20 = 1.250000 Volts, but it it will never be "exact". The difference is called "quantization error", and can be reduced by using an ADC with more bits. Most modern ADC boards have 12 or 16 bits.
On a command from the computer, a timer, or an external source, the ADC will "sample" the input voltage very briefly and hold that value as a charge on a capacitor, using a circuit called a "Sample and Hold" (S/H) or "Track and Hold" amplifier.
During the "hold" time, the held analog voltage is converted to a digital number by any of several means. The most common method is called "successive approximation", wherein a trial number is converted back to an analog voltage with a Digital to Analog Converter (DAC) and compared to the held input. The trial number is increased or decreased as needed and the final number is reported as the ADC output.
The successive approximation scheme begins with a trial number (and hence a DAC output voltage) that is half of the full range. This corresponds to setting the most significant bit of the binary output value to a one. If the input voltage is at least half of full-scale, then that bit will remain set as part of the final output, otherwise it is cleared to zero. We have thus "approximated" the input voltage by a single bit value... either it is or is not as big as half-scale.
Then the next bit is set, adding a quarter-scale voltage to the DAC output. The DAC will now be at 3/4 if the first bit was set or 1/4 if not. Again a comparison is made, and the new bit is left set or cleared depending on the outcome. We now have a "two bit" approximation to the input.
In like manner, each successive bit is tested. An 8-bit ADC thus requires 8 separate set-and-test operations, each giving a successively better approximation to the true analog input value. When all are done, the final digital value is "latched" on the ADC output lines, and the ADC waits for the next command to begin another conversion.
Throughout this Daqarta Help text, you will see references to the "ADC board". Since PC-type computers don't usually have built-in ADC facilities, this just refers to a board that you must install into your computer to provide the ADC. Sound cards and laboratory data acquisition cards are thus included in this, as well as PCMCIA cards and special modules that can plug into a printer port to provide ADC functions. Some newer machines come with sound card functionality built into the system motherboard, so they don't need a separate board.
Standard ASCII codes were initially defined for values only up to 127, and include all normal keyboard-entry characters plus control characters like carriage return and line feed. IBM PC-type computers actually support a superset of the original ASCII standard, assigning special characters to values from 128 to 255 including line-drawing and other language symbols. Under DOS, these "High-ASCII" characters can be entered from the keyboard by holding down the ALT key while entering the code number on the number pad keys. When ALT is released, the character appears. Daqarta does not support this method at present.
Text editors are like streamlined word processors for dealing with ASCII files. These are typically used for writing programs and DOS batch files, for example. Word processors usually can import and export ASCII files when requested, but they typically have a "native" (often proprietary) format for normal documents. This allows features that ASCII does not support, like different fonts, subscripts, and even embedded graphics images. Since files using these formats use the same 256 byte values to mean different things, a program expecting only ASCII may have serious problems reading them.
If you are not sure that your word processor is in plain ASCII mode, save the file you have created and exit to DOS. Use the DOS TYPE command to view the file. If you see any characters that you didn't type directly, then the file is not ASCII.
If your favorite word processor doesn't support ASCII, you have several alternatives. From Windows, you can use Notepad... it is fine for simple jobs like creating and editing DQA.CFG files and batch files. From a DOS prompt, use the EDIT program that has been included since DOS 4. If you have an earlier version of DOS, there are numerous public domain and shareware text editors available. TED, the Tiny EDitor, is a public domain program comparable to Notepad. The SemWare Editor Junior (TSE JR) is an excellent shareware editor with lots of customizeable features, available at http://www.semware.com. (It was formerly known as QEdit.)
You could make a simple DAC with a bunch of weighted resistors connected to the digital outputs of any parallel port such as a printer port. The smallest resistor would connect to the most significant bit, and each adjacent bit would get twice the value of the one before it. Here is a crude 4-bit DAC:
MSB ------- 10k -------.--------------- OUT | ------- 20k -------| | ------- 40k -------| | LSB ------- 80k -------' GND ----------------------------------- GNDThis approach is rarely used inside real DAC chips, due to problems with the large resistor values needed as the number of bits increases, and the general difficulty in getting exact multiples. Instead, there are "ladder" schemes that use the same values over and over. The exact values don't matter as much as their relative matching, and this turns out to be much easier to integrate on a chip. A simple ladder version of the above would be:
MSB ------- 20k -------.--------------- OUT | 10k | ------- 20k -------| | 10k | ------- 20k -------| | 10k | LSB ------- 20k -------| | 20k | GND -------------------^--------------- GNDThe five 20k resistors are all matched, and are exactly twice the value of the three 10k resistors. If you actually build this circuit or the prior one, note that they assume that all of the digital outputs match and that a 0 output is really 0 Volts. That's not guaranteed for typical digital outputs, but for the simple 4-bit systems shown here it is good enough. To scale this up to 8 bits or more would require special buffer amplifiers to insure matching.
dB = 10 * log(P1 / P0)where P1 is the power of the signal being measured and P0 is some reference power it is being compared to. The reference power is either stated, or implied by a particular standard.
For example, when talking about frequency response of a system, it is common to refer to the upper and lower -3 dB frequencies (or simply the 3 dB points, since the minus sign is understood). These are the frequencies where the power is reduced to half of what it is in some middle frequency range which is used as a reference. Since the log of 1/2 is -0.30103, multiplying by 10 gives about -3 dB.
Note that dB is a signed value, but the sign is often implied by the method of expression. For example, you could say that one power is 3 dB lower than another, or you could say that it is -3 dB relative to the other.
You might want to think of dB as a nonlinear way to express 'percent' for power measurements; for example, '-3 dB' is just another way of saying '50%', where it is always assumed you are talking about power. It doesn't matter whether the power is microwatts or megawatts, half is always -3 dB.
Why not just stick with percentages? Consider that the ratio between the largest and smallest powers that a system deals with may be billions to one; who would want to deal with numbers like 0.0000000001 percent? Rather than counting the leading zeroes, we can just use -120 dB.
Although the dB system may seem awkward at first, it is much more intuitive than percentages in actual use. Since our senses (and other systems) respond in a logarithmic fashion, the same number of dB gives roughly the same change in sensation at different parts of the range. A sound that is 73 dB above your threshold of hearing sounds about as much louder than +71 dB, as a sound at +56 dB sounds louder than +54 dB. You can easily see that there is a 2 dB difference in both cases, but try that with percentages: 1995262315% is to 1258925412% as 39810717% is to 25118864%, but it sure isn't obvious!
Another point to keep in mind is that, like a percentage, a dB value is always relative to something. You can talk about a change in a single value, like 'a 7 dB reduction', or you can talk about comparing different readings, like 'this harmonic is 13 dB below the fundamental'. In these cases it should be pretty clear what is relative to what. In other cases the reference must be explicitly specified. The common convention is to use something like 'dB re: 1 kW', here specifying that the 0 dB reference is a power of 1 kW. Daqarta labels the Y-log axis as 'dB re:FS' to denote that a 0 dB signal is 100% of the Full-Scale input level on the current ADC range. There are also notations like 'dB SPL' where the 0 dB reference is a specified standard value, making these absolute dB readings (see below).
dB from Voltages:Although dB is technically a ratio of power levels, it is commonly used with voltages by assuming that both voltages are driving a constant resistive load, such that:
Power = Voltage² / ResistanceSo if we have 2 different voltages V1 and V0 and resistance R, the R drops out:
dB = 10 * log((V1² / R) / (V0² / R)) = 10 * log(V1² / V0²) = 10 * log(V1 / V0)²Then using the property that the square of a log is equal to twice the log:
dB = 10 * 2 * log(V1 / V0) = 20 * log(V1 / V0)This assumption of constant resistance may not always be true, such as when the voltage is driving a complex load like a loudspeaker whose impedance changes with frequency. But it is still proper, for example, for a manufacturer to assume constant resistance when discussing sound card amplifier performance, since there are no standards for loudspeaker impedance versus frequency... and there are a LOT of different loudspeakers on the market.
Typical dB Applications:The -3 dB (half-power) point is still the standard for reporting frequency response, even though you are actually measuring voltage. The equivalent voltage ratio is 0.707, which is half of the square root of 2.
Although technically incorrect, amplifier gain is often expressed in dB based simply upon the ratio of the output voltage over the input voltage, even when it is clear that the input resistance and output resistance are quite different. For example, an typical home audio power amplifier with a voltage gain of x20 may be referred to as 26 dB of gain, even though the input impedance is 47000 ohms and the output load is 8 ohms.
Attenuation is usually given in dB. Note that use of the word "attenuation" implies a reduction from the reference (input) level, or negative dB. So if you see mention of an "attenuation of 60 dB", that means the output voltage is 0.1% of the input, which might also be described as "60 dB down". Here 0 dB is the input signal level before any attenuation.
There is a real possibility for sign confusion when dealing with "attenuation" and "level", since that same 60 dB of attenuation might instead have been expressed as a level of -60 dB. This is usually clear from the context, but not always. The typical problem arises when you ask another person to adjust a control. It may be a single control, but you may think of it as controlling level ("volume"), and they may think of it as controlling attenuation. So what happens when you ask for "another 3 dB"? Do you get 3 dB more output, or 3 dB less? You should agree on a standard, but just to be safe you may want to say something like "3 dB louder".
Distortion is often expressed in dB, as in "The distortion at the third harmonic is more than 40 dB down". This means that when the desired or input tone frequency produces an output of a certain voltage, the distortion component at 3 times that frequency is less than 1% as large.
This same approach is used with Total Harmonic Distortion (THD) and Intermodulation Distortion (IM) by combining all the distortion components together to get a single dB value. However, note that you can't do this by simply adding all the individual component dB values. That's because the sum of logarithms is not equal to the log of their sum, and the sum of squares is not equal to the square of their sum. To do this properly you would need to add the squared component voltages together first, divide by the reference squared, and then take the log and multiply by 10:
dB(total) = 10 * log((V1² + V2² + ... + Vn²) / V0²)This gives the RMS sum of the components, expressed in dB.
Working With dB:When a voltage is reduced by half, it is -6 dB. When it's doubled, it's +6 dB. Every halving or doubling changes the result by 6 dB, so 1/4 is -12 dB, 1/8 is -18 dB, and so on.
When a voltage is changed by a factor of 10, there is a 20 dB change. So if the output is 60 dB less than the input, the voltage is 1/1000.
A 10 dB change represents a factor of 3.16 voltage change. This value has the magical property that the reciprocal has the same digits, so -10 dB is a factor of 0.316 voltage change.
A 1 dB change represents about 11% voltage change.
Putting all these little rules of thumb together, you can make approximate conversions between dB and voltage in your head. Since adding or subtracting dB is the same as multiplying or dividing by the ratios, you can break an oddball value into separate steps.
For example, if an output signal is -56 dB relative to the input, you can break it into -40, -10, and -6 dB. You know that every -20 dB is a factor of 10 (one decimal place) smaller, so -40 dB is 0.01. The -10 dB will make that 0.316 smaller, down to 0.00316. And since -6 dB is just 1/2, the overall output must be 0.00158 of the input.
In audio work dB SPL refers to Sound Pressure Level, which uses a reference of 0.0002 microbar. (A microbar is a unit of pressure equal to a millionth of standard atmospheric pressure.) 0 dB SPL is approximately the threshold of hearing at the most sensitive frequency of the average normal human ear. (See "Some Formulas For Working With Sound".)
Consider that the average ear can hear up to about 120 dB SPL before pain begins. This requires a million times more voltage to produce than 0 dB, which seems to imply that an ideal digital audio system needs at least 21 bits to capture the full range. (20 bits = 2^20 = 1048576, but we need to handle both positive and negative voltages, so we would need twice that range, or 21 bits.)
Luckily, we rarely listen in "threshold" conditions with zero background noise, and we rarely want to bring ourselves to pain, so the theoretical 96 dB range of a 16-bit system is usually adequate for most purposes.
Why does a 16-bit system have a 96 dB range? Remember that every additional bit doubles the number of possible output voltages you can produce, and every time you double the voltage you add 6 dB to the range. So 16 times 6 dB = 96 dB. Similarly, an 8-bit system would have a 48 dB range, and a 12-bit system would have a 60 dB range.
Besides absolute values like dB SPL, you may see some that are "semi-absolute", like dB SL (Sensation Level) or dB HL (Hearing Level). In these cases the reference level is a subject's own threshold for detection, using some particular protocol.
Let's say you are studying the ability to detect small amounts of frequency modulation in brief tone bursts. You want to know if the ability to do this varies with loudness. Before you begin, you determine the minimum level of an unmodulated burst that a subject can just detect, and call that 0 dB. Then you run all your modulation tests at levels of 20, 40, 60, and 80 dB above this subject's reference level.
You repeat this whole procedure for each subject. Note that each may be using different absolute sound levels, since each may have a different threshold of hearing. This method tends to compensate for those differences, but note that it also has a really big benefit regarding ease of operation: There is no need to make sound level measurements. You simply adjust the signal level to find the reported threshold, read that level setting and call it 0 dB, and add the needed dB to get each test level.
Of course, it would be a good idea to also record the actual level settings that correspond to the 0 dB threshold in each subject. Then a single calibration measurement for your sound system will allow you to determine the approximate absolute thresholds of all subjects.
The "full duplex" designation is often applied to sound cards that can acquire input data via an ADC at the same time they are producing output data via a DAC. Note that "full" tells nothing about the bit resolution in each direction, and a sound card may legitimately be called "full duplex" if it can acquire 16-bit data while generating 8-bit data, or vice- versa.
"Full" also tells nothing about the number of channels in each direction, and some cards can achieve stereo operation in both directions while others can only manage mono... though maybe at 16-bits each way.
The STIM3A Stimulus Generator requires full duplex capabilities in order to produce stimulus outputs during data acquistion. (At this time, SB16.ADC is the only sound card driver that supports this, for the Sound Blaster 16/32/64 card family.)
Laboratory-type boards that generate an interrupt for each sample period typically have no problems with simultaneous ADC and DAC operation, although they never use the term "duplex". On each interrupt, the board driver's interrupt handler simply reads the proper data from the stimulus buffer and writes it to the DAC or DACs, then reads the ADC data and stores it to system memory.
Optical isolation is usually the method of choice: If the device being connected to the subject is a monitoring or recording amplifier, for example, it is battery-operated so that no connection to the main power lines is needed. The isolator then converts the amplified signal from electrical to optical form, essentially by using it to drive a special Light Emitting Diode (LED) similar to those commonly used as indicator lights. The light is modulated so that its intensity is directly proportional to the signal amplitude.
The light then travels a short distance through an electrical insulator (epoxy plastic, for example) before hitting a linear photodetector that converts it back to electrical form. The detector part of the circuit is run from the main power lines, and is not connected electrically to the LED side (subject side) of the circuit in any way.
This maintains total electrical isolation of the subject from the power lines in the event of catastrophic failure of the equipment or the power system itself.
For electrical stimulation of the subject, the idea is the same but reversed: Here the stimulator must be driven by batteries, and receives a light signal from a powerline-driven modulator.
Although the isolator assures safety from powerline problems, the battery-powered amplifier or stimulator must still be carefully designed: Even small electrical currents can be lethal when directly connected to the subject, especially across the heart as in recording heart rate, etc.
For use on human subjects, ALWAYS use properly designed and isolated equipment certified for the intended purpose. For small lab animals like rats, mice, and guinea pigs, however, the danger is usually considered minimal enough to use "home-made" preamplifiers without isolation. Consult the animal use committee at your institution for details.
ADC sample rate is higher than the observed sample rate. This is often the case in special audio ADCs, where a simple converter with a small number of bits running at a very high sample rate is digitally processed into an equivalent higher resolution at a lower rate.
In Daqarta, "stimulus oversampling" is used by the STIM3A driver to allow many laboratory-type boards to generate output (DAC or digital) samples at higher rates than the incoming ADC samples. For example, some animals can hear frequencies well above 20 kHz, to which they may respond with brain waves that are below 1 kHz but last for several milliseconds. Stimulus oversampling can provide low distortion stimuli at sample rates above 50 kHz, while the screen shows the full response duration by effectively sampling the input at lower rates. Daqarta would run both the inputs and outputs at the higher rate, then discard unwanted input samples.
But the outputs of some boards are capable of much higher rates than the ADC can achieve. On these boards, Daqarta is able to generate stimuli at the higher rates by special timer handling that keeps the ADC rates synchronized but within safe limits. Whenever the output rate is higher than the maximum ADC rate, Daqarta refers to this as "hypersampling".
ADC conversion directly, or may generate an IRQ to interrupt the CPU. In the latter case, the CPU would need to start the ADC sample conversion directly. For inexpensive boards without built-in pacers, Daqarta uses the system timer to perform the pacing.
Some boards have provision to use an external TTL pacer input to provide synchronization with a user-supplied reference signal. Note, however, that manufacturers may refer to the pacer as the device that "triggers" the ADC. Since they also use "trigger" to mean "start collecting a sweep of N samples" (as Daqarta does), things can get very confusing. Usually, a reference to "external trigger" really means "external pacer".
Another word for pacer is "sample clock".
As an example, consider a 14 inch monitor with an actual 13 inch viewable diagonal. In mode 10h, the "lit" part of the display has dimensions of 10.3 by 8.0 inches, but some of that is merely border... the working area is actually 10.0 by 7.7 inches. Since there are 25.4 mm/inch, this works out to about 907 by 699 phosphor dots. The best way to think of this whole process is to imagine that the video card is projecting an image through a mask with 640 by 350 holes, and that image passes through another mask (the monitor) of the same overall size, but with 907 by 699 holes.
The RMS method takes the square of the instantaneous voltage before averaging, then takes the square root of the average. This solves the polarity problem, since the square of a negative value is the same as the square of a positive value. For a sine wave, the RMS value thus computed is the same as the amplitude (zero-to-peak value) divided by the square root of two, or about 0.7071 of the amplitude. For a repetitive waveform like this, an accurate calculation can be done by averaging over a single cycle of the wave, but for random noise sources the averaging time must be long enough to get a good representation of the characteristics of the source.
RMS, the result will be also be an RMS value. If the originals were zero-to-peak amplitudes, then the result will be the equivalent amplitude of a sine wave having the same energy as the sum... you can multiply this by 0.7071 to get the RMS value of the composite.
This is the method used to find the total energy in a band of frequencies from the FFT output.
Y = Yotta 10^+24 Z = Zetta +21 E = Exa +18 P = Peta +15 T = Tera +12 G = Giga +9 M = Mega +6 k = kilo +3 (Daqarta will also accept K) 0 = Base unit (Volts, Hertz, etc) m = milli -3 µ = micro -6 (Daqarta will also accept u) n = nano -9 p = pico -12 f = femto -15 a = atto -18 z = zepto -21 y = yocto 10^-24
Daqarta only accepts the prefix, not the base unit. For example, enter 1.234m instead of 1.234 mV.
If you are using the field-copy option to copy an entered parameter value to a comment field, and if you have used scientific notation to enter a value outside the above range, and if the value is accepted by Daqarta, then you will see a small epsilon for all prefixes below 'y' (yocto = 10^-24), or '!' for all prefixes above 'Y' (Yotta = 10^+24). (At present, this latter can only happen when entering WaitS delays longer than a million times the age of the universe!)
Typically, tone switches allow control of rise time, since a fast rise time may still be too click-like, while a slow rise time may not evoke enough response from the subject. The better tone switches provide for optionally synchronizing the tone burst with the tone... they delay the gate pulse until the tone goes through a specified zero crossing, insuring that each tone burst is absolutely identical. The polarity of zero crossing may be positive, negative (which produces a mirror image tone burst), or alternating between the two.
This may have important benefits for certain experiments, where the evoked response contains one component that mimics the stimulus waveform and another that is relatively the same for each stimulus whether positive or negative. You can cancel the first component by averaging together half positive and half negative stimuli, leaving only the independent component. Although the same could be done with a simpler tone switch having no synchronization, the random stimuli would take much longer to average out.
With Daqarta, the functions of a tone switch can be easily duplicated via the STIM3A Advanced Stimulus Signal Generator using its Burst mode. Unlike the older STIM3, STIM3A can produce a wide variety of waveforms and random noise types, and can apply the Burst function to any of these, including waveforms or .WAV files created elsewhere.
The FM synthesizer chip in most sound cards can approximate tone switch functions, with somewhat limited control over the shape of the tone bursts. The Daqarta sound card drivers also allow you to generate bursts of random noise by using undocumented features of the synthesizer chip.
Newer chip technologies like CMOS (Complementary Metal-Oxide Semiconductor, pronounced like "Sea Moss") can be made to run on a wider range of voltages, but until recently have been standardized at 5 Volts for computer compatibility. The emergence of battery-powered laptop computers has forced manufacturers to reduce the supply voltage to the computer itself to 3.3 Volts or even lower to conserve power, but connections to peripheral devices like printers must still adhere to the TTL standard.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
25 Years of Innovative Instrumentation
© Copyright 1999 - 2006 by Interstellar Research