Anti-interference Methods of Single-Chip Microcomputer Application System

Publisher:逍遥游侠Latest update time:2015-04-23 Source: diangonKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
To eliminate the interference of the single-chip microcomputer application system, it is sufficient to remove one of the three basic conditions for the formation of interference (interference source, propagation path, and sensitive device). The internal interference source can be eliminated to a certain extent through reasonable electrical design, and the external interference source can be eliminated or cut off by shielding, grounding, isolation and other measures. The main work of anti-interference design is carried out around this part. The above three parts are not absolutely divided. Usually, the anti-interference measures of a system are comprehensive in many aspects to achieve the best effect.
In practice, the anti-interference design of the single-chip microcomputer application system is generally achieved through two ways: hardware anti-interference design and software anti-interference design. If the hardware is properly designed, most of the interference can be kept out, but there will still be a small amount of interference, so software measures are indispensable. Since software measures are at the expense of occupying the CPU, if there is no hardware to eliminate most of the interference, the CPU will be exhausted, which seriously affects the work efficiency and real-time performance of the system. Therefore, a single-chip microcomputer application system with good anti-interference performance is composed of hardware design and software development complementing each other.
1. Hardware anti-interference design
① Power supply circuit
The power supply used by the microcontroller system is generally provided by the industrial frequency AC power supply of the power grid after voltage reduction, rectification, filtering and other links. Due to the influence of the power grid and the start and stop of large-capacity electrical equipment at the production site, the AC voltage will contain high-frequency components, surge voltage, spike pulses or large voltage fluctuations. These factors will cause interference to affect the normal operation of the system through the power supply path. If the power supply is well done, the anti-interference work of the entire circuit is more than half completed. Many microcontrollers are very sensitive to power supply noise. Therefore, an anti-interference switching power supply should be used or a filter circuit or voltage stabilizer should be added to the microcontroller power supply to reduce the interference of power supply noise on the microcontroller. In addition to increasing the conductor width as much as possible according to the current size, the layout of the power line should also make the direction of the power line and the ground line consistent with the direction of data transmission. This will help enhance the ability to resist noise. Each type of microcontroller has a stable working voltage range. For example, the working voltage of Lingyang SPCE061A microcontroller is 3.3V~5V. Abnormalities will occur beyond this range.
② Hardware reset circuit


