Digital filtering method of single chip microcomputer

Publisher:asd999dddLatest update time:2016-08-22 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Limiting filter method (also known as program judgment filter method)
A. Method:
Based on experience, determine the maximum deviation value allowed between two samples (set to A).
Every time a new value is detected, judge:
If the difference between this value and the previous value is <= A, then this value is valid.
If the difference between this value and the previous value is > A, then this value is invalid, abandon this value, and use the previous value to replace this value.
B. Advantages:
It can effectively overcome the pulse interference caused by accidental factors.
C. Disadvantages :
It cannot suppress the periodic interference.
Poor smoothness.
2. Median value filtering method
A. Method:
Continuously sample N times (N is an odd number)
and arrange the N sampling values ​​in order of size.
Take the middle value as the effective value of this time .
B. Advantages:
It can effectively overcome the fluctuation interference caused by accidental factors
. It has a good filtering effect on the measured parameters with slow changes in temperature and liquid level.
C. Disadvantages:
It is not suitable for fast-changing parameters such as flow rate and speed .
3. Arithmetic average filtering method
A. Method:
Continuously take N sampling values ​​for arithmetic average operation.
When the N value is large: the signal smoothness is high, but the sensitivity is low.
When the N value is small: the signal smoothness is low, but the sensitivity is high.
Selection of N value: general flow, N=12; pressure: N=4
B. Advantages:
Suitable for filtering signals with random interference.
Such signals are characterized by an average value, and the signal fluctuates around a certain range of values.
C. Disadvantages:
Not suitable for real-time control with slow measurement speed or fast data calculation speed.
Relatively wasteful of RAM.
4. Recursive average filtering method (also known as sliding average filtering method)
A. Method:
Consider N consecutive sampling values ​​as a queue.
The length of the queue is fixed to N.
Each time a new data is sampled, it is put at the end of the queue, and the original data at the head of the queue is discarded. (First-in-first-out principle)
Perform arithmetic average calculation on the N data in the queue to obtain a new filtering result
. Selection of N values: flow, N=12; pressure: N=4; liquid level, N=4~12; temperature, N=1~4
B. Advantages:
Good suppression of periodic interference, high smoothness.
Suitable for high-frequency oscillation systems.
C. Disadvantages:
Low sensitivity.
Poor suppression of occasional pulse interference.
It is not easy to eliminate the sampling value deviation caused by pulse interference.
Not suitable for occasions with severe pulse interference.
Relatively wasteful of RAM.
5. Median average filtering method (also known as anti-pulse interference average filtering method)
A. Method:
Equivalent to "median filtering method" + "arithmetic average filtering method"
Continuously sample N data, remove a maximum value and a minimum value
Then calculate the arithmetic average of N-2 data
Selection of N value: 3~14
B. Advantages:
Combining the advantages of two filtering methods
For occasional pulse interference, it can eliminate the sampling value deviation caused by pulse interference
C. Disadvantages:
Slow measurement speed, the same as arithmetic average filtering method
Relatively wasteful of RAM
6. Limiting average filtering method
A. Method:
Equivalent to "limiting filtering method" + "recursive average filtering method"
Each new data sampled is first limited,
and then sent to the queue for recursive average filtering
B. Advantages:
Combining the advantages of two filtering methods
For occasional pulse interference, it can eliminate the sampling value deviation caused by pulse interference
C. Disadvantages:
Relatively wasteful of RAM
7. First-order lag filtering method
A. Method:
Take a=0~1.
The result of this filtering = (1-a)*this sampling value + a*last filtering result
B. Advantages:
Good suppression of periodic interference
Applicable to occasions with high fluctuation frequency
C. Disadvantages:
Phase lag, low sensitivity
The degree of lag depends on the value of a
Cannot eliminate interference signals with a filtering frequency higher than 1/2 of the sampling frequency
8. Weighted recursive average filtering method
A. Method:
It is an improvement on the recursive average filtering method, that is, different weights are given to data at different times
Usually, the closer the data is to the current time, the greater the weight is.
The greater the weight coefficient given to the new sample value, the higher the sensitivity, but the lower the signal smoothness.
B. Advantages:
Applicable to objects with larger pure lag time constants
and systems with shorter sampling cycles.
C. Disadvantages:
For signals with smaller pure lag time constants, longer sampling cycles, and slow changes,
it cannot quickly reflect the severity of the current interference to the system, and the filtering effect is poor.
9. De-jitter filtering method
A. Method:
Set a filter counter.
Compare each sample value with the current effective value:
If the sample value = the current effective value, the counter is cleared.
If the sample value <> the current effective value, the counter is +1, and it is determined whether the counter is >= the upper limit N (overflow).
If the counter overflows, the current value is replaced by the current effective value, and the counter is cleared.
B. Advantages:
It has a better filtering effect for slowly changing measured parameters,
and can avoid repeated on/off jumps of the controller near the critical value or numerical jitter on the display.
C. Disadvantages:
It is not suitable for rapidly changing parameters .
If the value sampled at the time when the counter overflows happens to be an interference value, the interference value will be imported into the system as a valid value.
10. Limiting and de-jittering filtering method
A. Method:
Equivalent to "limiting filtering method" + "de-jittering filtering method"
first limiting, then de-jittering
B. Advantages:
Inherits the advantages of "limiting" and "de-jittering"
Improves some defects in "de-jittering filtering method" to avoid importing interference values ​​into the system
C. Disadvantages:
Not suitable for fast-changing parameters
Keywords:MCU Reference address:Digital filtering method of single chip microcomputer

