We can use the C language program code subroutine of the digital filtering method to complete the software filtering function. We assume that the data is read from the 8-bit AD. If it is a higher-bit AD, the data type can be defined as int, and the subroutine is defined as get_ad().
(1) Arithmetic average filtering program, call the function get_ad() to read the data.
(2) Determine the filtering program and call the data reading subroutine get_ad().
(3) Sliding average filter method C language program, calling the data reading subroutine get_ad().
(4) Median average filtering method C language program, calling the data reading sub-function get_ad().
(5) Median filtering method: the N value can be adjusted according to the actual situation, and the sorting adopts the bubble method.
This example mainly introduces the method and program of using single-chip microcomputer to realize software filtering. The sliding average filter method has a good inhibitory effect on periodic interference, high smoothness and low sensitivity, but it has a poor inhibitory effect on occasional pulse interference, and it is not easy to eliminate the deviation of the sampling value caused by pulse interference. Therefore, it is not suitable for occasions with serious pulse interference, but is more suitable for high-frequency oscillation systems.
Arithmetic mean filtering cannot eliminate obvious pulse interference, but can only weaken its influence, so that the output value of the average filter is closer to the true value. The program judgment filtering method can effectively overcome the shortcomings of pulse interference caused by accidental factors, but it cannot suppress that kind of periodic interference and has poor smoothness.
Previous article:Implementation of USB firmware design for single chip microcomputer
Next article:Nine simple digital filtering algorithms (C language source program)
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- Keep up with the latest news in 2018: fast charging and wireless charging, Bluetooth and smart home and GaN
- Please help provide the entire PCB board production process and the SMD component mounting process animation. Thank you
- Summary of DSP's real clock system--Explained with TI's DSP TMS320F2812 as an example
- E840-DTU device unresponsive problem
- Is it better to first increase the voltage to 5V and then decrease it to 3.3V when using a 3.7V lithium battery? Or is it better to first decrease it to 3.3V and then increase it to 5V?
- Download the Pomona Connectors catalogue and win a Xiaomi Mosquito Repellent!
- Are smaller components better?
- Anyone have any ADS simulation tutorials to share?
- The Xiaomi IoT module wifi version only costs 9.99 yuan. What would you most like to use it for?
- EEWORLD University ---- EDDP Motor Control Demonstration Platform Usage Guide