Abstract: This arTIcle answers most of the common quesTIons regarding data converters. Presented in a classic FAQ format it addresses topics such as: What is an ADC, what is a DAC, what is nyquist, effects of charge injecTIon, techniques for digital filtering, interfacing to a serial port, I2C interface, SPI interface, bit banging, microwire interface, PC board layout TIps and guidelines, grounding tips, bypass capacitors effect on performance, debugging ADC accuracy, and debugging noisy measurements.
Check the list of questions or the list of keywords below.
QuestionsIntroductory Questions
What Is an Analog-to-Digital Converter (ADC)?
What Is a Digital-to-Analog Converter (DAC)?
How Does an Algorithmic ADC Work?
How Does a Pipeline ADC Work?
How Does a Delta-Sigma (or Sigma-Delta) ADC Work?
How Does a Flash ADC Work?
How Does a Successive-Approximation-Register (SAR) ADC Work?
How Does a Dual-Slope Integrating ADC Work?
Intermediate Questions
What Is the Nyquist Limit?
Why Does the ADC Disrupt the Signal It Is Measuring?
What Techniques Are Used for Digital Filtering?
When Should I Use a Balun?
Applications
Can I Connect a Serial A / D to My Computer's Serial Port?
Can I Get a "Smart" ADC?
What Is the SPI Interface?
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
How Can I Debug (or Probe) an SPI Interface?
What Is Bit-Banging?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
What Is the MICROWIRE Interface?
What Is the I²C Interface?
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging?
PC-Board Layout Guidelines
Do You Have Any General Circuit-Layout Tips?
Do You Have Any Circuit-Layout Tips for A / D Converters?
Do You Have Any Grounding / Ground Plane Tips?
Can the 0.1µf Bypass Capacitors Be Eliminated?
How Can I Model Real-World Effects of Printed-Circuit Boards?
Debugging and Diagnostics
Why Am I Not Getting the Specified Accuracy Out of My ADC?
Why Is the Output Code Stuck at All Ones?
Why Are the ADC Measurements Noisy?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
Keywords A / D
What Is an Analog-to-Digital Converter (ADC)?
ADC
What Is an Analog-to-Digital Converter (ADC)?
Algorithmic
How Does an Algorithmic ADC Work?
Bit-Banging
What Is Bit-Banging?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging?
Capacitors
Can the 0.1µf Bypass Capacitors Be Eliminated?
Charge-Balancing
How Does a Successive-Approximation-Register (SAR) ADC Work?
COM
Can I Connect a Serial A / D to My Computer's Serial Port?
CPHA
What Is the SPI Interface?
CPOL
What Is the SPI Interface?
D / A
What Is a Digital-to-Analog Converter (DAC)?
DAC
What Is a Digital-to-Analog Converter (DAC)?
Delta Sigma
How Does a Delta-Sigma (or Sigma-Delta) ADC Work?
DSP
What Techniques Are Used for Digital Filtering?
Dual Slope
How Does a Dual-Slope Integrating ADC Work?
FFT
What Techniques Are Used for Digital Filtering?
FIR
What Techniques Are Used for Digital Filtering?
Flash
How Does a Flash ADC Work?
I²C
What Is the I²C Interface?
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging?
IIR
What Techniques Are Used for Digital Filtering?
Layout
Do You Have Any General Circuit-Layout Tips?
Do You Have Any Circuit-Layout Tips for A / D Converters?
Do You Have Any Grounding / Ground Plane Tips?
How Can I Model Real-World Effects of Printed-Circuit Boards?
MAX104
How Does a Flash ADC Work?
MAX1280
How Does a Successive-Approximation-Register (SAR) ADC Work?
MAX132
How Does a Dual-Slope Integrating ADC Work?
MAX1400
How Does a Sigma-Delta (or Delta-Sigma) ADC Work?
MAX1460
Can I Get a "Smart" ADC?
MAX194
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
MAX195
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
MAX7651
Can I Get a "Smart" ADC?
Microcontroller
Can I Get a "Smart" ADC?
MICROWIRE
What Is the MICROWIRE Interface?
MISO
What Is the SPI Interface?
Modeling
How Can I Model Real-World Effects of Printed-Circuit Boards?
Modulator
How Does a Sigma-Delta (or Delta-Sigma) ADC Work?
MOSI
What Is the SPI Interface?
Noise
Why Are the ADC Measurements Noisy?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
Parallel
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
Parasitic
How Can I Model Real-World Effects of Printed-Circuit Boards?
Pipeline
How Does a Pipeline ADC Work?
Production
Can the 0.1µf Bypass Capacitors Be Eliminated?
How Can I Model Real-World Effects of Printed-Circuit Boards?
Prototype
How Can I Model Real-World Effects of Printed-Circuit Boards?
RS-232
Can I Connect a Serial A / D to My Computer's Serial Port?
SAR
How Does a Successive-Approximation-Register (SAR) ADC Work?
SCLK
What Is the SPI Interface?
Serial
Can I Connect a Serial A / D to My Computer's Serial Port?
What Is the SPI Interface?
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
How Can I Debug (or Probe) an SPI Interface?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
What Is the MICROWIRE Interface?
What Is the I²C Interface?
Sigma Delta
How Does a Sigma-Delta (or Delta-Sigma) ADC Work?
"Smart" ADC
Can I Get a "Smart" ADC?
SPI
What Is The SPI Interface?
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
How Can I Debug (or Probe) an SPI Interface?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
Successive Approximation Register
How Does A Successive-Approximation-Register (SAR) ADC Work?
Troubleshooting
How Can I Debug (or Probe) an SPI Interface?
Why Is the Output Code Stuck at All Ones?
Why Are the ADC Measurements Noisy?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
Wavelet
What Techniques Are Used for Digital Filtering?
Introductory Questions This section includes general introductory questions about A / D converters.
References
Data Converters:
Principles of Data Conversion System Design
Behzad Razavi
IEEE Press, 1995
ISBN 0-7803-1093-4
IEEE order number: PC4465
The Art of Electronics (2nd Edition)
Paul Horowitz, Winfield Hill
Cambridge University Press, 1989
ISBN 0-5213-7095-7
What Is an Analog-to-Digital Converter (ADC)? An analog-to-digital converter (also known as an ADC or an A / D converter) is an electronic circuit that measures a real-world signal (such as temperature, pressure , acceleration, and speed) and converts it to a digital representation of the signal.
It compares the analog input voltage to a known reference voltage and then produces a digital representation of this analog input. The output of an ADC is a digital binary code. By its nature, an ADC introduces a quantization error. This is simply the information that is lost, because for a continuous analog signal there are an infinite number of voltages but only a finite number of ADC digital codes. The more digital codes that the ADC can resolve, the more resolution it has and the less information lost to quantization error.
BACK TO QUESTIONS
What Is a Digital-to-Analog Converter (DAC)? A digital-to-analog converter (also known as a DAC or a D / A converter) is an electronic circuit that converts a digital representation of a quantity into a discrete analog value . The input to the DAC is typically a digital binary code, and this code, along with a known reference voltage, results in a voltage or current at the DAC output. The word "discrete" is very important to understand, because a DAC cannot provide a continuous time output signal; rather, it provides analog "steps." The steps can be lowpass-filtered to obtain a continuous signal. By increasing the resolution of the DAC, the number of discrete steps is increased and the step size is reduced (which reduces the quantization error), resulting in a signal that closer approximates a continuous time signal.
BACK TO QUESTIONS
How Does an Algorithmic ADC Work? An application note covering this topic is presently being developed.
BACK TO QUESTIONS
How Does a Pipeline ADC Work? Refer to the application note Understanding Pipelined ADCs.
BACK TO QUESTIONS
How Does a Sigma-Delta (or Delta-Sigma) ADC Work? An application note covering this topic is presently being developed.
BACK TO QUESTIONS
How Does a Flash ADC Work? A flash ADC is also called a "parallel encoder." The key advantage of this architecture is very fast conversion times. The key disadvantage is high power consumption. A flash ADC is suitable for very-high-speed , low-resolution applications. This architecture becomes prohibitively expensive for higher resolutions. The MAX104 is an example of a flash ADC.
Refer to the application note Understanding Flash ADCs.
For additional information, refer to The Art of Electronics.
BACK TO QUESTIONS
How Does a Successive-Approximation-Register (SAR) ADC Work? Refer to the application note Understanding SAR ADCs.
For additional information, refer to The Art of Electronics or to the Motorola M68HC11 Reference Manual (Chapter 12), a microcontroller reference manual from Motorola.
BACK TO QUESTIONS
How Does a Dual-Slope Integrating ADC Work? A dual-slope integrating ADC is best suited for low-speed applications where good power-supply rejection is desired. The MAX132 is an example of a dual-slope ADC.
An application note specifically covering this topic is presently being developed.
For additional information, refer to The Art of Electronics.
BACK TO QUESTIONS
Intermediate Questions This section covers more involved A / D converter issues.
What Is the Nyquist Limit? The Nyquist limit is defined as half of the sampling frequency. The Nyquist limit sets the highest frequency that the system can sample without frequency aliasing. In a sampled data system, when the input signal of interest is sampled at a rate slower than the Nyquist limit (fIN> 0.5fSAMPLE), the signal is effectively "folded back" into the Nyquist band, thus appearing to be at a lower frequency than it actually is. This unwanted signal is indistinguishable from other signals in the desired frequency band (fSAMPLE / 2).
For example, if your system samples the ADC at 2.048kHz, the Nyquist limit for that system is 1.024kHz. If we applied an input signal at 2.56kHz, due to frequency aliasing, the input signal is indistinguishable from a 0.512kHz signal (2.56 kHz-2.048kHz). No amount of clever digital signal processing can put back the information lost as a result of frequency aliasing. The only way to know what you have sampled is to physically restrict the input bandwidth prior to sampling.
In actual practice, you should sample at a rate much higher than two times the Nyquist limit to minimize sampling errors. For example, a 1kHz signal sampled at 2kHz has only two samples per cycle. If you sample precisely at the signal's highest and lowest points , you can measure its frequency and amplitude. However, in many systems, you have no guarantee where you are sampling. In the above example, if you sample at the zero crossings of the sin wave, the digitized result will appear to be a DC signal, so both the digitized frequency and amplitude information will be incorrect.
Ideally, you should set the sample rate at least five to 10 times the maximum signal frequency of interest and use a small lowpass analog RC input filter to prevent unwanted high-frequency energy from being measured.
Even if you don't explicitly include an RC filter, there is usually some series resistance between the signal source and the ADC, and some capacitance between the ADC input and ground. This forms an RC filter, but often the time constant is so small that it actually doesn't provide any helpful filtering. For example, with R = 100 ohms and C = 10pF, the time constant is 1 nanosecond, giving a -3dB cutoff frequency of 159MHz.
Frequency aliasing can be used in an advantageous manner. The effect is similar to tuning a superheterodyne radio receiver. If the spectrum of interest is at a high frequency (not including DC), then it may be possible to digitize the input signal with a significantly slower sample rate than the frequencies of interest. This technique is generally known as "undersampling."
BACK TO QUESTIONS
Why Does the ADC Disrupt the Signal It Is Measuring? Some A / D converters sample the input signal continuously, whereas others sample at specific times. Any A / D converter that uses a track / hold buffer must periodically connect its track / hold capacitor to the input signal, causing a small inrush current. The track / hold capacitor requires time to charge to the correct voltage. This is referred to as "charge injection."
This disruption is usually negligible, because the track / hold capacitor requires such a small charge current and because it quickly charges to the correct voltage. However, if the input impedance is large or the signal source responds slowly to minor disruptions, the system may not settle to the desired accuracy within the allocated sampling time.
This is how to determine whether or not your system is being disrupted by charge injection:
Connect the oscilloscope (channel 1) to the analog input of the A / D converter. Connect the oscilloscope (channel 2) to the conversion start or chip-select signal of the A / D converter. Make the A / D converter acquire data at a steady rate. Trigger the oscilloscope on channel 2. Check the A / D converter's input signal for voltage disruption. Consult the data sheet to determine when sampling begins. One way to solve this type of problem is to select an op-amp buffer that has sufficient settling time. How fast is "sufficient"? That depends on the accuracy your system requires.
Another solution is to increase the ADC's acquisition time (the time allowed to measure the signal). Some A / D converters, such as the MAX197, allow increased acquisition time. Extending the acquisition time enough to permit the input to settle improves the accuracy of the measurement.
BACK TO QUESTIONS
What Techniques Are Used for Digital Filtering? Using the fast-Fourier transform (FFT) is one of the most popular ways to convert a series of digital samples from the time domain to the frequency domain. The result of an FFT looks like the output of a spectrum analyzer. And, because the FFT works in both directions, you should be able to digitally filter a signal just by taking its FFT, modifying its spectrum directly, and converting it back to time-domain data.
The FFT assumes that the spectrum does not change over time. Furthermore, if the input signal is not synchronized to the A / D's sampling clock, the spectrum will become smeared, obscuring detail.
There are other digital-signal-processing (DSP) techniques that are more advantageous for filtering a real-world signal. The infinite-impulse-response (IIR) and finite-impulse-response (FIR) filters can be implemented very inexpensively, and they work on a continuous stream of data.
The wavelet transform is worth investigating. Like the FFT, it converts time-domain data into the frequency domain. However, unlike the FFT, the wavelet transform assumes that the frequency spectrum is changing over time. The result of a wavelet transform is a bit harder to read, but more meaningful.
References
Wavelets:
Introduction to Wavelets and Wavelet Transforms: A Primer
C. Sidney Burrus, Ramesh A. Gopinath, Haitao Guo
Prentice-Hall, 1998
ISBN 0-13-489600-9
Practical Implementation of FFT:
Numerical Recipes in Pascal: The Art of Scientific Computing
WH Press, BP Flannery, SA Tukolsky, WT Vetterling
Cambridge University Press, 1989
ISBN 0-521-37516-9
BACK TO QUESTIONS
When Should I Use a Balun? A balun is a transformer that converts an AC signal from balanced to unbalanced, or vice versa.
Some high-speed A / D converters work best on AC signals. The balun passes the AC part of the input signal, and it removes any DC offset that may be present.
BACK TO QUESTIONS
Applications This section explains how to implement A / D converter systems.
Can I Connect a Serial A / D to My Computer's Serial Port? The answer to this question is yes, but there are simpler ways to interface to a computer. To begin with, the computer's RS-232 port uses higher voltage levels that are incompatible with most ADC's TTL / CMOS logic.
Another problem is that the computer's RS-232 serial port is asynchronous, which places a few more requirements on the communication, including some additional handshaking control lines. Also, with the RS-232 serial port, you must set both ends of the link to the same baud rate. The A / D converter's serial port is synchronous; thus, its handshaking requirements are minimal and it only requires one wire for clock and one or two wires for data.
If you are truly determined, you can bit-bang using the RS-232 port's handshake lines. Refer to the application note PC Serial Port Drives 12-Bit A / D Converter.
BACK TO QUESTIONS
Can I Get a "Smart" ADC? There are several "smart" A / D controllers available:
The MAX7651 combines a microcontroller with a 12-bit A / D converter. The MAX1460 is a smart Sensor signal conditioner that implements a nonlinear compensation equation. BACK TO QUESTIONS
What Is the SPI Interface? SPI (serial peripheral interface) is an interface standard defined by Motorola on the MC68HCxx line of microcontrollers. A synchronous clock shifts serial data into and out of the microcontrollers in blocks of 8 bits.
Whenever two devices communicate, one is referred to as the "master" and the other as the "slave" device. The master drives the serial clock. When using SPI, data is simultaneously transmitted and received, making it a full-duplexed protocol.
The 68HC11 allows four configurations of SPI, which are designated by CPOL and CPHA:
When CPOL = 0, the clock idle state is low. When CPOL = 1, the clock idle state is high. When CPHA = 0, the first clock edge clocks data into and out of the microprocessor. If CPOL = CPHA, then the rising edge clocks data into and out of the microprocessor. When CPHA = 1, the second clock edge clocks data into and out of the microprocessor. If CPOL does not equal CPHA, then the falling edge clocks data into and out of the microprocessor. Motorola's names for the SPI signals are as follows: SCLK for serial clock, which is always driven by the master: MISO is master-in slave-out data: MOSI is master-out slave-in data. In a typical application, connect the microcontroller's SCLK to the converter's SCLK input, connect the MISO to the converter's DOUT pin, and connect the MOSI pin to the converter's DIN pin. If there is a chip-select signal, it can be driven by a spare microcontroller general-purpose output.
BACK TO QUESTIONS
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel? The simplest way to convert serial data (especially SPI interface data) to a parallel format is to use general-purpose microprocessor I / O pins to emulate the necessary serial -port timing and add the appropriate shift register to convert the data to the correct format. For a serial output ADC, use a serial-in / parallel-out shift register (such as the 74HC595 or equivalent) to convert the serial conversion data to a parallel format. For a DAC, use a parallel-in / serial-out shift register (such as the 74HC597 or equivalent) to convert the parallel DAC data to a serial output stream.
BACK TO QUESTIONS
How Can I Debug (or Probe) an SPI Interface? When debugging an SPI â„¢ interface, an SPI slave device circuit such as the one shown below can be useful. It uses shift registers to convert data to a parallel format that can be latched if necessary.
When driven by an SPI master, this circuit converts the SPI signals to steady outputs for easy probing.
BACK TO QUESTIONS
What Is Bit-Banging? Bit-banging is a method of using general-purpose I / O lines to emulate a serial port. Microcontrollers that include serial-port modules like SPI ™ and I²C ™ manage all synchronization and timing signals, and this activity is transparent to the user. With bit-banging, however, each write to the port causes a single transition at the port pin. And it's up to the user, first, to provide the correct number of transitions to obtain the desired waveform and, second, to ensure that the timing requirements (particularly setup and hold times for reading and writing data) are met. Due to the overhead associated with the number of writes to the port, though the actual port speed might be quite high the actual bit- bang throughput rate is usually very slow.
BACK TO QUESTIONS
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging? The following pseudo-code subroutine simultaneously reads and writes 8 bits through a synchronous serial interface. Some microprocessors offer specialized hardware that performs this job (such as Motorola's 68HC11 SPI and QSPI , and National Semiconductor's MICROWIRE). This outline describes a common substitute interface that is implemented by setting and clearing individual output pins.
Depending on the speed of the processor, delays may be required to satisfy the interface timing requirements.
Pin Definitions for Pseudo-Code Subroutine below
SCK: The serial clock input to the Maxim chip
DIN: The serial data input to the Maxim chip
DOUT: The serial data output from the Maxim chip
Pseudo-Code Subroutine
BACK TO QUESTIONS
What Is the MICROWIRE Interface? MICROWIRE is a serial interface standard defined by National Semiconductor. The MICROWIRE protocol is essentially a subset of the SPI â„¢ interface, namely CPOL = 0 and CPHA = 0 (see "What Is the SPI Interface?" Above) .
BACK TO QUESTIONS
What Is the I²C Interface? I²C is a 2-wire serial interface standard defined by Philips Semiconductor. The key advantage of this interface is that only two lines (clock and data) are required for full duplexed communication between multiple devices (in contrast, SPI ™ requires a minimum of three to four lines with a single device on the bus). The interface typically runs at a fairly low speed (100kHz to 400kHz). With I²C, each IC on the bus has a unique address. To begin communication, the bus master (typically a microcontroller) places the address of the device with which it intends to communicate (the slave) on the bus. All ICs monitor the bus to determine if the master device is sending their address. Only the device with the correct address communicates with the master.
Note that with other serial protocols such as SPI, a chip-select input is required to enable the IC. Thus, when 10 devices are on the bus, 10 chip-select lines, in addition to the shared clock and data lines, are needed to select the appropriate device. For I / O-constrained applications, this can present quite a challenge. In contrast, I²C requires only two control lines with 10 devices on the bus.
BACK TO QUESTIONS
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging? The following code reads and writes 8 bits using a 2-wire interface. Some microprocessors offer specialized hardware that performs this job (such as Philips Semiconductor's 8051 family). This outline describes a common substitute interface, implemented by setting and clearing individual output pins, also known as "bit-banging."
Depending on the microcontroller's speed, delays may be required to satisfy the interface timing requirements.
Pin Definitions for code below
SCL: 2-wire (I2C) clock
SDA: 2-wire (I2C) data
Code
BACK TO QUESTIONS
PC-Board Layout Guidelines This section includes PC-board layout guidelines as well as prototyping issues.
Do You Have Any General Circuit-Layout Tips? In the technical article Tech Tips: Getting the Most from Your Sensor and Conditioning Electronics, you'll find tips for good PC-board layout. Though this article is targeted for piezoresistive transducer (PRT) designs, the principles are general enough so that they are applicable to other circuits as well.
BACK TO QUESTIONS
Do You Have Any Circuit-Layout Tips for A / D Converters? Partition the system into analog, digital, and power-supply sections. Group the related components together. Draw a physical boundary between the analog and digital sections. The A / D converter should straddle the boundary between analog and digital. Nothing else should cross this boundary, except the A / D itself and a single, carefully selected power and ground return.
Digital traces should never cross analog traces. They should not even pass over analog ground. And they should be routed away from sensitive analog traces. When digital traces are near analog traces, even though there is no direct connection, the PC board's parasitic capacitance will couple high-frequency noise from any nearby switching signals into the analog signal. The faster the signal switches, the more it will interfere with analog signals. The proper handling of analog-versus-digital ground connections can have a significant impact on the overall system performance. For grounding issues, see "Do You Have Any Grounding / Ground Plane Tips?" below.
BACK TO QUESTIONS
Do You Have Any Grounding / Ground Plane Tips? It is recommended that a ground plane be used, especially for high-resolution or high-frequency applications, but deciding to use a ground plane or not depends mainly on your intent. If, for instance , you only want to determine the basic functionality of an IC, a simple proto-board may be adequate. However, if you are observing AC performance, expect the proto-board to provide less-than-optimal performance, and as frequency increases the performance can degrade drastically.
A ground plane is simply an area of ​​a PC board (an entire PC-board layer or a portion of it) that provides a low-impedance return path for current flow. As current flows, any resistance encountered will appear as an IR (voltage ) drop. Thus, if the ground plane has an appreciable resistance, the associated IR voltage drop will result in variations in the ground-plane potential. This in turn can have very adverse consequences, such as localized ground current loops and excessive current flow due to the mismatch in ground potentials.
Sensitive analog circuitry requires a quiet ground plane. In some cases, a circuit board may consist of separate analog and digital power-supply planes and separate analog and digital ground planes to isolate the digital noise from the analog circuitry. Other applications use a single supply, but partition the board as if separate analog and digital supplies were used. In this case, chokes, ferrite beads, and adequate bypassing provide a "clean" analog supply that is treated as separate from the digital supply.
The analog and digital ground planes reside on the same physical PC-board layer, but are set up so that the currents from the digital circuitry do not interact with the currents from the analog circuitry. This is done by physically separating analog and digital components and providing an imaginary division on the board such that the digital currents flow on the "digital" side and the analog currents flow on the "analog" side.
Mixed-signal components that are both analog and digital straddle the analog and digital ground planes. With these ICs, connect their analog and digital ground pins together at the chip using very short traces and connect this to a single point at the intersection of the analog and digital ground planes.
Digital signals such as those from microprocessors, ASICs, DSPs, and digital logic are very noisy due to the large transient current spikes as the logic levels change. In addition, switching power supplies, machinery (motors, actuators, etc.), and EMI are potential sources of noise that can couple into sensitive analog circuitry.
The key is to decouple (or isolate) the sensitive analog circuitry from these noise sources--that is, keep the digital noise confined to the digital ground plane. Because the digital ground current is comprised of a series of current spikes, chokes and inductors are used to filter these spikes and prevent them from coupling to the analog circuitry.
You can minimize noise by following these suggestions:
Connect analog and digital ground pins together at a single point near the IC. Connect the analog and digital ground planes together at a single point using a star ground connection. Keep signal and ground traces short. Long traces have more inductance and higher resistance. Do not route digital lines (especially clocks) near the analog ground plane. Use linear regulators instead of switching regulators. Provide a shield around sensitive analog circuits by placing a "ring" around the analog components. Connect this ring to analog ground. Separate parallel traces to minimize capacitive coupling. Do not run analog and digital traces parallel to each other, as there is inductive coupling between parallel traces. BACK TO QUESTIONS
Can the 0.1µF Bypass Capacitors Be Eliminated? The system won't function correctly without proper bypass capacitors. Bypass capacitors are required, because whenever the IC switches, it generates a transient current load on the power-supply and ground-return traces. In accordance with Ohm's law, the power-supply voltage to the chip drops, and the IC's ground pin is also raised above the system ground, due to these transient current effects. The transients are exacerbated by the typical series inductance of the power-supply traces, which cause magnetically induced voltages to oppose the change in current flow. This is a problem when the current begins spiking up, as well as when the current tries to return to its initial level.
A bypass capacitor located physically close to the IC solves this problem by canceling some of the power-supply lead inductance. Of course, the energy still has to flow from the power supply to the IC, but the bypass capacitor provides a small reservoir of energy to quickly satisfy the local surge, without causing significant overshoot or droop at the IC's power-supply pins.
As a rule of thumb, each IC should have a direct connection to a 0.1µF ceramic capacitor located no more than about 5mm away. This forms a loop where transient switching currents for that IC circulate. Don't mix unrelated loops. The route is from the IC, to the capacitor, to the power-supply busses.
In addition to the small ceramic capacitors, there should be some larger bulk capacitors located where the power-supply connections enter the PC-board assembly. The value should be between 10µF and 1000µF, depending on the system's needs. Remember to mind the voltage ratings. If the power supply is 5 volts, use at least a 10V-rated capacitor, or maybe even higher if the system is exposed to high temperature.
BACK TO QUESTIONS
How Can I Model Real-World Effects of Printed-Circuit Boards? A printed-circuit board adds some capacitance, resistance, and inductance to the circuit. These parasitic circuit elements can change with temperature, mechanical stress, and even age. If you are a fan of SPICE models, you can always add these parasitic elements to the circuit to check for sensitivity. But it's impossible to develop a rigorous model without verifying physical performance. You need to build a prototype.
Consider a typical four-layer FR4 dielectric PC board with 1-ounce copper plating and a net thickness of 0.0625 inches. The thickness of 1-ounce copper plating is 0.00139 inches. The distance between layers is 0.019 inches.
You can estimate the resistance of a PC-board trace based on its shape. Tile the trace with squares, and then multiply the foil sheet resistance by the number of squares. Standard 1-ounce copper foil has a thickness of 0.00139 inches, which corresponds to a sheet resistance of 0.49 milliohms per square. (This resistance varies ±25% over -40°C to +85°C.) So, a PC-board trace that is 0.010 inches wide and 1.000 inches long has a resistance of 100 squares, or approximately 0.05 ohms. If a switching transient of 500mA flowed through this trace (even for a microsecond), the voltage drop across it would be 25mV.
There is parasitic capacitance between adjacent traces on the same layer and between traces on adjacent layers as well. The common FR4 material has a relative dielectric between 4 and 5, although it is not usually controlled tightly. Often the parasitic capacitance is a few picofarads, but it can be higher if the board is dirty.
BACK TO QUESTIONS
Debugging and Diagnostics This section deals with diagnostic techniques that can help during the prototype stage.
Why Am I Not Getting the Specified Accuracy Out of My ADC? There are several potential sources of error, including the power supplies, open circuits, short circuits, poor layout, malfunctioning external components, and the actual device itself.
The quickest way to resolve the problem is to obtain an evaluation kit for the device. Maxim provides many ADC evaluation kits with user-friendly software that allows you to quickly exercise the IC and analyze its performance.
If this is not an option, first check your board for shorts and open circuits. Next, check the voltages on each pin of the IC. Use an oscilloscope rather than a DMM so that any noise or oscillations will be observed. Try a different component in the socket. Finally, check the external components; "bad" capacitors and resistors can cause circuit anomalies.
If the problem still persists, refer to the technical article The ABCs of ADCs to determine if the ADC's performance could be the culprit.
BACK TO QUESTIONS
Why Is the Output Code Stuck at All Ones? This could be due to the voltage reference not working properly. Check the reference voltage. Perhaps the reference input was inadvertently shorted to ground. Use a hand-held DVM to measure between the reference input and ground, right at the ADC's pins.
If the ADC has a shutdown pin, use an oscilloscope to verify that shutdown is not active. Some parts permit the shutdown pin to be left unconnected (floating); other parts require it to be driven high or low.
Use an oscilloscope to check the DOUT pin of the ADC, and see if the part is performing conversions. Perhaps there is a wire broken somewhere.
BACK TO QUESTIONS
Why Are the ADC Measurements Noisy? Finding the source of noise in ADC measurements is not always easy. The following suggestions hopefully will help you arrive at the source of the problem quickly.
Check the test hardware to make sure the test setup is not the source of the problem. Are the power supplies clean? Do they have adequate bypassing at the ADC power-supply pins? Has the circuit board been checked for shorts, proper pin configurations, short traces, an adequate low-noise ground, etc.? Is the reference voltage at the correct value? If an external reference is used, does it have low enough noise? Can it source adequate current? Is the circuit being tested in a relatively noise-free environment? If not, move to one, as noise tends to find its way into circuits through the power supplies, electromagnetic interference (EMI), lighting, and a host of other sources. Determine if the noise could be coming from the input-signal source, the analog front-end signal conditioning circuitry, or the ADC itself. Observe the signal source on a spectrum analyzer or an oscilloscope, and examine the output of the front-end circuitry in a similar manner. If an op amp is used on the front end, make sure its noise performance is acceptable for the performance desired. In addition, make sure it has adequate bandwidth at the frequencies of interest. Other things to check are the scope probes, the power supplies for excessive current flow, and the ADC's programmed state to make sure the correct programming information was written to the ADC. What's more, is the oscilloscope floating or is it powered by 50Hz/60Hz? This could have an effect on the noise performance. There also could be other signals getting into the ADC input. Is there a lowpass filter on the ADC input to remove high-frequency noise? Keep in mind that a logical, systematic approach will lead to the source of the noise much faster than a trial-and-error method.
BACK TO QUESTIONS
I've Noticed Noise from the MAX194/MAX195; How Do I Get Rid of It? The MAX194/MAX195's least-significant bit (LSB) size is slightly less than the RMS code-edge noise level. This means that the peak-to-peak noise is greater than an LSB. Thus, the LSB is actually in the noise of the converter. However, averaging can effectively reduce this noise. 'N' samples will reduce the noise by a factor of the square root of 'N'. For improved noise performance, consider using the MAX1132 for new designs.
Check the list of questions or the list of keywords below.
QuestionsIntroductory Questions
What Is an Analog-to-Digital Converter (ADC)?
What Is a Digital-to-Analog Converter (DAC)?
How Does an Algorithmic ADC Work?
How Does a Pipeline ADC Work?
How Does a Delta-Sigma (or Sigma-Delta) ADC Work?
How Does a Flash ADC Work?
How Does a Successive-Approximation-Register (SAR) ADC Work?
How Does a Dual-Slope Integrating ADC Work?
Intermediate Questions
What Is the Nyquist Limit?
Why Does the ADC Disrupt the Signal It Is Measuring?
What Techniques Are Used for Digital Filtering?
When Should I Use a Balun?
Applications
Can I Connect a Serial A / D to My Computer's Serial Port?
Can I Get a "Smart" ADC?
What Is the SPI Interface?
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
How Can I Debug (or Probe) an SPI Interface?
What Is Bit-Banging?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
What Is the MICROWIRE Interface?
What Is the I²C Interface?
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging?
PC-Board Layout Guidelines
Do You Have Any General Circuit-Layout Tips?
Do You Have Any Circuit-Layout Tips for A / D Converters?
Do You Have Any Grounding / Ground Plane Tips?
Can the 0.1µf Bypass Capacitors Be Eliminated?
How Can I Model Real-World Effects of Printed-Circuit Boards?
Debugging and Diagnostics
Why Am I Not Getting the Specified Accuracy Out of My ADC?
Why Is the Output Code Stuck at All Ones?
Why Are the ADC Measurements Noisy?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
Keywords A / D
What Is an Analog-to-Digital Converter (ADC)?
ADC
What Is an Analog-to-Digital Converter (ADC)?
Algorithmic
How Does an Algorithmic ADC Work?
Bit-Banging
What Is Bit-Banging?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging?
Capacitors
Can the 0.1µf Bypass Capacitors Be Eliminated?
Charge-Balancing
How Does a Successive-Approximation-Register (SAR) ADC Work?
COM
Can I Connect a Serial A / D to My Computer's Serial Port?
CPHA
What Is the SPI Interface?
CPOL
What Is the SPI Interface?
D / A
What Is a Digital-to-Analog Converter (DAC)?
DAC
What Is a Digital-to-Analog Converter (DAC)?
Delta Sigma
How Does a Delta-Sigma (or Sigma-Delta) ADC Work?
DSP
What Techniques Are Used for Digital Filtering?
Dual Slope
How Does a Dual-Slope Integrating ADC Work?
FFT
What Techniques Are Used for Digital Filtering?
FIR
What Techniques Are Used for Digital Filtering?
Flash
How Does a Flash ADC Work?
I²C
What Is the I²C Interface?
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging?
IIR
What Techniques Are Used for Digital Filtering?
Layout
Do You Have Any General Circuit-Layout Tips?
Do You Have Any Circuit-Layout Tips for A / D Converters?
Do You Have Any Grounding / Ground Plane Tips?
How Can I Model Real-World Effects of Printed-Circuit Boards?
MAX104
How Does a Flash ADC Work?
MAX1280
How Does a Successive-Approximation-Register (SAR) ADC Work?
MAX132
How Does a Dual-Slope Integrating ADC Work?
MAX1400
How Does a Sigma-Delta (or Delta-Sigma) ADC Work?
MAX1460
Can I Get a "Smart" ADC?
MAX194
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
MAX195
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
MAX7651
Can I Get a "Smart" ADC?
Microcontroller
Can I Get a "Smart" ADC?
MICROWIRE
What Is the MICROWIRE Interface?
MISO
What Is the SPI Interface?
Modeling
How Can I Model Real-World Effects of Printed-Circuit Boards?
Modulator
How Does a Sigma-Delta (or Delta-Sigma) ADC Work?
MOSI
What Is the SPI Interface?
Noise
Why Are the ADC Measurements Noisy?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
Parallel
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
Parasitic
How Can I Model Real-World Effects of Printed-Circuit Boards?
Pipeline
How Does a Pipeline ADC Work?
Production
Can the 0.1µf Bypass Capacitors Be Eliminated?
How Can I Model Real-World Effects of Printed-Circuit Boards?
Prototype
How Can I Model Real-World Effects of Printed-Circuit Boards?
RS-232
Can I Connect a Serial A / D to My Computer's Serial Port?
SAR
How Does a Successive-Approximation-Register (SAR) ADC Work?
SCLK
What Is the SPI Interface?
Serial
Can I Connect a Serial A / D to My Computer's Serial Port?
What Is the SPI Interface?
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
How Can I Debug (or Probe) an SPI Interface?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
What Is the MICROWIRE Interface?
What Is the I²C Interface?
Sigma Delta
How Does a Sigma-Delta (or Delta-Sigma) ADC Work?
"Smart" ADC
Can I Get a "Smart" ADC?
SPI
What Is The SPI Interface?
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel?
How Can I Debug (or Probe) an SPI Interface?
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging?
Successive Approximation Register
How Does A Successive-Approximation-Register (SAR) ADC Work?
Troubleshooting
How Can I Debug (or Probe) an SPI Interface?
Why Is the Output Code Stuck at All Ones?
Why Are the ADC Measurements Noisy?
I've Noticed Noise from the MAX194 / MAX195; How Do I Get Rid of It?
Wavelet
What Techniques Are Used for Digital Filtering?
Introductory Questions This section includes general introductory questions about A / D converters.
References
Data Converters:
Principles of Data Conversion System Design
Behzad Razavi
IEEE Press, 1995
ISBN 0-7803-1093-4
IEEE order number: PC4465
The Art of Electronics (2nd Edition)
Paul Horowitz, Winfield Hill
Cambridge University Press, 1989
ISBN 0-5213-7095-7
What Is an Analog-to-Digital Converter (ADC)? An analog-to-digital converter (also known as an ADC or an A / D converter) is an electronic circuit that measures a real-world signal (such as temperature, pressure , acceleration, and speed) and converts it to a digital representation of the signal.
It compares the analog input voltage to a known reference voltage and then produces a digital representation of this analog input. The output of an ADC is a digital binary code. By its nature, an ADC introduces a quantization error. This is simply the information that is lost, because for a continuous analog signal there are an infinite number of voltages but only a finite number of ADC digital codes. The more digital codes that the ADC can resolve, the more resolution it has and the less information lost to quantization error.
BACK TO QUESTIONS
What Is a Digital-to-Analog Converter (DAC)? A digital-to-analog converter (also known as a DAC or a D / A converter) is an electronic circuit that converts a digital representation of a quantity into a discrete analog value . The input to the DAC is typically a digital binary code, and this code, along with a known reference voltage, results in a voltage or current at the DAC output. The word "discrete" is very important to understand, because a DAC cannot provide a continuous time output signal; rather, it provides analog "steps." The steps can be lowpass-filtered to obtain a continuous signal. By increasing the resolution of the DAC, the number of discrete steps is increased and the step size is reduced (which reduces the quantization error), resulting in a signal that closer approximates a continuous time signal.
BACK TO QUESTIONS
How Does an Algorithmic ADC Work? An application note covering this topic is presently being developed.
BACK TO QUESTIONS
How Does a Pipeline ADC Work? Refer to the application note Understanding Pipelined ADCs.
BACK TO QUESTIONS
How Does a Sigma-Delta (or Delta-Sigma) ADC Work? An application note covering this topic is presently being developed.
BACK TO QUESTIONS
How Does a Flash ADC Work? A flash ADC is also called a "parallel encoder." The key advantage of this architecture is very fast conversion times. The key disadvantage is high power consumption. A flash ADC is suitable for very-high-speed , low-resolution applications. This architecture becomes prohibitively expensive for higher resolutions. The MAX104 is an example of a flash ADC.
Refer to the application note Understanding Flash ADCs.
For additional information, refer to The Art of Electronics.
BACK TO QUESTIONS
How Does a Successive-Approximation-Register (SAR) ADC Work? Refer to the application note Understanding SAR ADCs.
For additional information, refer to The Art of Electronics or to the Motorola M68HC11 Reference Manual (Chapter 12), a microcontroller reference manual from Motorola.
BACK TO QUESTIONS
How Does a Dual-Slope Integrating ADC Work? A dual-slope integrating ADC is best suited for low-speed applications where good power-supply rejection is desired. The MAX132 is an example of a dual-slope ADC.
An application note specifically covering this topic is presently being developed.
For additional information, refer to The Art of Electronics.
BACK TO QUESTIONS
Intermediate Questions This section covers more involved A / D converter issues.
What Is the Nyquist Limit? The Nyquist limit is defined as half of the sampling frequency. The Nyquist limit sets the highest frequency that the system can sample without frequency aliasing. In a sampled data system, when the input signal of interest is sampled at a rate slower than the Nyquist limit (fIN> 0.5fSAMPLE), the signal is effectively "folded back" into the Nyquist band, thus appearing to be at a lower frequency than it actually is. This unwanted signal is indistinguishable from other signals in the desired frequency band (fSAMPLE / 2).
For example, if your system samples the ADC at 2.048kHz, the Nyquist limit for that system is 1.024kHz. If we applied an input signal at 2.56kHz, due to frequency aliasing, the input signal is indistinguishable from a 0.512kHz signal (2.56 kHz-2.048kHz). No amount of clever digital signal processing can put back the information lost as a result of frequency aliasing. The only way to know what you have sampled is to physically restrict the input bandwidth prior to sampling.
In actual practice, you should sample at a rate much higher than two times the Nyquist limit to minimize sampling errors. For example, a 1kHz signal sampled at 2kHz has only two samples per cycle. If you sample precisely at the signal's highest and lowest points , you can measure its frequency and amplitude. However, in many systems, you have no guarantee where you are sampling. In the above example, if you sample at the zero crossings of the sin wave, the digitized result will appear to be a DC signal, so both the digitized frequency and amplitude information will be incorrect.
Ideally, you should set the sample rate at least five to 10 times the maximum signal frequency of interest and use a small lowpass analog RC input filter to prevent unwanted high-frequency energy from being measured.
Even if you don't explicitly include an RC filter, there is usually some series resistance between the signal source and the ADC, and some capacitance between the ADC input and ground. This forms an RC filter, but often the time constant is so small that it actually doesn't provide any helpful filtering. For example, with R = 100 ohms and C = 10pF, the time constant is 1 nanosecond, giving a -3dB cutoff frequency of 159MHz.
Frequency aliasing can be used in an advantageous manner. The effect is similar to tuning a superheterodyne radio receiver. If the spectrum of interest is at a high frequency (not including DC), then it may be possible to digitize the input signal with a significantly slower sample rate than the frequencies of interest. This technique is generally known as "undersampling."
BACK TO QUESTIONS
Why Does the ADC Disrupt the Signal It Is Measuring? Some A / D converters sample the input signal continuously, whereas others sample at specific times. Any A / D converter that uses a track / hold buffer must periodically connect its track / hold capacitor to the input signal, causing a small inrush current. The track / hold capacitor requires time to charge to the correct voltage. This is referred to as "charge injection."
This disruption is usually negligible, because the track / hold capacitor requires such a small charge current and because it quickly charges to the correct voltage. However, if the input impedance is large or the signal source responds slowly to minor disruptions, the system may not settle to the desired accuracy within the allocated sampling time.
This is how to determine whether or not your system is being disrupted by charge injection:
Connect the oscilloscope (channel 1) to the analog input of the A / D converter. Connect the oscilloscope (channel 2) to the conversion start or chip-select signal of the A / D converter. Make the A / D converter acquire data at a steady rate. Trigger the oscilloscope on channel 2. Check the A / D converter's input signal for voltage disruption. Consult the data sheet to determine when sampling begins. One way to solve this type of problem is to select an op-amp buffer that has sufficient settling time. How fast is "sufficient"? That depends on the accuracy your system requires.
Another solution is to increase the ADC's acquisition time (the time allowed to measure the signal). Some A / D converters, such as the MAX197, allow increased acquisition time. Extending the acquisition time enough to permit the input to settle improves the accuracy of the measurement.
BACK TO QUESTIONS
What Techniques Are Used for Digital Filtering? Using the fast-Fourier transform (FFT) is one of the most popular ways to convert a series of digital samples from the time domain to the frequency domain. The result of an FFT looks like the output of a spectrum analyzer. And, because the FFT works in both directions, you should be able to digitally filter a signal just by taking its FFT, modifying its spectrum directly, and converting it back to time-domain data.
The FFT assumes that the spectrum does not change over time. Furthermore, if the input signal is not synchronized to the A / D's sampling clock, the spectrum will become smeared, obscuring detail.
There are other digital-signal-processing (DSP) techniques that are more advantageous for filtering a real-world signal. The infinite-impulse-response (IIR) and finite-impulse-response (FIR) filters can be implemented very inexpensively, and they work on a continuous stream of data.
The wavelet transform is worth investigating. Like the FFT, it converts time-domain data into the frequency domain. However, unlike the FFT, the wavelet transform assumes that the frequency spectrum is changing over time. The result of a wavelet transform is a bit harder to read, but more meaningful.
References
Wavelets:
Introduction to Wavelets and Wavelet Transforms: A Primer
C. Sidney Burrus, Ramesh A. Gopinath, Haitao Guo
Prentice-Hall, 1998
ISBN 0-13-489600-9
Practical Implementation of FFT:
Numerical Recipes in Pascal: The Art of Scientific Computing
WH Press, BP Flannery, SA Tukolsky, WT Vetterling
Cambridge University Press, 1989
ISBN 0-521-37516-9
BACK TO QUESTIONS
When Should I Use a Balun? A balun is a transformer that converts an AC signal from balanced to unbalanced, or vice versa.
Some high-speed A / D converters work best on AC signals. The balun passes the AC part of the input signal, and it removes any DC offset that may be present.
BACK TO QUESTIONS
Applications This section explains how to implement A / D converter systems.
Can I Connect a Serial A / D to My Computer's Serial Port? The answer to this question is yes, but there are simpler ways to interface to a computer. To begin with, the computer's RS-232 port uses higher voltage levels that are incompatible with most ADC's TTL / CMOS logic.
Another problem is that the computer's RS-232 serial port is asynchronous, which places a few more requirements on the communication, including some additional handshaking control lines. Also, with the RS-232 serial port, you must set both ends of the link to the same baud rate. The A / D converter's serial port is synchronous; thus, its handshaking requirements are minimal and it only requires one wire for clock and one or two wires for data.
If you are truly determined, you can bit-bang using the RS-232 port's handshake lines. Refer to the application note PC Serial Port Drives 12-Bit A / D Converter.
BACK TO QUESTIONS
Can I Get a "Smart" ADC? There are several "smart" A / D controllers available:
The MAX7651 combines a microcontroller with a 12-bit A / D converter. The MAX1460 is a smart Sensor signal conditioner that implements a nonlinear compensation equation. BACK TO QUESTIONS
What Is the SPI Interface? SPI (serial peripheral interface) is an interface standard defined by Motorola on the MC68HCxx line of microcontrollers. A synchronous clock shifts serial data into and out of the microcontrollers in blocks of 8 bits.
Whenever two devices communicate, one is referred to as the "master" and the other as the "slave" device. The master drives the serial clock. When using SPI, data is simultaneously transmitted and received, making it a full-duplexed protocol.
The 68HC11 allows four configurations of SPI, which are designated by CPOL and CPHA:
When CPOL = 0, the clock idle state is low. When CPOL = 1, the clock idle state is high. When CPHA = 0, the first clock edge clocks data into and out of the microprocessor. If CPOL = CPHA, then the rising edge clocks data into and out of the microprocessor. When CPHA = 1, the second clock edge clocks data into and out of the microprocessor. If CPOL does not equal CPHA, then the falling edge clocks data into and out of the microprocessor. Motorola's names for the SPI signals are as follows: SCLK for serial clock, which is always driven by the master: MISO is master-in slave-out data: MOSI is master-out slave-in data. In a typical application, connect the microcontroller's SCLK to the converter's SCLK input, connect the MISO to the converter's DOUT pin, and connect the MOSI pin to the converter's DIN pin. If there is a chip-select signal, it can be driven by a spare microcontroller general-purpose output.
BACK TO QUESTIONS
My Microcontroller Has No SPI Interface; Is There a Circuit to Convert SPI to Parallel? The simplest way to convert serial data (especially SPI interface data) to a parallel format is to use general-purpose microprocessor I / O pins to emulate the necessary serial -port timing and add the appropriate shift register to convert the data to the correct format. For a serial output ADC, use a serial-in / parallel-out shift register (such as the 74HC595 or equivalent) to convert the serial conversion data to a parallel format. For a DAC, use a parallel-in / serial-out shift register (such as the 74HC597 or equivalent) to convert the parallel DAC data to a serial output stream.
BACK TO QUESTIONS
How Can I Debug (or Probe) an SPI Interface? When debugging an SPI â„¢ interface, an SPI slave device circuit such as the one shown below can be useful. It uses shift registers to convert data to a parallel format that can be latched if necessary.
When driven by an SPI master, this circuit converts the SPI signals to steady outputs for easy probing.
BACK TO QUESTIONS
What Is Bit-Banging? Bit-banging is a method of using general-purpose I / O lines to emulate a serial port. Microcontrollers that include serial-port modules like SPI ™ and I²C ™ manage all synchronization and timing signals, and this activity is transparent to the user. With bit-banging, however, each write to the port causes a single transition at the port pin. And it's up to the user, first, to provide the correct number of transitions to obtain the desired waveform and, second, to ensure that the timing requirements (particularly setup and hold times for reading and writing data) are met. Due to the overhead associated with the number of writes to the port, though the actual port speed might be quite high the actual bit- bang throughput rate is usually very slow.
BACK TO QUESTIONS
My Microcontroller Has No SPI Interface, So Can I Use Bit-Banging? The following pseudo-code subroutine simultaneously reads and writes 8 bits through a synchronous serial interface. Some microprocessors offer specialized hardware that performs this job (such as Motorola's 68HC11 SPI and QSPI , and National Semiconductor's MICROWIRE). This outline describes a common substitute interface that is implemented by setting and clearing individual output pins.
Depending on the speed of the processor, delays may be required to satisfy the interface timing requirements.
Pin Definitions for Pseudo-Code Subroutine below
SCK: The serial clock input to the Maxim chip
DIN: The serial data input to the Maxim chip
DOUT: The serial data output from the Maxim chip
Pseudo-Code Subroutine
int read_write_synchronous_serial (int write_value) | |
{ |
read_value = 0 / * read_value will accumulate the input value * / | |
drive SCK pin low | |
for (count = 0 to 7) / * process each of the eight bits * / | |
{ |
read_value = read_value * 2 / * shift input value left * / | ||
if (write_value bit 7 is 1) / * write the data, MSB first * / |
then drive din pin high | |
else drive din pin low |
/ * delay here to satisfy data setup time and minimum clock low time * / | |
drive SCK pin high / * clock rising edge happens here * / | |
if (DOUT pin is high) / * sample the received data, LSB last * / |
then read_value = read_value + 1 |
/ * delay here to satisfy data hold time and minimum clock high time * / | |
drive SCK pin low / * clock falling edge happens here * / | |
write_value = write_value * 2 / * shift output value left * / |
} | |
return read_value |
} |
What Is the MICROWIRE Interface? MICROWIRE is a serial interface standard defined by National Semiconductor. The MICROWIRE protocol is essentially a subset of the SPI â„¢ interface, namely CPOL = 0 and CPHA = 0 (see "What Is the SPI Interface?" Above) .
BACK TO QUESTIONS
What Is the I²C Interface? I²C is a 2-wire serial interface standard defined by Philips Semiconductor. The key advantage of this interface is that only two lines (clock and data) are required for full duplexed communication between multiple devices (in contrast, SPI ™ requires a minimum of three to four lines with a single device on the bus). The interface typically runs at a fairly low speed (100kHz to 400kHz). With I²C, each IC on the bus has a unique address. To begin communication, the bus master (typically a microcontroller) places the address of the device with which it intends to communicate (the slave) on the bus. All ICs monitor the bus to determine if the master device is sending their address. Only the device with the correct address communicates with the master.
Note that with other serial protocols such as SPI, a chip-select input is required to enable the IC. Thus, when 10 devices are on the bus, 10 chip-select lines, in addition to the shared clock and data lines, are needed to select the appropriate device. For I / O-constrained applications, this can present quite a challenge. In contrast, I²C requires only two control lines with 10 devices on the bus.
BACK TO QUESTIONS
My Microcontroller Has No I²C Interface, So Can I Use Bit-Banging? The following code reads and writes 8 bits using a 2-wire interface. Some microprocessors offer specialized hardware that performs this job (such as Philips Semiconductor's 8051 family). This outline describes a common substitute interface, implemented by setting and clearing individual output pins, also known as "bit-banging."
Depending on the microcontroller's speed, delays may be required to satisfy the interface timing requirements.
Pin Definitions for code below
SCL: 2-wire (I2C) clock
SDA: 2-wire (I2C) data
Code
// ------------------------------------------------ --------------------------- |
// Define the physical interface hardware. |
// The __int8 type represents an 8-bit integer. |
// Note: True I²C requires open-collector drivers. |
// If you are using open-collector gates (such as 74HC05), inversion may be required. |
// The physical interface shown here does not invert incoming or outgoing data. |
// Assert SCL to a LOW level. |
void AssertSCL (void) {Write_Pin (1,0);} |
// Release SCL to be pulled to a HIGH level. |
void ReleaseSCL (void) {Write_Pin (1,1);} |
// Get the SCL level: Return 0 if SCL is LOW, return 1 if SCL is HIGH. |
int GetSCL (void) {return Read_Pin (1);} |
// Assert SDA to a LOW level. |
void AssertSDA (void) {Write_Pin (2,0);} |
// Release SDA to be pulled to a HIGH level. |
void ReleaseSDA (void) {Write_Pin (2,1);} |
// Get the SDA level: Return 0 if SCL is LOW, return 1 if SCL is HIGH. |
int GetSDA (void) {return Read_Pin (2);} |
// ------------------------------------------------ --------------------------- |
// Make sure that the clock actually goes high. |
// Some other slave device may be stretching the clock. |
bool Make_Sure_SCL_is_High (void) |
{ |
if (GetSCL ()! = 0) |
return true; | // Success: Clock is high. |
while (GetSCL ()! = 1) | |
{ |
// Wait until clock goes high. | |
// A practical implementation should include a timeout handler. |
} | ||
return true; | // Success |
} |
// ------------------------------------------------ --------------------------- |
// TwoWireMasterStart: |
// Send a start condition on the bus. |
bool TwoWireMasterStart (void) |
{ |
ReleaseSDA (); | |
ReleaseSCL (); | |
Delay40usec (); | |
Make_Sure_SCL_is_High (); | |
AssertSDA (); | |
Delay47usec (); | |
AssertSCL (); | |
return true; |
} |
// ------------------------------------------------ --------------------------- |
// TwoWireMasterStop: |
// Send a stop condition, releasing the bus. |
bool TwoWireMasterStop (void) |
{ |
AssertSCL (); | |||
AssertSDA (); | |||
Delay47usec (); | // Minimum clock low time | ||
ReleaseSCL (); | |||
Delay40usec (); | |||
Make_Sure_SCL_is_High (); | |||
ReleaseSDA (); | |||
Delay47usec (); | |||
return true; |
// ------------------------------------------------ --------------------------- | |
// TwoWireMasterWrite: | |
// Transmit 8 bits on the SM bus, and check for an acknowledge. | |
// | |
// On Entry: | |
// | Byte = the 8 bit value to transmit |
// | A start condition must have been previously established. |
// | |
// On Exit: | |
// | Return value = 0 if the byte was not acknowledged (NACK) |
// | Return value = 1 if the byte was acknowledged (ACK) |
bool TwoWireMasterWrite (const __int8 byte) | |
{ |
__int8 temp = byte; | |
for (int i = 1; i <= 8; i = i + 1) | |
{ |
AssertSCL (); | ||
if (temp & 0x80) | ||
ReleaseSDA (); | ||
else | ||
AssertSDA (); | ||
temp = temp + temp; // shift left | ||
Delay47usec (); | ||
ReleaseSCL (); | ||
Delay40usec (); | ||
Make_Sure_SCL_is_High (); |
} |
// ------------------------------------------------ --------------------------- |
// RxSMBusByte: |
// |
// Read 8 bits from the SM bus. |
// ACK / NACK is handled separately by RxSMBusByteACK / RxSMBusByteNACK. |
// This function is called by both TwoWireMasterReadContinued and TwoWireMasterReadLast. |
// |
// On Entry: |
// A start condition must have been previously established, |
// and a slave must have been addressed in master read mode. |
// |
// On Exit: |
// Return value = byte read from the bus |
__int8 RxSMBusByte (void) |
{ |
__int8 byte = 0; | |
ReleaseSDA (); | |
for (int i = 1; i <= 8; i = i + 1) | |
{ |
AssertSCL (); | // Pull SCL low so that data can change. | ||
Delay47usec (); | // Allow SDA time to change. | ||
ReleaseSCL (); | // Clock edge | ||
Delay40usec (); | // SDA should be steady while SCL is high. | ||
Make_Sure_SCL_is_High (); | |||
byte = byte + byte; | // MSB first, LSB last. | ||
if (GetSDA ()) | |||
byte = byte + 1; | // Set the LSB. |
{ | |
return byte; |
{ |
// ------------------------------------------------ --------------------------- |
// Call this function to read a byte, when you plan to read some more bytes. |
__int8 TwoWireMasterReadContinued (void) |
{ |
__int8 data = RxSMBusByte (); | ||
AssertSCL (); | // Pull SCL low so that data can change. | |
AssertSDA (); | // Send ACK to slave. | |
Delay47usec (); | // Setup time | |
ReleaseSCL (); | // Clock the ACK pulse into the slave. | |
Delay47usec (); | // Hold time | |
Make_Sure_SCL_is_High (); | ||
AssertSCL (); | ||
return data; |
{ |
// ------------------------------------------------ --------------------------- |
// Call this function to read the last byte of data. |
__int8 TwoWireMasterReadLast (void) |
{ |
__int8 data = RxSMBusByte (); | ||
AssertSCL (); | // Pull SCL low so that data can change. | |
ReleaseSDA (); | // Send NACK to slave. | |
Delay47usec (); | // Setup time | |
ReleaseSCL (); | // Clock the ACK pulse into the slave. | |
Delay47usec (); | // Hold time | |
Make_Sure_SCL_is_High (); | ||
AssertSCL (); | ||
return data; |
{ |
PC-Board Layout Guidelines This section includes PC-board layout guidelines as well as prototyping issues.
Do You Have Any General Circuit-Layout Tips? In the technical article Tech Tips: Getting the Most from Your Sensor and Conditioning Electronics, you'll find tips for good PC-board layout. Though this article is targeted for piezoresistive transducer (PRT) designs, the principles are general enough so that they are applicable to other circuits as well.
BACK TO QUESTIONS
Do You Have Any Circuit-Layout Tips for A / D Converters? Partition the system into analog, digital, and power-supply sections. Group the related components together. Draw a physical boundary between the analog and digital sections. The A / D converter should straddle the boundary between analog and digital. Nothing else should cross this boundary, except the A / D itself and a single, carefully selected power and ground return.
Digital traces should never cross analog traces. They should not even pass over analog ground. And they should be routed away from sensitive analog traces. When digital traces are near analog traces, even though there is no direct connection, the PC board's parasitic capacitance will couple high-frequency noise from any nearby switching signals into the analog signal. The faster the signal switches, the more it will interfere with analog signals. The proper handling of analog-versus-digital ground connections can have a significant impact on the overall system performance. For grounding issues, see "Do You Have Any Grounding / Ground Plane Tips?" below.
BACK TO QUESTIONS
Do You Have Any Grounding / Ground Plane Tips? It is recommended that a ground plane be used, especially for high-resolution or high-frequency applications, but deciding to use a ground plane or not depends mainly on your intent. If, for instance , you only want to determine the basic functionality of an IC, a simple proto-board may be adequate. However, if you are observing AC performance, expect the proto-board to provide less-than-optimal performance, and as frequency increases the performance can degrade drastically.
A ground plane is simply an area of ​​a PC board (an entire PC-board layer or a portion of it) that provides a low-impedance return path for current flow. As current flows, any resistance encountered will appear as an IR (voltage ) drop. Thus, if the ground plane has an appreciable resistance, the associated IR voltage drop will result in variations in the ground-plane potential. This in turn can have very adverse consequences, such as localized ground current loops and excessive current flow due to the mismatch in ground potentials.
Sensitive analog circuitry requires a quiet ground plane. In some cases, a circuit board may consist of separate analog and digital power-supply planes and separate analog and digital ground planes to isolate the digital noise from the analog circuitry. Other applications use a single supply, but partition the board as if separate analog and digital supplies were used. In this case, chokes, ferrite beads, and adequate bypassing provide a "clean" analog supply that is treated as separate from the digital supply.
The analog and digital ground planes reside on the same physical PC-board layer, but are set up so that the currents from the digital circuitry do not interact with the currents from the analog circuitry. This is done by physically separating analog and digital components and providing an imaginary division on the board such that the digital currents flow on the "digital" side and the analog currents flow on the "analog" side.
Mixed-signal components that are both analog and digital straddle the analog and digital ground planes. With these ICs, connect their analog and digital ground pins together at the chip using very short traces and connect this to a single point at the intersection of the analog and digital ground planes.
Digital signals such as those from microprocessors, ASICs, DSPs, and digital logic are very noisy due to the large transient current spikes as the logic levels change. In addition, switching power supplies, machinery (motors, actuators, etc.), and EMI are potential sources of noise that can couple into sensitive analog circuitry.
The key is to decouple (or isolate) the sensitive analog circuitry from these noise sources--that is, keep the digital noise confined to the digital ground plane. Because the digital ground current is comprised of a series of current spikes, chokes and inductors are used to filter these spikes and prevent them from coupling to the analog circuitry.
You can minimize noise by following these suggestions:
Connect analog and digital ground pins together at a single point near the IC. Connect the analog and digital ground planes together at a single point using a star ground connection. Keep signal and ground traces short. Long traces have more inductance and higher resistance. Do not route digital lines (especially clocks) near the analog ground plane. Use linear regulators instead of switching regulators. Provide a shield around sensitive analog circuits by placing a "ring" around the analog components. Connect this ring to analog ground. Separate parallel traces to minimize capacitive coupling. Do not run analog and digital traces parallel to each other, as there is inductive coupling between parallel traces. BACK TO QUESTIONS
Can the 0.1µF Bypass Capacitors Be Eliminated? The system won't function correctly without proper bypass capacitors. Bypass capacitors are required, because whenever the IC switches, it generates a transient current load on the power-supply and ground-return traces. In accordance with Ohm's law, the power-supply voltage to the chip drops, and the IC's ground pin is also raised above the system ground, due to these transient current effects. The transients are exacerbated by the typical series inductance of the power-supply traces, which cause magnetically induced voltages to oppose the change in current flow. This is a problem when the current begins spiking up, as well as when the current tries to return to its initial level.
A bypass capacitor located physically close to the IC solves this problem by canceling some of the power-supply lead inductance. Of course, the energy still has to flow from the power supply to the IC, but the bypass capacitor provides a small reservoir of energy to quickly satisfy the local surge, without causing significant overshoot or droop at the IC's power-supply pins.
As a rule of thumb, each IC should have a direct connection to a 0.1µF ceramic capacitor located no more than about 5mm away. This forms a loop where transient switching currents for that IC circulate. Don't mix unrelated loops. The route is from the IC, to the capacitor, to the power-supply busses.
In addition to the small ceramic capacitors, there should be some larger bulk capacitors located where the power-supply connections enter the PC-board assembly. The value should be between 10µF and 1000µF, depending on the system's needs. Remember to mind the voltage ratings. If the power supply is 5 volts, use at least a 10V-rated capacitor, or maybe even higher if the system is exposed to high temperature.
BACK TO QUESTIONS
How Can I Model Real-World Effects of Printed-Circuit Boards? A printed-circuit board adds some capacitance, resistance, and inductance to the circuit. These parasitic circuit elements can change with temperature, mechanical stress, and even age. If you are a fan of SPICE models, you can always add these parasitic elements to the circuit to check for sensitivity. But it's impossible to develop a rigorous model without verifying physical performance. You need to build a prototype.
Consider a typical four-layer FR4 dielectric PC board with 1-ounce copper plating and a net thickness of 0.0625 inches. The thickness of 1-ounce copper plating is 0.00139 inches. The distance between layers is 0.019 inches.
You can estimate the resistance of a PC-board trace based on its shape. Tile the trace with squares, and then multiply the foil sheet resistance by the number of squares. Standard 1-ounce copper foil has a thickness of 0.00139 inches, which corresponds to a sheet resistance of 0.49 milliohms per square. (This resistance varies ±25% over -40°C to +85°C.) So, a PC-board trace that is 0.010 inches wide and 1.000 inches long has a resistance of 100 squares, or approximately 0.05 ohms. If a switching transient of 500mA flowed through this trace (even for a microsecond), the voltage drop across it would be 25mV.
There is parasitic capacitance between adjacent traces on the same layer and between traces on adjacent layers as well. The common FR4 material has a relative dielectric between 4 and 5, although it is not usually controlled tightly. Often the parasitic capacitance is a few picofarads, but it can be higher if the board is dirty.
BACK TO QUESTIONS
Debugging and Diagnostics This section deals with diagnostic techniques that can help during the prototype stage.
Why Am I Not Getting the Specified Accuracy Out of My ADC? There are several potential sources of error, including the power supplies, open circuits, short circuits, poor layout, malfunctioning external components, and the actual device itself.
The quickest way to resolve the problem is to obtain an evaluation kit for the device. Maxim provides many ADC evaluation kits with user-friendly software that allows you to quickly exercise the IC and analyze its performance.
If this is not an option, first check your board for shorts and open circuits. Next, check the voltages on each pin of the IC. Use an oscilloscope rather than a DMM so that any noise or oscillations will be observed. Try a different component in the socket. Finally, check the external components; "bad" capacitors and resistors can cause circuit anomalies.
If the problem still persists, refer to the technical article The ABCs of ADCs to determine if the ADC's performance could be the culprit.
BACK TO QUESTIONS
Why Is the Output Code Stuck at All Ones? This could be due to the voltage reference not working properly. Check the reference voltage. Perhaps the reference input was inadvertently shorted to ground. Use a hand-held DVM to measure between the reference input and ground, right at the ADC's pins.
If the ADC has a shutdown pin, use an oscilloscope to verify that shutdown is not active. Some parts permit the shutdown pin to be left unconnected (floating); other parts require it to be driven high or low.
Use an oscilloscope to check the DOUT pin of the ADC, and see if the part is performing conversions. Perhaps there is a wire broken somewhere.
BACK TO QUESTIONS
Why Are the ADC Measurements Noisy? Finding the source of noise in ADC measurements is not always easy. The following suggestions hopefully will help you arrive at the source of the problem quickly.
Check the test hardware to make sure the test setup is not the source of the problem. Are the power supplies clean? Do they have adequate bypassing at the ADC power-supply pins? Has the circuit board been checked for shorts, proper pin configurations, short traces, an adequate low-noise ground, etc.? Is the reference voltage at the correct value? If an external reference is used, does it have low enough noise? Can it source adequate current? Is the circuit being tested in a relatively noise-free environment? If not, move to one, as noise tends to find its way into circuits through the power supplies, electromagnetic interference (EMI), lighting, and a host of other sources. Determine if the noise could be coming from the input-signal source, the analog front-end signal conditioning circuitry, or the ADC itself. Observe the signal source on a spectrum analyzer or an oscilloscope, and examine the output of the front-end circuitry in a similar manner. If an op amp is used on the front end, make sure its noise performance is acceptable for the performance desired. In addition, make sure it has adequate bandwidth at the frequencies of interest. Other things to check are the scope probes, the power supplies for excessive current flow, and the ADC's programmed state to make sure the correct programming information was written to the ADC. What's more, is the oscilloscope floating or is it powered by 50Hz/60Hz? This could have an effect on the noise performance. There also could be other signals getting into the ADC input. Is there a lowpass filter on the ADC input to remove high-frequency noise? Keep in mind that a logical, systematic approach will lead to the source of the noise much faster than a trial-and-error method.
BACK TO QUESTIONS
I've Noticed Noise from the MAX194/MAX195; How Do I Get Rid of It? The MAX194/MAX195's least-significant bit (LSB) size is slightly less than the RMS code-edge noise level. This means that the peak-to-peak noise is greater than an LSB. Thus, the LSB is actually in the noise of the converter. However, averaging can effectively reduce this noise. 'N' samples will reduce the noise by a factor of the square root of 'N'. For improved noise performance, consider using the MAX1132 for new designs.
CCTV Baluns,Video Balun Transceiver Transmitter,Passive Video Balun,HD CCTV Video Balun
Chinasky Electronics Co., Ltd. , https://www.chinaskyswitches.com