Figure 1 Reset circuit using MAX6827
The reset circuit is the most susceptible to interference (because the impedance of the reset circuit inside the CPU is relatively high, 10~50kΩ), and the impact is also the greatest. Therefore, anti-interference measures must be taken. Figure 1 is the reset and "watchdog" circuit diagram using MAX6827. This circuit has strong anti-interference ability. Since there is no reset capacitor, it is not easy to introduce interference.
③ Pay attention to the wiring of the printed circuit board
The printed circuit board is a high-density collection of devices, signal lines, and power lines in the single-chip system. The quality of the printed circuit board design has a great impact on the system's anti-interference ability. Therefore, the design of the printed circuit board is not only a simple layout arrangement of devices and lines, but also must comply with the anti-interference design principles. Reasonable design of the system circuit board can effectively cut off the propagation path of interference and suppress interference sources. At the same time, it can also improve the anti-interference ability of sensitive components (such as single-chip microcomputers, digital ICs, A/D, D/A, etc., which are easily interfered with). Mainly taken:
[1] Reasonable partitioning of the circuit board, such as strong and weak signal, digital and analog signal partitioning. Keep interference sources (such as motors and relays) as far away from sensitive components as possible. High-power devices should be placed at the edge of the circuit board as much as possible.
[2] When wiring, minimize the area of ​​the loop to reduce inductive noise; the power line and ground line should be as thick as possible. In addition to reducing voltage drop, it is more important to reduce coupling noise; avoid 90-degree bends in connecting lines to reduce high-frequency noise emission.
[3] Do not leave unused microcontroller pins, especially interrupt inputs, floating. Generally, they should be connected to the power supply through pull-up resistors.
[4] Each IC on the circuit board should be connected in parallel with a 0.01μF~0.1μF high-frequency capacitor to reduce the impact of the IC on the power supply.
[5] Pay attention to the crystal oscillator wiring. Keep the crystal oscillator and microcontroller pins as close as possible, isolate (circle) the clock area with a ground wire, and ground and fix the crystal oscillator shell. This measure can solve many difficult problems.
[6] Use a ground wire to isolate the digital area from the analog area, separate the digital ground and analog ground, and finally connect them to the power ground point to form a "star" shape.
In the microcontroller application system, grounding is an important method to suppress interference. Whether the grounding is correct and firm will directly affect the normal operation of the system. If the grounding and shielding can be used correctly together, most interference problems can be solved.
In order to prevent the interference of the internal ground wire of the system, the following measures can be taken when designing the printed circuit board: the ground wire should be as thick as possible. If the ground wire is very thin, the ground potential will change with the change of the current, causing the timing signal level of the computer to be unstable and the anti-noise performance to deteriorate. Therefore, the width of the ground wire should be determined according to the size of the passing current. If possible, the ground line should be thickened and widened as much as possible, preferably not less than 3mm, so that it can pass 3 times the allowable current on the printed circuit board. For multi-level circuits, the dynamic current of each level should be considered during design, and the influence of mutual coupling of ground impedance should be paid attention to. When the operating frequency is lower than 1MHz, one-point grounding is used, and when the operating frequency is higher, multi-point grounding is used.
2. Software anti-interference design
In the single-chip microcomputer application system, although hardware anti-interference measures are taken, the causes of the interference signal are very complex and have great randomness. Therefore, software measures are taken to supplement the hardware anti-interference measures. The following software anti-interference measures are briefly introduced.
① Set up software traps (Trap)
When the microcontroller is disturbed, the program counter PC value is most easily affected. The change of PC value is random, which can completely cause the CPU to leave the correct instruction sequence to execute some content in undefined addresses, or enter the data area, and control the data as an opcode, causing the entire work to be disordered and the system to lose control. This situation is much more serious for the system than the harm caused by a certain data error. The latter only involves a certain function that cannot be realized or has deviations, while the former will paralyze the entire system. The reason for the program out of control is not a problem with the program design itself, but due to external interference or a momentary hardware failure inside the microcontroller, the program counter (PC) deviates from the original value. For example, when an instruction is executed, the program counter PC should add a value of 1, but for some reason, the PC actually adds 2. In this way, the program will confuse the operand and the opcode, causing a series of errors later.
In order to prevent the above situation from happening, the method of setting up software traps can be used to overcome it during software design. The specific method is to set several consecutive cells to "00" (no operation) every few instructions (such as ten or twenty) in ROM or RAM. In this way, when the program goes out of control, as long as the out-of-control microcontroller enters any of the numerous software traps, it will be captured and perform several no operations in succession. After executing these no operations, the program automatically returns to normal and continues to execute the following program. Although this method wastes some memory units, it can ensure that the program will not run away. This method is not transparent to the user, that is, the user cannot feel whether the program has an erroneous operation at all.
② Open up multiple storage areas for anti-interference
In order to prevent RAM errors and lose the most important data, 2 to 3 storage areas are opened for important input and output data to be saved simultaneously. When accessing data, a comparative voting method is adopted to distinguish the false from the true. [page]
③ Time monitor
The time monitor (Watch-Dog Timer), also known as the "watchdog" technology, is used to set up a software trap failure to allow the system to recover from the fault. Because the program that goes out of control due to interference does not necessarily fall into the trap, such as the program's dead loop. The so-called dead loop means that for some reason the program is trapped in an application or interrupt service subroutine and loops endlessly. In this way, the CPU and other system resources are occupied by it and other task programs cannot be executed. In other words, the dead loop makes the program lose normal control, but it will not cause the program control to enter the trap area, so the software trap cannot capture it.
The time monitor consists of two counters, and the counters count by the system clock (or the divided pulse signal). When the counter is full, the counter will generate a reset signal to force the system to reset and re-execute the program. Under normal circumstances, the program clears the counter at a certain interval (determined by the length of the system application execution). In this way, the counter will not be full, and thus no reset will occur.


