2. Impact of interference on microcontroller application systems
The main factors that affect the reliable and safe operation of application systems come from various electromagnetic interferences inside and outside the system, as well as system structural design, component installation, processing technology and external electromagnetic environmental conditions. The interference consequences of these factors on the microcontroller system are mainly reflected in the following aspects:
(1) The measurement data error increases. The
interference invades the input channel of the analog signal of the measurement unit of the microcontroller system and is superimposed on the measurement signal, which will increase the data collection error. , and even the interference signal overwhelms the measurement signal, especially when detecting some weak signals, such as the human body's bioelectrical signals.
(2) Affects the RAM memory and E2PROM of the microcontroller
. In the microcontroller system, programs , tables, and data are stored in the program memory EPROM or FLASH to avoid interference and damage to these data. However, the data in the on-chip RAM, external expansion RAM, and E2PROM may be changed by external interference.
(3) Control system failure
The control signals output by the microcontroller usually depend on the status input signals of certain conditions and the logical processing results of these signals. If these input status signals are interfered with and false status information is introduced, the output control error will increase or even control failure.
(4) Abnormal program operation.
External interference sometimes causes the machine to reset frequently, affecting the normal operation of the program. If external interference causes the microcontroller program counter PC value to change, the normal operation of the program will be destroyed. Since the PC value after interference is random, the program will execute a series of meaningless instructions and finally enter an "infinite loop", which will seriously mess up the output or freeze.
3. Hardware anti-interference technology
3.1 Choose good components and microcontrollers
Hardware anti-interference technology is the preferred anti-interference measure in system design. It can effectively suppress interference sources and block interference transmission channels. Commonly used anti-interference measures in hardware design are as follows:
① There are many types of components sold on the market today. Some components are available but have poor performance, and some components are extremely susceptible to interference. Therefore, when selecting key components such as decoders and keyboard scanners, When using controllers, RAM, etc., it is best to choose industrial-grade products with stable performance.
② When choosing a microcontroller, you should not only consider hardware configuration, storage capacity, etc., but also choose a microcontroller with strong anti-interference performance. After using various types of microcontrollers, the author believes that the AVR series microcontrollers have strong anti-interference capabilities.
③ The external clock is a high-frequency noise source that can cause interference to both the inside and outside of the system. Therefore, it is wise to choose a low-frequency microcontroller under the premise of meeting the needs.
3.2 Suppressing power supply interference
Each unit in the microcontroller system requires the use of DC power supply, and DC power supply is generally generated by AC power from the mains power grid after transformation, rectification, filtering, and voltage stabilization. Therefore, various interferences on the power grid will be introduced. system. In addition, since the AC power supply is shared, mutual interference will occur between electronic devices through the power supply, so it is particularly important to suppress power supply interference. Power supply interference mainly includes the following categories:
① High-frequency interference in the power line The
power supply line is equivalent to a receiving antenna, which can couple high-frequency interference signals radiated by lightning, arcs, radio stations, etc. to the secondary through the primary of the power transformer, forming a pair of Interference from the microcontroller system;
② The transient noise generated by the inductive load
can produce a large current and voltage change rate when cutting off a large-capacity inductive load, thus forming transient noise interference and becoming the main form of electromagnetic interference;
③ When the thyristor is turned on and off The interference of
the thyristor causes a large current change rate when it is turned on and off, causing a large current with high-order harmonics to flow through the thyristor at the moment it is turned on, causing a large voltage drop in the power supply impedance, causing a gap in the grid voltage, which This distorted voltage waveform contains high-order harmonics, which can radiate into space or couple through conduction, interfering with other equipment. In addition, there are interferences caused by grid voltage fluctuations or instantaneous voltage drops, etc.
The following methods can usually be used to suppress power supply interference:
① Grounding technology
Practice has proved that the anti-interference of microcontroller system equipment is closely related to the system's grounding method. Grounding technology is often an important means of suppressing noise. Good grounding can suppress the coupling of noise inside the system to a great extent, prevent the intrusion of external interference, and improve the anti-interference ability of the system. The metal shell of the equipment must be safely grounded; the conductor used for shielding must be well grounded;
② Shielded wire and double rubber wire transmission
shielded wire has a strong inhibitory effect on electrostatic interference, while double rubber wire can offset electromagnetic induction interference. Switch signal detection lines and analog signal detection lines can use shielded double-glue wires to resist static electricity and electromagnetic induction interference; special interference sources can also be connected with shielded wires to shield the interference sources from exerting external interference;
③
Isolation of isolation technology signals One of the purposes is to isolate interference sources and interference-prone parts from the circuit, so that the monitoring device only maintains signal contact with the site, but does not have direct electrical contact. The essence of isolation is to cut off the introduced interference channel, so as to achieve the purpose of isolating on-site interference.
Generally, single-chip microcomputer application systems have both weak current control systems and strong current control systems. The isolation of weak current and strong current is usually implemented, which is an important measure to ensure the stability of the system and the safety of equipment and operators. Commonly used isolation methods include photoelectric isolation, transformer isolation, relay isolation and wiring isolation.
④ Analog signal sampling and anti-interference technology
In microcontroller application systems, one or more analog signals are usually sampled and converted into digital signals through A/D for processing. In order to improve measurement accuracy and stability, it is not only necessary to ensure the conversion accuracy of the sensor itself, the stability of the sensor power supply, the stability of the measurement amplifier, and the stability of the A/D conversion reference voltage, but also to prevent the influence of external electromagnetic induction noise. If not handled properly , a weak useful signal may be completely overwhelmed by useless noise signals. In actual work, you can use a measuring amplifier with differential input, use shielded double-glue wire to transmit the measurement signal, or change the voltage signal into a current signal, and use resistance-capacitance filtering and other technologies.
In many sampling systems with relatively slow signal changes, such as human body bioelectricity (electrocardiogram, electroencephalogram) sampling, seismic wave recording, etc., the most influential one is the 50Hz power frequency interference. Therefore, the suppression of power frequency interference signals is one of the important measures to ensure measurement accuracy. To suppress and eliminate power frequency interference, the common method is to add an RC filter before the A/D conversion circuit, or to use a double-integral A/D converter whose sampling time is an integer multiple of the power frequency cycle of 50Hz.
3.3 Anti-interference technology of digital signal transmission channel
The digital output signal can be used as the driving signal of the controlled equipment of the system (such as relay, etc.), and the digital input signal can be used as the response and command signal of the equipment (such as travel switch, start button, etc.). The digital signal interface part is one of the main channels for external interference to enter the microcontroller system. In engineering design, the anti-interference measures taken for the input/output process of digital signals include: shielding technology for transmission lines, such as using shielded wires, double-glue wires, etc.; adopting signal isolation measures; reasonable grounding. Public impedance interference is formed during the process, and choosing a suitable grounding point can effectively suppress ground wire noise.
3.4 Hardware monitoring circuit
In the microcontroller system, in order to ensure the reliable and stable operation of the system and enhance the anti-interference ability, a hardware monitoring circuit needs to be configured. The function of the hardware monitoring circuit includes the following aspects:
① Power-on reset: ensure that the system is powered on can start correctly when the power supply fails;
② Power-off reset: When the power supply fails or the voltage drops below a certain voltage value, a reset signal is generated to reset the system;
③ Data protection: When the power supply or system works abnormally, necessary data protection Protection, such as write protection, backup battery switching, etc.;
④ Power supply monitoring: When the power supply voltage is abnormal, an alarm indication signal or interrupt request signal is given;
⑤ Hardware watchdog: When the processor encounters interference or the program runs chaotically, a "death" occurs. When "locked", reset the system.
Some well-known semiconductor manufacturers have integrated the above functions, such as MAXIM's MAX690, MAX706, etc.
3.5 Reasonable layout of printed circuit board
Printed circuit board (PCB) is the support for circuit components and devices in electronic products. It provides electrical connections between circuit components and devices. With the rapid development of electronic technology, the density of PCBs is getting higher and higher, and the quality of PCB design has a great impact on the ability to resist interference. Therefore, when designing PCB, the general principles of PCB design must be followed and the requirements of anti-interference design should be met. Two points are highlighted below:
① Key device placement: In terms of device layout, like other logic circuits, related devices should be placed as close as possible to achieve better anti-noise effect. The clock generator, crystal oscillator and clock input terminal of the CPU are all prone to noise and should be kept close to each other; the CPU reset circuit and hardware watchdog circuit should be as close as possible to the corresponding pins of the CPU; devices that are prone to noise and high current circuits should be kept as close as possible Stay away from logic circuits and make a separate circuit board if possible.
② For D/A and A/D conversion circuits, special attention should be paid to the correct connection of the ground wire, otherwise the interference effect will be serious. D/A, A/D chips and sampling chips all provide digital ground and analog ground, with corresponding pins respectively. In the circuit design, the digital ground and analog ground of all devices must be connected respectively, but the digital ground and analog ground are only connected at one point.
In addition, shielding protection can also be used, and shielding can be used to isolate space radiation. Parts that are particularly noisy (such as variable frequency power supplies and switching power supplies) can be covered with metal boxes to reduce the interference of noise sources on the microcontroller. For parts that are susceptible to interference, a shielding cover can be added and grounded to short-circuit the interference signal to the ground. 4.
Principles and methods of software anti-interference Although we have adopted hardware anti-interference measures, it is difficult to ensure that the system is completely free from interference due to the complex and highly random causes of interference signals. Therefore, on the basis of hardware anti-interference measures, software anti-interference technology is often used to supplement the hardware measures as an auxiliary means. The software anti-interference method has the characteristics of simplicity, flexibility, convenience, and low cost.
It is widely used in the system.
4.1 Digital filtering method
Digital filtering is a process of extracting the closest true value data through software algorithms based on multiple sampling of analog signals. The algorithm of digital filtering is flexible and the authority parameters can be selected. The effect is often beyond the reach of hardware filtering circuits.
4.2 Input signal repetition detection method
The interference of the input signal is a series of discrete spikes superimposed on the effective level signal, and the action time is very short. When there is input interference in the control system and it cannot be effectively suppressed by hardware, the software can be used to repeatedly detect the method to achieve the purpose of "removing the false and retaining the true". It will not be effective until two or more consecutive collection results are completely consistent. If the signal is always changing, an alarm signal can be given when the maximum number of times is reached. This input method can be used for signals from various switch-type sensors, such as limit switches, travel switches, operating buttons, etc. If a delay is inserted between successive data acquisitions, wider interference can be dealt with.
4.3 Output port data refresh method
The anti-interference design of the switching output software mainly adopts the method of repeated output, which is an effective measure to improve the anti-interference performance of the output interface. These measures are necessary for control signals that use latch outputs. The data is output repeatedly in the shortest possible period. The correct information arrives before the equipment affected by the interference has time to respond, thus preventing malfunctions in time. In terms of program structure arrangement, a data buffer can be established for output data, and the data can be output in the periodic loop body of the program. For incremental control equipment, data cannot be sent repeatedly in this way. The correctness of data transmission can only be judged from the feedback information of the equipment through the detection channel.
When executing the repeated output function, for the programmable interface chip, the working mode control word and the output status word are repeatedly set together to make the output module work reliably.
4.4 Software interception technology
When the interference that enters the microcontroller system acts on the CPU, the consequences will be more serious and the system will malfunction. The most typical failure is to destroy the state of the program counter PC, causing the program to jump from one area to another, or the program to "fly around" in the address space, or fall into an "infinite loop". Software interception technology can be used to intercept "flying" programs or get the program out of the "infinite loop" and put the running program on track and go to the designated program entrance.
4.5 "Software watchdog" technology
The PC is interfered with and loses control, causing programs to "fly around" and may also cause the program to fall into an "infinite loop". When software interception technology cannot help an out-of-control program get out of the "infinite loop", program monitoring technology WDT TIMER (WDT), also known as "watchdog" technology, is usually used to get the program out of the "infinite loop". WDT is an anti-program runaway measure that combines software and hardware. Its hardware body is a counter or monostable used to generate timing T. This counter or monostable basically operates independently, and its timing output terminal is connected to the reset line of the CPU. , and its timing clearing is controlled by the CPU. Under normal circumstances, after the program starts the WDT, the CPU periodically clears the WDT, so that the WDT timer overflow will not occur, and it will have no effect just like sleep. In the abnormal situation of interference, the CPU timing logic is destroyed and the program execution is chaotic. It is impossible to periodically clear the WDT. In this way, when the WDT timer overflows, its output resets the system and the CPU gets rid of the paralysis caused by temporary interference. status.
5. Conclusion
The above are some common anti-interference measures for single chip microcomputer systems that the author has summarized in practical work. These methods have also been adopted when designing single chip microcomputer systems and have achieved good results.
Previous article:Environmental noise measuring instrument based on 89C51 microcontroller
Next article:Anti-interference technology of microcontroller application system
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- BMP picture decoding system based on STM32
- CC3200_PWM+intelligent car+tracking+arm barrier+distance measurement
- Sensorless FOC Video
- Delay function
- Design of wireless wide area Internet of Things application system based on LORA
- Experience in using TI DSP/BIOS and CCS
- [2022 Digi-Key Innovation Design Competition] ESP32S2 WIF Networking
- [NXP Rapid IoT Review] + Unboxing the real thing brings back a lot of thoughts!
- TMS320F28335 startup process
- Encoder Problems