October
2004, Issue 171
Telephone
Message Watchdog
An
Intelligent Call-Forwarding System
by
Jingxi Zhang, Yang Zhang, & Huifang Ni
DTMF
DETECTION
The
telephone tone dialing system is called dual-tone multi-frequency
(DTMF) signaling. Its a standard telecommunication
system developed by Bell Laboratories. In this system,
a matrix is used to compose a signal, which consists
of a lower frequency group, containing four distinct
frequencies that are below 1 kHz, and a high-frequency
group, containing four distinct frequencies above 1
kHz (see Table 1). Each telephone key is represented
by a pair of simultaneous low- and high-frequency tones.
To
detect DTMF signals by software in the digital domain,
many algorithms have been proposed. The modified Goertzel
algorithm is one of the most efficient computing techniques
for detecting a limited number of frequencies. In the
case of DTMF tone detection, the Goertzel algorithm
analyzes only eight frequencies instead of performing
an entire transform using something like FFT. This saves
a lot on computational resources, which are critical
for lower-power processors. Its noncomplexity is easy
to adapt into small MCUs and DSP. Therefore, we selected
the modified Goertzel DFT for our design.
Like
an infinite impulse response (IIR) filter, a Goertzel
algorithm contains a recursive feedback path. For a
DTMF tone filter, the following calculation step is
performed on incoming data:
where
n = 0, 1,
, N 1. N is the block size, and k = fDTMF/fSAMPLING.
(fDTMF is a DTMF tone frequency. fSAMPLING is the ADC
sampling frequency.) x[n] is the newly arrived sampled
data.
Initially,
Sk[n 1] = 0 and Sk[n 2] = 0 when n equals zero.
In the last step, the modified Goertzel algorithm calculates
the power of the frequency:
For
computation efficiency, DTMF detection is implemented
using the H8S assembler language (see Listing 1 and
Listing 2). Each filter uses precalculated coefficients
from a different K value corresponding to the DTMF basic
frequency. The input audio signal is digitized by the
on-chip ADC at an 8-kHz sampling rate. The 20-MHz H8S
MCU computation speed is adequate to handle the input
data at this sampling rate. The A/D sampling clock arrives
from an on-chip 16-bit timer (see Figure 2). A DMA channel
is used to feed the converted data to a 115-word buffer.
A double-buffered memory storage scheme is used. When
the DTMF filtering process is working on a data-filled
buffer (first buffer), the DMA controller is feeding
data to a second buffer from the ADC. The interrupt
service routine then sets the DMA pointing to the first
buffer and instructs the DTMF filtering process to start
working on the second buffer. This ping-pong buffering
is repeated every 14 ms.