How to improve the anti-interference of SCM to make you take a detour.
Friends have experienced the product, a design seems to be simple, hardware design and code writing is quickly done, but in the process of debugging, but more or less accidents, these are the reflection of the ability to resist interference. Here's how to avoid detours in your design: Anti-jamming is reflected in two aspects, one is hardware design, the other is software programming. Here is the key point: in the design of MCU, the main anti-jamming design is hardware and software. Because MCU's computing power is limited, it takes a lot of time to work on hardware. Look at the way of interference: 1: the main path of interference signal interference MCU is through the I/O port, one is the data acquisition that affects MCU, and the other is the other internal registers. Solution: later discussion. 2: power interference: MCU although the voltage is wide (3-5). 5V), but very sensitive to power fluctuations, such as MCU can work stably at 3V voltage, but not at 3V-5 voltage. Stable work in the case of 5V fluctuations.
Solution: use power supply stabilizer block, do the work of power filter, prompt: must bypass the power supply and up to 0. 1UF's porcelain capacitor is used to filter out high-frequency interference, because electrolytic capacitors do not work for high-frequency interference of more than a few dozen KHZ. 3: up and down interference: but every MCU system has to go through such a process when power on, so pay particular attention to it. Although MCU can work steadily under the 3V voltage, it does not mean that it does not work under the voltage below 3V, and of course, under such a low voltage, the MCU is ultra unstable. When the system is added, the power supply voltage of the system rises from 0V to the rated voltage. For example, when the voltage reaches 2V, MCU begins to work, but it is a super unstable work, and it is very easy to fly. Solution: 1 let MCU start working after the power is stable. PIC integrates POR (internal power delay reset) on the chip, which must be opened in configuration bits. The external power delay reset circuit. There are many forms, and the low cost is to reset the pin to a resistance capacitance circuit. The high cost is to use a dedicated chip. There are so many information in this area that we can find everywhere. The most difficult to eliminate is the above first kind of interference, and the interference signal can occur at any time, the intensity of the interference signal is not the same. But they have the same thing: the interference signal also follows Ohm's law, the interference signal coupling path is nothing but electromagnetic interference, one is electric spark, the other is magnetic field. The most serious interference is electrical spark interference, followed by magnetic interference. The performance of EDM is mainly due to high power switches, relays, contactors, brush motors and so on. The performance of magnetic field interference is mainly the vicinity of high-power AC motors, transformers and so on. Solution: First: the most classic, is the PCB step line and the position of the component position, this middle school many, say a few days can not say ^ ^. Two: considering the input impedance of each I/O port and collecting speed, the peripheral circuit of I/O port is designed. Generally, the input impedance of an I / O port is determined in three cases: A: I / O port has pull-up resistance, and the value of pull-up resistance is the input impedance of the I / O port. In general, we use 4K-20K resistor to pull up, (PIC B port internal pull-up resistance is about 20K). Because the interference signal also follows Ohm's law, the more the interference is, the smaller the selection of the pull resistance is, because the smaller the voltage of the interference signal is on the resistance. The smaller the pull up resistance is, the more power consumption is, so in household design, the pull resistance is generally 10-20K, and the pull resistance can be even as low as 1K in strong interference. If you want to discard the B port pull function in strong interference, you must use external pull up. B: I/O port is connected to the output pin of other digital circuits, and the input impedance of I/O port is the impedance of the output port of digital circuits, usually tens to hundreds of Euros. It can be seen that the use of digital circuits to mediate can reduce the impedance to the most ideal, on many industrial control boards can be seen a large number of digital circuits to ensure performance and protection of MCU. The C:I/O port is parallel to the small capacitance. Because the capacitor is through AC resistance DC, and the interference signal is instantaneous generation, instantaneous extinguishment, so the capacitor can filter out the interference signal. But it is not good to cause the I/O port to collect the signal rate drops, for example, on the serial port and capacitance is not advisable, because the capacitance will be the digital signal when the interference signal is filtered out.
For some detection switches, reed tubes, Holzer components, and so on, they can be capacitive, because the change of these switches is impossible to have a very high rate, and a small capacitor has no effect on the acquisition of the signal.