Design of Decoding Algorithm of DTMF Signal Based on Single Chip Microcomputer

Publisher:平静的33号Latest update time:2011-09-16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In many cases, the data output by the DTMF decoder still needs to be sent to the microcontroller for corresponding calculation and processing, and then control the actions of various other devices. Therefore, if a decoding algorithm for DTMF signals based on a microcontroller can be found, supplemented by a simple shaping circuit, it can not only save the complete set of decoding circuits, but also achieve the purpose of simplifying the circuit and reducing costs.

This article introduces the original intention of this concept, and the results of computer simulation calculation data prove that it can fully meet the design requirements.

1. Frequency composition of DTMF signal and amplitude density of DTMF signal before shaping

In the DTMF signal, each of the 16 command keys is composed of two single-tone frequency signals (see Table 1). There are two groups of single-tone frequencies, the high-frequency group is (1209Hz, 1336Hz, 1447Hz, 1633Hz), and the low-frequency group is (697Hz, 770Hz, 852Hz, 941Hz). Each command key corresponds to a combination of a high-frequency group frequency and a low-frequency group frequency. Take the "*" command key as an example: its DTMF signal is composed of a low-frequency group signal of 941Hz and a high-frequency group signal of 1209Hz. Figure 1 is its spectrum diagram.

Table 1 DTMF signal frequency composition table

In DTMF signal

Spectrum

As can be seen from Figure 1, the DTMF signal of the "*" command key has spectral lines at 941Hz and 1209Hz. Under ideal conditions, the modulus values ​​of the spectrum density function X(f) at f=941Hz and 1209Hz can be calculated as |X(941)|, |X(1209)|, that is, their modulus values ​​are not zero. In other words, if the modulus values ​​of the spectrum density function exist at the same time as |X(941)|, |X(1209)|, and their modulus values ​​are not zero, the key number represented is "*". By analogy (see Table 1), the modulus values ​​of the low-frequency group signals |X(697)|, |X(770)|, |X(852)|, |X(941)| and the high-frequency group signals |X(1209)|, |X(1336)|, |X(1447)|, |X(1633)| can be calculated respectively. If there is a X(f) whose modulus value is not zero in each of the high-frequency group and the low-frequency group, then the command key represented by it is found in Table 1 through f.

When using a single-chip microcomputer to perform X(f) calculations, namely, discrete Fourier transform (DFT), only DTMF signals of finite length can be analyzed and processed, that is, discrete Fourier transform can be performed on N data within a finite time Tp=NT (N is the number of sampling points, T is the sampling time interval).

According to the DFT definition:

official

Taking the “*” command key signal as an example, in the high frequency group f=1209 Hz, the number of sampling points N=256, and the sampling time interval T=55×10-6 S, K=f×N×T, we can get K=17, that is, |X(17)| is the amplitude density of the DTMF signal at a frequency of 1209 Hz, and its value is 121.5. In the low frequency group f=941 Hz, the number of sampling points N=256, and the sampling time interval T=54×10-6 S, K=f×N×T, we can get K=13, that is, |X(13)| is the amplitude density of the DTMF signal at a frequency of 941 Hz, and its value is 123.6. Similarly, the amplitude density of the other 15 command keys can be calculated, see Table 2 (Table 2 is the amplitude density of the DTMF signals of the 16 command keys after computer simulation calculation).

Table 2 Amplitude density of DTMF signal before shaping

Amplitude density table of DTMF signal before shaping

From Table 2, we can see that due to the leakage effect caused by the truncation of the infinite-length DTMF signal in the time domain, for example, although the DTMF signals corresponding to the "2" and "3" keys do not contain the signal components with frequencies of 1209 Hz and 941 Hz, |X(17)| and |X(13)| are not zero. Ideally, they should be zero, which means that there is a certain amplitude density error. However, for the DTMF signals containing the high-frequency group signal of f=1209 Hz (such as the "1", "4", "7", and "*" keys), their |X(17)| values ​​are much larger than the |X(17)| values ​​of the DTMF signals without the high-frequency group signal of f=1209 Hz. Similarly, for the DTMF signals containing the low-frequency group signal of f=941 Hz, the |X(13)| values ​​of the DTMF signals are much larger than the |X(13)| values ​​of the DTMF signals without the low-frequency group signal of f=941 Hz. This provides the necessary conditions for the actual DTMF signal decoding and recognition. In actual DTMF signal decoding applications, the decoding process of the DTMF signal corresponding to any key number is:

