Design of TM card water meter control system based on 51 single chip microcomputer

Publisher:tau29Latest update time:2011-10-14 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0 Introduction

Due to the high cost-effectiveness of single-chip microcomputers, they are often used to replace DSP chips in data acquisition and spectrum analysis systems. In digital signal processing, discrete Fourier transform (DFT) is a commonly used transformation method, which plays an important role in various digital signal processing systems. Fast Fourier transform (FFT) is not another transformation different from discrete Fourier transform, but a fast and effective algorithm to reduce the number of DFT calculations, and they are both for transforming signals into the frequency domain and performing corresponding spectrum analysis. Although FFT is a fast calculation method, it still requires Nlog2N additions and 0.5Nlog2N multiplications to calculate the FFT of N points. When N is relatively large, its computational complexity also requires a lot of RAM. In this article, we will explore how to optimize the FFT algorithm and implement it in a single-chip microcomputer.

Although there are good chips to solve the problems of FFT operation speed and RAM capacity, the cost of single-chip microcomputer is relatively low. Therefore, it is of practical significance to discuss the implementation of FFT algorithm in single-chip microcomputer. Finally, this paper also gives the application of FFT in radar detection by single-chip microcomputer.

1 Radix 2 FFT algorithm

The output of FFT is consistent with that of DFT, but the redundant calculations have been subtracted in FFT, making it faster. For an N-point Fourier transform, the computational complexity required by DFT is N2, while the computational complexity required by FFT is N/2log2N. Therefore, when N is relatively large, using FFT for Fourier transform will greatly reduce the amount of calculation. For example, a 64-point DFT requires a computational complexity of 4096, while using FFT only requires a computational complexity of 192. In a single-chip microcomputer, when other optimization methods are used, FFT calculations take less time.

In this article, when using FFT, we are concerned with reducing the temporary memory space required to store intermediate data. When performing an FFT, the input and output data are stored in bit-reversed order. When changing between sequential and reversed order, each data point swaps with another data point in the data set by reversing the order of the sample series. For example, in a 16-point FFT, the sample stored at address 001 b will be swapped with the sample stored at position 100 b. Positions with reversed bytes are equal to positions without reversed bytes, such as 0110 b, which do not swap. The order in which the FFT is calculated is determined by whether the input or output of the FFT needs to be stored in reversed order.

2 Windowing the input data

The FFT transform can be applied to data with a finite length of time, but an assumption is made about the data set: it is periodic and repeats infinitely. When the sample data repeats in this way, the last sample (subscript [N-1]) is immediately followed by the first sample ([0]) in the next period. As shown in Figure 1, when the data is not periodic throughout the sample set, discontinuities will result when the FFT is performed on the entire sample. Because of this, the data usually needs to be windowed before the FFT transform. Windowing makes the sample set periodic and removes the discontinuity between the first sample and the last sample. Since windowing changes the input data, it will produce some noise in the frequency domain. Windowing will stretch the energy of the signal to several points. The energy distribution will weaken the peak of the signal. Most of the original content of the signal is stored in the main part. When a part leaks side lobes (as shown in Figure 2), the width of the main part and the height of the side lobes are determined by the windowing algorithm applied to the signal. Some window functions and their performance are shown in Table 1. Some equations for calculating the coefficients of the windowing function for the N-point FFT are shown in Table 2. For more information about windowing algorithms and their parameters, see [2].

Time Domain Windowing

Effect of windowing in the frequency domain

Window performance

Window coefficient equation

3 FFT Optimization

There are many methods for optimizing FFT. The purpose of these optimization methods is to increase the calculation speed and reduce the RAM required to store data as much as possible.

As we all know, an important method for calculating FFT is the butterfly method. But each iteration of the butterfly calculation requires a complex multiplication (a total of four long integer multiplications). Long integer multiplications require a lot of processing memory to complete. But if we look closely, we will find that some of the multiplications are not needed and can be omitted. In particular, when the multiplier is zero, the result will be zero and when the multiplier is 1, the result of the multiplication will remain unchanged. The code that queries whether the sine and cosine functions are 0 or 1 can take advantage of these advantages to reduce the amount of calculation. The amount of calculation that can be saved by this optimization method is: official where N is the number of points in the FFT.

4 Overall Program Design

The head is divided into three modules. That is, data acquisition module, A/D conversion module and FFT operation module. The data acquisition module mainly controls the sampling period of the A/D converter through the timer, converts the collected data into signed numbers, and can be stored in complex form. The FFT operation module runs a 256-point FFT on the data memory of the 8051 microcontroller, and calculates the amplitude or decibel representation value corresponding to 128 frequency points through a fast square root or fast logarithm operation. The specific process is shown in Figure 3.

Specific process

5 Application in Telephone Video

In a meeting, when the speaker changes, we need the camera to automatically track and detect the speaker's position, which requires the use of FFT and its inverse transform to calculate the angle.

6 Conclusion

This article mainly introduces an optimization method for implementing FFT algorithm in single chip microcomputer, which can greatly reduce the amount of FFT calculation and the RAM required to store data. Therefore, it can be applied in telephone video conferencing.

Reference address:Design of TM card water meter control system based on 51 single chip microcomputer

Previous article:Design and implementation of reverse collision warning system based on single chip microcomputer
Next article:Clock synchronization technology between C8051F120 and RS422 information line

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号