Analog signals here refer to voltage and current signals, and the processing technologies of analog signals mainly include analog gating, analog amplification, signal filtering, current-voltage conversion, V/F conversion, A/D conversion and so on.
1. Analog Channel Gating
Single chip microcomputer measurement and control system sometimes needs to collect and control multi-channels and multi-parameters. If each channel adopts its own input loop, that is, each channel adopts amplification, filtering, sampling/holding, A/D and other links, not only the cost will be doubled compared with that of a single channel, but also the system will be huge, and the calibration of the system will be very difficult due to the inconsistent parameter characteristics of analog devices and resistance-capacitance components. Moreover, it is almost impossible to use a single loop for multi-channel inspection such as 128 signal acquisition. Therefore, in addition to using multi-channel independent amplification and A/D under special circumstances, ordinary sample/hold and A/D conversion circuits (sometimes even partial amplification circuits can be used) are usually used, and multi-channel analog switches can be conveniently used.
When selecting multi-channel analog switches, the following points need to be considered:
(1) number of channels
The number of channels directly affects the accuracy and switching speed of the switch to transmit the measured signal, because the more channels, the greater the parasitic capacitance and leakage current. When one of the commonly used analog switches is turned on, the other paths are not really disconnected, but in a high resistance state, and there is still leakage current, which affects the ON signal. The more channels, the greater the leakage current and the more interference between channels.
(2) Leakage current
When designing the circuit, the smaller the leakage current, the better. During the acquisition process, the signal itself is very weak. If the internal resistance of the signal source is large, the leakage current will have a great influence on the accuracy.
(3) Switching speed
When selecting analog switches, the sampling rate and A/D conversion rate of each signal should be considered comprehensively, because they determine the requirements for the switching speed of analog switches.
(4) Switch resistance
The ideal multi-way switch has zero on-resistance and infinite off-resistance, but the actual analog switch cannot meet this requirement, so the switch resistance should be considered, especially when the load connected in series with the switch is low impedance, the multi-way switch with low on-resistance should be selected.
(5) Driftiness of parameters and consistency of resistance.
(6) Packaging of equipment
Commonly used analog switches are in DIP and SO packages, which can be selected according to actual needs.
2. Signal filtering
Due to various noise interferences in the transmission process, electromagnetic interference in the work site and the influence of the front-end circuit itself, the electrical signals obtained from sensors or other receiving devices often contain noise signals with various frequency components. In severe cases, this kind of noise signal will even drown out the effective input signal, resulting in the failure of normal test. In order to reduce the influence of noise signal on the measurement and control process, filtering measures are needed to filter out interference noise and improve the signal-to-noise ratio of the system.
In the past, analog filtering circuits were often used to realize filtering, and the technology of analog filtering has been relatively mature. Analog filtering can be divided into active filtering and passive filtering. In order to design an active filter, firstly, according to the required amplitude-frequency characteristics, an realizable rational function is found for approximate design. Commonly used approximation functions are Butterworth function, Chebyshev function, Bessel function and so on. Then calculate the circuit parameters and complete the design.
However, the complexity of analog filter circuit not only increases the design cost, but also increases the power consumption of the system and reduces the reliability of the system. With the development of electronic technology, digital filtering technology was applied to many occasions in the 20th century. Digital filtering technology has developed very rapidly. In the 2 1 century, most intelligent devices such as mobile phones and PDA have adopted digital filtering technology. As the processing unit of software radio, it has a very broad development prospect. However, the processing ability of single chip microcomputer is limited, and it can only complete relatively simple digital filtering.
In the single-chip microcomputer system, firstly, hardware is designed to take anti-interference measures for signals, and then the collected data is processed to eliminate interference when designing software, so as to further eliminate all kinds of interference attached to the data and make the collected data truly reflect the field situation. The following introduces several digital filtering technologies commonly used in industrial control.
(1) dead time processing
The signals collected in industrial field often fluctuate within a certain range, or the signals are superimposed with high-frequency and low-energy interference. This situation often occurs in the application of industrial control cards, and the last effective value of collected data fluctuates constantly, which is difficult to be stable. In this case, the dead zone can be used to deal with the fluctuation value, and only when the change exceeds a certain value can the value be considered to have changed. For example, when programming, you can divide the data by 10, and then round it up to remove the fluctuation term.
(2) Arithmetic average method
The formula is yk = (xk1+xk2+xk3+…+xkn)/n, sampling at different time points in a period, and then calculating its average value. This method can effectively eliminate periodic interference. Similarly, this method can be extended to the average of several consecutive periods.
(3) Median filtering method
The principle of this method is to sort the collected variable values of several periods, and then take the middle value of the sorted values. This method can effectively prevent data disturbed by burst from entering. In practice, the number of separation cycles should be properly selected. If the number is too small, the interference may not be eliminated. If the number is too large, the delay of sampling data will be too large and the system performance will deteriorate.
(4) low-pass filtering method
The formula is yk = q * xk+(1-q) * yk-1,and the cutoff frequency is f = k/2π t. This filtering method is equivalent to passing the collected data through a low-pass filter once. The signal from the field is usually 4~20mA, and its change is generally slow, while the interference has the characteristics of suddenness and high frequency of change. The low-pass filter can filter out this interference, which is the principle of low-pass filtering. In practical use, the Q value is reasonably selected according to the bandwidth of the signal.
(5) Sliding filtering method
Sliding filtering method is a generalization of first-order low-pass filtering method. Generally, the on-site signals are relatively stable and there will be no sudden change. If there is a sudden change in the received signal, it is probably interference. Based on this principle, the sliding filtering method regards all abrupt changes as interference and removes the interference by smoothing. Only smooth signals can be processed by this method, and the data processing process should be adjusted accordingly in different occasions. The formula of the sliding filtering method is: yn = q1xn+q2xn-1+q3xn-2, where Q 1+Q2+ Q3 = 1 and q1>; Q2 & gt; Q3 .
In practical use, it is often necessary to combine various methods to achieve other filtering effects. For example, in the median filtering method, mean filtering is added to improve the filtering performance.
3. Current-voltage conversion
Voltage signal can be converted into digital signal by A/D converter and then collected, while current cannot be directly converted by A/D converter. In application, the current is first converted into a voltage signal, and then converted. Current/voltage conversion is widely used in industrial control.
The simplest method of current/voltage conversion is to connect a precision resistor in series in the circuit under test, and obtain the current by directly collecting the voltage across the resistor. A/D devices can only convert a certain range of voltage signals, so in the process of current/voltage conversion, it is necessary to choose a precise resistor with appropriate resistance. If the dynamic range of current is large, an amplifier must be added at the back end for secondary processing. After repeated processing, the measurement accuracy will be lost. There are many current/voltage conversion chips in 2 1 century, and their response time, linearity, drift and other indicators are ideal, which can adapt to the measurement of large-scale current.
4. Voltage and frequency conversion
The frequency interface has the following characteristics:
(1) interface is simple and takes up less hardware resources. The frequency signal is input into the system through any I/O port line or as an interrupt source and counting clock.
(2) Good anti-interference performance. V/F conversion itself is an integration process, and A/D conversion with V/F converter is a frequency counting process, which is equivalent to integrating frequency signals within the counting time, so it has strong anti-interference ability. In addition, photoelectric coupling can be used to connect the channel between V/F converter and single chip microcomputer to realize isolation.
(3) It is convenient for long-distance transmission. Wireless transmission or optical transmission can be performed by modulation.
Because of these characteristics, V/F converter is suitable for some A/D conversion processes that are not fast but need long-distance signal transmission. V/F conversion can also simplify the circuit, reduce the cost and improve the cost performance.
5. Analog-digital conversion
Analog-to-digital conversion refers to the process of converting analog input signals into n-bit binary digital output signals. With the rapid development of semiconductor technology, digital signal processing technology and communication technology, A/D converter also showed a rapid development trend in 2000. The wave of human digitalization has promoted the continuous reform of A/D converter. 20 14 A/D converters all appear in communication products, consumer products, industrial medical instruments and even military products. It can be said that A/D converter has become the forerunner of human digitalization. Since the first integrated A/D converter of 1973 came out, A/D and D/A converters have made great progress in processing technology, accuracy and sampling rate. The accuracy of A/D converter in 20 14 can reach 26 bits, and the sampling rate can reach 1GSPS. Future A/D converters will be ultra-high speed and ultra-high speed. No matter how it develops, the principle and function of A/D conversion remain unchanged. In the next section, we will focus on analog-to-digital conversion technology.
7. 1.2 analog-to-digital conversion technology
2 1 century, software radio and digital image acquisition need high-speed A/D sampling to ensure effectiveness and accuracy, and the general measurement and control system also hopes to make a breakthrough in accuracy. The wave of human digitalization has promoted the continuous reform of A/D converter, which is the forerunner of human digitalization. A/D converter has been developed for more than 30 years, and has undergone many technological innovations, from parallel, successive approximation and integral ADC to newly developed sigma-delta ADC and pipelined ADC in 2 1 century. They have their own advantages and disadvantages and can meet the needs of different applications.
Successive approximation, integration, voltage-frequency conversion, etc. , mainly used for data acquisition and intelligent instruments with medium speed or low speed and medium precision. Hierarchical and pipelined ADC is mainly used in high-speed transient signal processing, fast waveform storage and recording, high-speed data acquisition, video signal quantization and high-speed digital communication technology. In addition, high-speed ADC with pulse and folding structure can be applied to baseband demodulation in broadcast satellites. σ-δADC is mainly used for high-precision data acquisition, especially in digital audio system, multimedia, seismic exploration instruments, sonar and other electronic measurement fields. Let's briefly introduce all kinds of adcs.
1. successive approximation calculation method
Successive approximation ADC is a widely used analog-to-digital conversion method, which includes 1 comparator, 1 digital-to-analog converter, 1 successive approximation register (SAR) and 1 logic control unit. It compares the sampled input signal with the known voltage continuously, and completes the 1 bit conversion within 1 clock cycle. The n-bit conversion takes n clock cycles, and outputs binary numbers after the conversion. The resolution and sampling rate of this kind of ADC are contradictory. At low resolution, the sampling rate is high. In order to improve the resolution, the sampling rate will be limited.
Advantages: When the resolution is lower than 12 bits, the price is lower and the sampling rate can reach1msps; Compared with other adcs, the power consumption is quite low.
Disadvantages: when the resolution is higher than 14, the price is higher; The signal generated by the sensor needs to be conditioned before analog-to-digital conversion, including gain stage and filtering, which obviously increases the cost.
2. Integrated ADC
Integral ADC, also known as dual-slope or multi-slope ADC, is also widely used. It consists of 1 analog integrator with input switch, 1 comparator and 1 counting unit. The input analog voltage is converted into a time interval proportional to its average value through two integrations. At the same time, a counter is used to count the clock pulses in this time interval, thus realizing A/D conversion.
The two integration times of integrating ADC are determined by the same clock generator and counter, so the obtained D expression has nothing to do with the clock frequency, and its conversion accuracy only depends on the reference voltage VR. In addition, because the integrator is used at the input end, it has a strong ability to suppress AC noise interference. It can suppress high-frequency noise and fixed low-frequency interference (such as 50Hz or 60Hz), and is suitable for use in noisy industrial environment. This kind of ADC is mainly used in low speed, precision measurement and other fields, such as digital voltmeter.
Advantages: high resolution, up to 22 bits; Low power consumption and low cost.
Disadvantages: low conversion rate, 12-bit conversion rate 100 ~ 300 SPs.
3. Parallel comparison analog-to-digital converter
The main feature of parallel comparison ADC is its high speed, which is the fastest among all A/D converters. Modern high-speed ADC mostly adopts this structure, and the sampling rate can reach above 1GSPS. However, due to the limitation of power and volume, the resolution of parallel comparison ADC is difficult to be very high.
The conversion of all bits in the ADC is completed at the same time, and its conversion time mainly depends on the switching speed of the comparator and the transmission delay of the encoder. Increasing the output code has little effect on the conversion time, but with the improvement of resolution, high-density analog design is needed to realize a large number of precision voltage divider and comparator circuits needed for conversion. When the number of outputs is increased by one bit, the number of precision resistors will be doubled and the comparator will be doubled.
The resolution of parallel comparison ADC is limited by chip size, input capacitance and power. Results If the accuracy of parallel comparators does not match, it will also cause static errors, such as increasing the input offset voltage. At the same time, due to the meta-voltage stabilization and coding bubbles of the comparator, this kind of ADC will also produce discrete and inaccurate output, which is called "spark code".
Advantages: The highest speed of analog-to-digital conversion.
Disadvantages: low resolution, high power consumption and high cost.
4. Voltage-frequency conversion ADC
Voltage-frequency conversion ADC is an indirect ADC. It first converts the voltage of the input analog signal into a pulse signal whose frequency is proportional to it, and then counts the pulse signal at a fixed time interval, and the counting result is a digital quantity proportional to the input analog voltage signal. Theoretically, the resolution of this ADC can be infinitely improved, as long as the width of the cumulative pulse number is long enough to meet the requirements of output frequency resolution.
Advantages: high precision, low price and low power consumption.
Disadvantages: similar to the integral ADC, its conversion rate is limited, and it is 100 ~ 300 SPs when 12 bit is used.
5. Sigma-δ ADC
σ -δ converter, also known as oversampling converter, adopts incremental coding mode, that is, quantization coding is carried out according to the difference between the previous value and the latter value. σ-δADC includes analog σ -δ modulator and digital decimation filter. σ -δ modulator mainly completes signal sampling and incremental coding, and provides incremental coding for digital decimation filter, that is, σ -δ code; The digital decimation filter completes the decimation filtering of σ -δ code and converts the incremental code into a high-resolution linear pulse code modulated digital signal. Therefore, the decimation filter is actually equivalent to a transcoder.
Advantages: high resolution, up to 24 bits; The conversion rate is higher than that of integral ADC and voltage-frequency ADC. Low price; The high frequency doubling oversampling technology is used internally to realize digital filtering, which reduces the requirements for sensor signal filtering.
Disadvantages: high-speed sigma-delta ADC is expensive; At the same conversion rate, the power consumption is higher than that of integral ADC and successive approximation ADC.
6. pipelined ADC
Pipeline ADC, also known as partitioned ADC, is an efficient and powerful analog-to-digital converter. It can provide high-speed and high-resolution analog-to-digital conversion with satisfactory low power consumption and small chip size; After reasonable design, it can also provide excellent dynamic characteristics.
Pipeline ADC is composed of several cascaded circuits, each stage includes a sample/hold amplifier, a low-resolution ADC and DAC, and a summing circuit, which also includes an interstage amplifier that can provide gain. The fast and accurate N-bit converter is divided into more than two sub-parts (pipelines) to complete. After sampling the input signal, the sampler/holder of the first-stage circuit quantizes the input through a coarse A/D converter with M-bit resolution, and then generates an analog/analog level corresponding to the quantization result through a product digital-to-analog converter (MDAC) with at least N-bit precision, and sends it to a summing circuit, which subtracts the analog level from the input signal. And the difference is accurately amplified by a fixed gain and then handed over to the next circuit for processing. After all levels of processing, the residual signal is finally converted by a high-precision K-bit fine A/D converter. Combine the coarse and fine analog-to-digital outputs of the above stages to form a high-precision N-bit output.
Advantages: good linearity and low misalignment; It can process multiple samples at the same time and has a high signal processing speed, usually tconv.
Disadvantages: the reference circuit and bias structure are too complicated; The input signal needs special processing to pass through several stages of circuits and cause pipeline delay; Strict requirements for latch timing; The circuit technology is very demanding, and the design of the circuit board ignores the parameters that affect the gain, such as linearity and offset.
This new ADC structure is mainly used in communication systems that require high frequency domain characteristics such as THD and SFDR, CCD imaging systems that require high time domain characteristics such as noise, bandwidth and transient response speed, and data acquisition systems that require high time domain and frequency domain parameters.
7. 1.3 A/D conversion device selection guide
There are many kinds of A/D converters with different performances, and the selection of A/D converters directly affects the performance of the system. After determining the design scheme, we must first make clear the index requirements required for A/D conversion, including data accuracy, sampling rate, signal range and so on.
1. Determines the number of bits of the ADC.
Before choosing A/D device, it is necessary to make clear the accuracy to be achieved in the design. Accuracy is a physical quantity that reflects the accuracy of the actual output of the converter close to the ideal output. In the process of conversion, the accuracy will be lost due to quantization error and system error. Among them, the influence of quantization error on accuracy can be calculated, which mainly depends on the number of bits of A/D converter. The number of bits of A/D conversion device can be expressed by resolution. Generally, A/D converters with less than 8 bits are called low-resolution ADC, those with 9~ 12 bits are called medium-resolution ADC, and those with more than 13 bits are called high-resolution ADC. The more bits of A/D devices, the higher the resolution, the smaller the quantization error and the higher the achievable accuracy. Theoretically, by increasing the number of bits of A/D devices, the accuracy of the system can be continuously improved. But this is not the case, because the circuit of A/D front-end will also have errors, which also restricts the accuracy of the system.
For example, if A/D is used to collect the signal provided by the sensor, the accuracy of the sensor will restrict the accuracy of A/D sampling, and the accuracy of the signal after A/D acquisition cannot exceed the accuracy of the sensor output signal. The precision required by the system and the precision of the front-end signal should be considered comprehensively in the design.
2. Select the conversion rate of the A/D converter.
In different applications, the requirements for conversion rate are different, and the sampling rate will be different in the same situation with different precision requirements. The sampling rate is mainly determined by the sampling theorem. When the application situation is determined, the sampling rate can be calculated by using the sampling theorem according to the characteristics of the collected signal object. If digital filtering technology is used, it must be oversampled to improve the sampling rate.
3. Judge whether it is necessary to sample/hold.
Sample-and-hold is mainly used to stabilize the semaphore and realize flat-top sampling. Sample/hold is very necessary for the acquisition of high frequency signals. If DC or low frequency signals are acquired, the sample-and-hold may not be needed.
Step 4 choose the right range
The dynamic range of analog signal is large, and sometimes negative voltage may appear. When selecting, the dynamic range of the measured signal should be within the range of A/D devices. So as to reduce the additional hardware cost.
5. Choose the appropriate linearity
In the process of A/D acquisition, the higher the linearity, the better. But the higher the linearity, the higher the price of the equipment. Of course, the influence of nonlinearity can also be reduced by software compensation. Therefore, factors such as accuracy, price and software implementation difficulty should be considered comprehensively in the design.
6. Select the output interface of the A/D device.
There are many interfaces of A/D devices, including parallel bus interface and serial bus interface, such as SPI, I2C, 1-Wire. Both of them have the same principle and accuracy, but the control mode and interface circuit are quite different. The choice of interface mainly depends on the system requirements and the proficiency of developers in various interfaces.
7. 1.4 digital logic signal acquisition
Generally, the digital logic signals to be collected include frequency signals and logic coded signals. Typical applications of frequency signal include measuring voltage, providing time reference and so on. Logic coded signal is a very broad concept. In 20 14, some sensors are digital, and their outputs are not current or voltage, but directly coded logic signals, such as temperature sensor DS 1820, various clock chips, GPS OEM modules and so on. The acquisition of logic coded signals mainly considers material interface and communication protocol. In some books, it is also classified as communication technology.
Analog signal (English) refers to a signal whose mathematical form is a time-domain continuous function. Corresponding to analog signals are digital signals, which take discrete logical values, while the former can get continuous values. The concept of analog signal is often used in the field of electricity, but it is sometimes used in classical mechanics, aerodynamics, hydraulics and other disciplines.