Figure 2 SPCE061A watchdog structure and timing
For example, the clearing time period of the WatchDog of the Sunplus MCU SPCE061A is 0.75s. Because the overflow reset signal WatchDog_Reset of WatchDog is generated by the 4Hz time base signal after 4 division, that is, every 4 4Hz time base signals (1s) will generate a WatchDog_Reset signal. However, the WatchDog_Clear signal that clears WatchDog can occur at any time point between the 4Hz signals (0.25s). If the WatchDog_Clear signal occurs at 0.01s at the end of the 4Hz signal, that is, at the 0.25s moment, although WatchDog is cleared at this time, since it occurs after the 4Hz signal, after 3 4Hz signals, that is, 0.75s, if there is no WatchDog_Clear signal, a WatchDog_Reset signal will be generated. As shown in Figure 2, if the program runs abnormally, such as falling into an infinite loop, the counter will be full and overflow. This overflow signal is used to generate a reset signal to restart the program. In programming, we only need to write 0X0001H to the P_WatchDog_Clear unit to complete the clearing of the WatchDog operation. If 0X0001H is not written to the P_WatchDog_Clear unit within 0.75 seconds, the CPU will perform a system reset operation, which is what we usually call restarting the system. Watchdogs are often used in delay programs, such as
void Delay()
{
unsigned int j;
for(j=0x7fff;j>0;j--);
*P_Watchdog_Clear = 0x0001;//Clear watchdog
}
④ Adding no operation NOP
In several areas of ROM or RAM, several no operation groups are stored, and the number of no operations is equal to the longest instruction section of the selected CPU chip. In addition to occupying a storage unit and execution time, the no operation instruction NOP has no effect on the working state of the CPU. If you insert 1-2 NOP instructions selectively in a certain place of the program, you can also adjust the content in the PC and return the program to the correct order after being disturbed. The insertion position should be explored, analyzed and experimented during the program debugging process. Generally speaking, inserting NOP instructions before the operation instructions of the peripheral port, multi-byte instructions, transfer instructions, and stack operation instructions will achieve good results. In addition, you can also add a program to handle runaway after the empty operation group, and let the CPU not execute these instruction groups when executing normal programs. These instruction groups are only likely to be encountered when running away. For example:
NOP
NOP
NOP
LJMP FF
FF: ACALL FLY
MOV A, FLG
CJNE A, #11H, RSM
...
⑤ Segmented software anti-interference
Sometimes, the control system needs to execute several different main loop channels in sequence to complete different functions. At this time, anti-interference judgment and self-recovery functions can be compiled in different main loops. This can avoid unnecessary repeated execution to ensure the integrity of the sequence.
⑥ Digital filtering
Digital filtering is to process the input signal of the single-chip microcomputer data acquisition part through program design to achieve the purpose of anti-interference. When the interference is superimposed on the analog signal of the input channel, the data acquisition error is increased, especially when the analog signal of the input channel is weak, this phenomenon is more serious. In order to eliminate the error of data acquisition, the arithmetic mean method, the comparison and selection method, the first-order lag filtering method and the median method are often used. The optimal design method can be adopted according to the law of signal and interference.
Different single-chip microcomputer application systems have their own system requirements and characteristics, and they also have their own characteristics in hardware and software anti-interference design. As a supplement to hardware anti-interference, software anti-interference technology plays a pivotal role in the anti-interference of single-chip microcomputer application systems with its flexibility, practicality and reliability. In engineering practice, several anti-interference technologies are usually used together and complement each other to achieve good anti-interference effects. When we design a single-chip microcomputer application system, we must carefully analyze the interference source, combine software and hardware anti-interference technologies, and improve the system monitoring program, so as to ensure the accurate and reliable operation of the system.