Previous article:MSP430 controls AD9851 to generate frequency sweep wave
Next article:MSP430 controls the LCD screen of mobile phone

Recommended ReadingLatest update time:2024-11-16 13:35

PIC microcontroller music player program
The following program needs two timer resources. It can be implemented by any PIC microcontroller with two timers. The MCU required for this example is MICROChip PIC16C62   INCLUDE "D:\PIC\P16XX.EQU"; this file can be found in the MICROCHIP CD   ; ******************************************************   #define BeepOu
[Microcontroller]
Simple calculator program made with 51 single chip microcomputer
1. Hardware Simulation Diagram   The hardware part is relatively simple. When a keyboard key is pressed, the port of that row and column is at a low level. Therefore, as long as the row and column ports are scanned to see if they are both at a low level, it can be determined which key is pressed.   2. Main
[Microcontroller]
Simple calculator program made with 51 single chip microcomputer
Power saving methods for NUC1xx microcontrollers (MCUs)
Nuvoton Technology's NUC1xx includes NUC101, NUC100, NUC120, NUC130 and NUC140, which are 32-bit microcontrollers (MCUs) based on the ARM Cortex-M0 core. Through different clock settings, the operating frequency can reach up to 50MHz. However, in general simple control or when the system load is low, the CPU does no
[Microcontroller]
Power saving methods for NUC1xx microcontrollers (MCUs)
PIC16F877A PWM output program
//////////////////////////////////////// //In the PICC compiler master, debugging passed, PIC16F877A PWM signal output #include pic.h #define uchar unsigned char #define uint unsigned int __CONFIG(0x1832); void delay() { uint k; for(k=0;k 5000;k++);  } void main() { uchar k; T2CON=0X04; //Start timer 2 CCPR1L
[Microcontroller]
Small telephone switchboard controlled by PIC microcontroller
  This small switchboard is controlled by PIC microcontroller, which is easy to use. Extensions can make internal calls to each other. The biggest advantage is that when the power supply is cut off, each extension can still make external calls and keep the call confidential.   Circuit principle:   IC2-8870 detects
[Microcontroller]
Small telephone switchboard controlled by PIC microcontroller
Design of intelligent test system based on an 80C51 microcontroller
1 Introduction With the popularity of electronic and electrical products in social life, many domestic small and medium-sized enterprises have begun to develop and produce such products on their own to meet market demand. However, due to the limitations of human and material resources of small and medium-sized enterpr
[Microcontroller]
Design of intelligent test system based on an 80C51 microcontroller
LM3S9B96 designed 32-bit Cortex-M3 MCU development and design
This article introduces the LM3S9B96 MCU Cortex-M3 processor block diagram and the main features, block diagram, circuit diagram and expansion board circuit diagram of the Stellaris® LM3S9B96 development board. LM3S9B96 is TI's 32-bit MCU based on ARM Cortex-M3, with the price and cost of previous 8-bit and 16-
[Microcontroller]
LM3S9B96 designed 32-bit Cortex-M3 MCU development and design
Design of signal processing system based on dual single chip microcomputer
When the detection and control system processes a large amount of data and multiple information, only one single-chip microcomputer often cannot meet the system's real-time and scalability requirements, and the processing time is long. For example, in the process of collecting liquid level information, the single-ch
[Microcontroller]
Design of signal processing system based on dual single chip microcomputer
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号