Keywords: Filter to quickly implement microcontroller real-time system
Filters have very important applications in the fields of signal processing, signal detection, and communications. In real-time systems, there are very strict requirements for filter performance and processing speed. Especially in fast real-time systems, processing speed is crucial. At present, in order to meet the needs of fast processing, using DSP technology is an ideal choice. However, most of the current real-time control systems are implemented with single-chip microcomputer, which not only completes signal sampling, but also completes signal processing and control functions. If the single-chip microcomputer system itself can complete the fast signal processing task, it will be very convenient. In a communication system with strong noise background composed of MCS-51 microcontroller, we realized the rapid implementation of Gaussian filter, which met the needs of the system.
1 Algorithm principle
The Gaussian filter is a low-pass filter. Its equation can be proved that the Gaussian filter can be approximated multiple times by the mean filter. In general, a Gaussian filter can be approximated by greater than or equal to three approximations. Therefore, when designing a Gaussian filter When using a filter, a mean filter approximation can be designed to replace the Gaussian filter.
In the formula, n is the current sampling point number, and N is the window width. Obviously, the mean filter can actually be completed by one addition operation, one subtraction operation and one division operation, and has nothing to do with the width of the window. If the window width is taken, the division operation can be used. Shift to replace.
In the formula (1), multiplying both sides by N can become:
That is, in order to avoid division operations, we can first use an accumulator to replace the mean, and then divide the operation result by No. The above filter structure can be represented in Figure 1.
2 MCS-51 fast implementation method of mean filter
For stable signals, the above calculation is very simple. It only requires the window to slide on the fixed memory. For real-time signals, the content of the memory is updated at any time, which is equivalent to the signal passing through a fixed filter.
Assume that the sampling signal is stored cyclically in the storage space from RAM addrl to addrn, as shown in Figure 2.
Obviously, the latest sampled value only needs to replace the earliest data stored in RAM, and the accumulated sum in Equation 2 is actually the original accumulated sum plus the latest sampled value, minus the earliest sampled value. We use a data pointer to point to the storage unit currently storing data. To facilitate programming, the content of the next unit is used as the earliest sampling value, such as f(1) at time n+1 in Figure 2, so the window width is n+1.
Assume Ro is the current data pointer, which stores the accumulated sum. The current sampling value is in A, then the assembly implementation program of 89C51 is:
Assuming the window width is , the above accumulated sum only needs to be shifted to the right by k bits to become the mean.
Obviously, the above algorithm is equally fast regardless of the window size, so this algorithm is more effective for wide window filtering.
If the above program uses an 89 series microcontroller and uses a 24MHz crystal oscillator, it only takes a few μs. If faster speed is required, use a 16-bit microcontroller instead. The accumulated sum is in a register, which can also reduce the time of addition and subtraction.
The author uses the above method to process binary signals in real time in the lighting line data communication system. Since the window width is less than 256, only one byte is used in the cumulative sum, so the processing time only takes 5μs, which is very satisfactory.
This article discusses the rapid implementation of Gaussian filters in microcontroller systems. This method is particularly suitable for filtering in real-time data collection, processing, and control systems. Practice shows that this method has high practical value and is worthy of promotion.
Previous article:Multi-core DSP structure and super-core DSP structure
Next article:Modular joint rate control technology
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
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
- #DailyGoodReading# Tell us about the good books you have read
- I recently found an article (PPT) to solve the EMC problem of a certain system. I just found it after exploring a little bit (share it...
- Serial port sending and receiving string examples
- Radio information
- Force value jitter problem
- VGA Chinese Character Display.pdf
- Seeking guidance, a few questions about RA2A1's SDADC
- Mother's Day is coming, what do you have to say?
- Four-tube buck-boost converter FSBB
- PCB Handbook: Eliminate Schematic Design Errors with Automated Verification | Mentor Prize-giving Event