Keywords:MCU Reference address:Anti-interference Methods of Single-Chip Microcomputer Application System

Previous article:Problems that should be paid attention to when developing and designing single-chip microcomputer application systems
Next article:The main interference forms of single chip microcomputer application system

Recommended ReadingLatest update time:2024-11-16 14:39

AVR microcontroller (learning) - (II), ATMEGA16 interrupt system - 01
2. ATMEGA16 interrupt system 2- (01) Two-way anti-theft system test As mentioned in the previous article, this microcontroller controls the so-called registers to control the related functions of the microcontroller (the reason why it is more powerful than 51 is that it combines these and several other buses, which wi
[Microcontroller]
AVR microcontroller (learning) - (II), ATMEGA16 interrupt system - 01
Introduction to the software and hardware of pulse measuring instrument based on 8098 single chip microcomputer
1 Measurement Principle    The 8098 single-chip microcomputer has high-speed input and output channels with excellent performance. HSO0~HSO5 are high-speed output channels, which can generate pulse waves (PWM) with adjustable output width and period. HSI0~HSI3 are high-speed input channels. The CPU can simultaneously
[Microcontroller]
Introduction to the software and hardware of pulse measuring instrument based on 8098 single chip microcomputer
PIC MCU Learning Materials (I): Interface Design
PIC microcontroller (Peripheral Interface Controller) is an integrated circuit (IC) used to develop and control peripheral devices. Now the application field of PIC microcontroller is quite extensive. In order to facilitate engineers to learn PIC microcontroller well, Electronics Enthusiasts Network has sorted out the
[Microcontroller]
PIC MCU Learning Materials (I): Interface Design
Design of digital virtual surround sound controller based on PIC microcontroller
introduction With the rapid development of smart entertainment technology, consumers generally want to create the sound effects of a home theater. To configure a home theater sound system, you need a surround sound processor and a high-power AV amplifier, and at least 5 or 6 speakers. However, using 5 or 6
[Microcontroller]
Design of digital virtual surround sound controller based on PIC microcontroller
Timing Design and Simulation of Analog Switch Based on Single Chip Microcomputer
     With the rapid development of modern industry, real-time monitoring of working parameters is becoming more and more important. Parameter monitoring is divided into two categories: electrical quantity and non-electrical quantity. For the measurement of non-electrical quantity parameters, the success of the measurem
[Microcontroller]
Timing Design and Simulation of Analog Switch Based on Single Chip Microcomputer
DHT11 and DS18B20 temperature and humidity control microcontroller program
Based on 51 single chip microcomputer, the sensor uses dht11 and ds18b20. The temperature measurement accuracy of dht11 is limited, and 18b20 can make up for it. The first line shows the humidity and temperature collected by dht11, as well as the relay status. The second line shows the temperature and THI collected by
[Microcontroller]
DHT11 and DS18B20 temperature and humidity control microcontroller program
Development of intelligent and precise plant lighting system based on STC12C5A60S2 microcontroller
    Preface     During the growth of crops, light conditions have an important impact on the growth rate, yield and quality of crops . At present, most of China's facility agriculture still relies on incandescent lamps, halogen tungsten lamps, high-pressure mercury fluorescent lamps, high-pressure sodium lamps, etc. a
[Microcontroller]
Development of intelligent and precise plant lighting system based on STC12C5A60S2 microcontroller
Design of intelligent treadmill controller based on AVR microcontroller
1 Introduction The electric treadmill is the mainstream product among fitness equipment at present. It uses a motor to drive the running belt to make people run or walk passively at different speeds. In terms of human strength, it saves a stretching action compared to running and walking on the ground, which ca
[Microcontroller]
Design of intelligent treadmill controller based on AVR microcontroller
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号