(1) Sample the DTMF signal and calculate the amplitude density |X(k)| of the spectrum lines at 697 Hz, 770 Hz, 852 Hz, and 941 Hz respectively.

(2) Sort them and find the value of the low-frequency group frequency fL corresponding to the maximum amplitude density |X(k)|.

(3) Calculated in the same way, the amplitude density |X(k)| of the spectral lines at 1209 Hz, 1336 Hz, 1467 Hz, and 1633 Hz.

(4) Sort them and find the value of the highest frequency group frequency fH corresponding to the largest amplitude density |X(k)|.

(5) By looking up Table 1 based on fL and fH, the key number they represent can be obtained.

2. Amplitude density of DTMF signal after shaping and error analysis of experimental data

In order to send the DTMF signal to the single-chip microcomputer for DTMF signal decoding, the DTMF signal must be shaped, as shown in Figure 2. After the DTMF signal is compared and limited, it is shaped into a square wave. From the definition of DFT transformation, it can be seen that the value of x (nT) can only be 0 or 1, so the amount of calculation of |X (k) | is greatly reduced. Table 3 is the amplitude density calculated by computer simulation through the DTMF signal after shaping.

DTMF signal comparison and limiting diagram

Figure 2 DTMF signal comparison and limiting diagram

Table 3 Amplitude density table of DTMF signal after shaping

Amplitude density table of DTMF signal after shaping

Comparing Table 3 with Table 2, it can be found that the amplitude density of the leakage spectrum of the DTFM signal after shaping into a square wave increases, while the amplitude density of the effective spectrum decreases accordingly. For example, the amplitude density of the leakage spectrum generated by the No. 7 command key increases from 14.09 to 22.38, while the effective amplitude density decreases from 127.9 to 107.26. The main reasons for this problem are:

(1) Since N and T can only be integers, 1/f cannot be divided by N×T, so this will inevitably lead to a fence effect. At this time, the amplitude density of the effective spectrum calculated will inevitably be smaller than the actual value. At the same time, the leakage effect caused by the finite length of the sampling time Tp=NT will inevitably lead to an increase in the amplitude density of the leakage spectrum.

(2) After the DTMF signal is shaped into a square wave, it will produce a lot of harmonic interference. If the frequency of these interference signals is close to the frequency of the leakage spectrum, the amplitude density of the leakage spectrum will also increase.

Therefore, in the decoding process, if the amplitude density of the effective spectrum line decreases, while the amplitude density of the leakage spectrum line increases, when the amplitude density of the leakage spectrum line is greater than the amplitude density of the effective spectrum line, it will cause misinterpretation and missed interpretation. Therefore, if the N×T value is too small, or the difference with the integer multiple of the period to be measured is too large, coupled with harmonic interference after shaping into a square wave, it may cause misinterpretation and missed interpretation.

However, it can be seen from Table 3 that the maximum amplitude density of the leakage spectrum is 22.38, while the minimum amplitude density of the effective spectrum is 87.92. The difference between the two is nearly 4 times, and there is still a large amount of redundancy. For example, for DTMF signals containing f=1209 Hz high-frequency group signals (such as "1", "4", "7", "*" keys), their |X(17)| values ​​are still much larger than the |X(17)| values ​​of DTMF signals without f=1209 Hz high-frequency group signals. Similarly, for DTMF signals containing f=941 Hz low-frequency group signals, the |X(13)| values ​​are also much larger than the |X(13)| values ​​of DTMF signals without f=941 Hz low-frequency group signals. The two can still be clearly distinguished in the sorting. Therefore, the increase in the certain amplitude density error generated after the DTMF signal is shaped can be completely ignored. As long as the decoding application is properly designed and the N and T values ​​are reasonably selected, there will be no mistranslation or omission.

When the DTMF signal is relatively accurate or the interference is small, the operation speed can even be increased and the decoding time can be reduced by reducing the values ​​of N and T.

Reference address:Design of Decoding Algorithm of DTMF Signal Based on Single Chip Microcomputer

Previous article:Several suggestions on EMC design of single chip microcomputer
Next article:Design of digital potentiometer based on 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
Guess you like

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号