Fast implementation of Gaussian filter in real-time system

Publisher:JoyfulMelodyLatest update time:2006-05-07 Source: 电子技术应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    Abstract: The rapid implementation method of Gaussian filter in single chip microcomputer system is discussed in detail, and the specific implementation program for MCS-51 series single chip microcomputer is given. The introduced method has great practical value in real-time control, signal detection and processing. .

    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.

 

Reference address:Fast implementation of Gaussian filter in real-time system

Previous article:Multi-core DSP structure and super-core DSP structure
Next article:Modular joint rate control technology

Latest Embedded Articles
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号