Beruflich Dokumente
Kultur Dokumente
Project #: H3232
Abstract
This project is to design and build a home telephone message forwarding system using the Renesas
microcontroller H8S/2398 (MCU) by implementing a touch tone (Dual-Tone Multi-Frequency or DTMF)
detector and a DTMF generator.
The constructed device is a simple, useful, low-cost device. It is connected in serial between a
telephone port and an answering machine. The device continuously monitors the telephone line loop-
current. When an incoming call arrives while the owner of the device is not at home, the answering
machine is engaged. The increased line loop-current triggers the device to start the touch tone detection.
The answering machine greeting voice instructs the caller to either leave a voice message or key in his/her
telephone number. The device monitors the phone line and captures any touch tone presented during this
telephone call process into the MCU memory storage. After the caller terminates the call and hangs up
his/her telephone, the answering machine disengages the line. The drop of the line loop-current triggers
the device to enter a message forwarding stage. In this stage, the device checks the telephone line
condition and automatically engages the line if it is not busy. The device then starts a touch tone generator
to dial an owner-preset pager number. After connecting to the pager center, the device uses the touch tone
generator again to send either the caller’s telephone number if it was entered or the owner’s home
telephone number (preset) if the caller left only a voice message. By reviewing the forwarded number on
his pager, the owner can directly contact the caller by using the callback number or check the voice
message left on the home answering machine (Figure 1).
In order to utilize the Renesas MCU to the maximal extent and lower the construction cost, the device
uses only software to detect and create DTMF signals without using any external hardware DTMF
detectors and generators. The DTMF tone detection process consists of 8 Modified Goertzel discrete
Fourier transform (DFT) filters, one for each DTMF standard frequency, and 2 additional DFT filters for
2nd harmonic detection to further discriminate the voice signal. A rail-to-rail operational amplifier
conditions the incoming audio signal to a 5V range and feeds the signal to the on-chip A/D converter. The
A/D converter is driven by the on-chip 16-bit timer unit at an 8 KHz sampling rate, which is above the
Nyquist sampling rate requirement. The acquired data is forwarded from the A/D converter to double-
buffered memory storage for DTMF filtering using a DMA channel. At the 20 MHz MCU system clock
rate, the 10 DFT filters are performed continuously every 14ms period.
The DTMF tone generation is constructed by using 2 channels of the on-chip D/A converter and a
sine wave lookup table. The sine wave is generated at a rate of 50 samples/cycle in any of the DTMF
frequencies, which provides up to 80 KHz sampling rate high quality sound output (much higher than
audio CD 44.1KHz sampling rate).
The device complies with FCC part-68 requirements. All peripheral parts and MCU are isolated from
telephone line by using a transformer and optocouplers. The DTMF signal injected to the telephone line is
tuned to 0 dBm at 600 ohm.
Port for setting
pager/home numbers
Telephone
V+
Ring IC2
Setting
Normal Loop current Answering
S1 sensor Machine
Line
busy IC3
Line
Engage
Off
hook
Tip
2
Hardware resource
A/D output
DTMF A/D
buffer (1 word)
8000 Hz
End of
transfer Interrupt
System TPU Service
DMA Routine
clock φ φ/2500
20.00MHz
Filter Filter
buffer buffer Swap
Double
buffering block 1 block 2
(115 (115
words) words)
Start
3
Starter Kit board and telephone line interface board
4
Telephone line interface board schematic
5
List 1. Goertzel DFT Filter Assembly Codes
;****************************************************************************
;* Function: GoertzelDFT *
;* Description: This is Goertzel DFT filter *
;* Parameters: *
;* R0: Cosine coefficient of the frequency (premultiplied by 2^16) *
;* *
;* Return: *
;* R0 Magnititude^2 of the filtered frequency *
;* *
;* Note: *
;* *
;* Gozertzel algorithm: *
;* Sk[n] = x[n] + 2*coefficient*Sk[n-1] - Sk[n-2] *
;* Only last N (do once): *
;* Mag^2 = SK[N]^2 - 2*coefficient*SK[N]*SK[N-1] + SK[N-1]^2 *
;* *
;* The operation is using fixed point data format *
;* Upper 18bit is integer part of the real data *
;* Lower 14bit is fraction port of the real data *
;* *
;* Register usage: *
;* ER0: Sk[n] *
;* ER1: Sk[n-1] *
;* ER2: Sk[n-2] *
;* E3 coefficient * 4 *
;* R3L loop count *
;* ER4 input sample pointer *
;* ER5 for temp reg *
;****************************************************************************
SKN1 .REG (ER1)
SKN2 .REG (ER2)
COE: .REG (E3)
LPCOUNT .REG (R3L)
NEGFLG .REG (R3H)
SAMPLEPTR .REG (ER4)
SKN1HIGH .REG (E1)
SKN1LOW .REG (R1)
SKN2HIGH .REG (E2)
SKN2LOW .REG (R2)
GoertzelDFT:
;Save working registers
PUSH.L ER2 ;ER0 and ER1 don't to save (for arguments)
PUSH.L ER3
PUSH.L ER4
PUSH.L ER5
GozertzelLoop:
6
SHAL.L ER0 ;Sk[n-1] * 2
7
ADD.L SKN2, SKN1 ;Sk[n-1]^2 + Sk[n-2]^2
BTST #0, R0L ;check the sign of product term
BEQ ?0050 ;if positive, do subtraction
ADD.L ER5, SKN1 ;else, do addition
BRA ?0060
?0050
SUB.L ER5, SKN1 ;- 2*Coeff*Sk[n-1]*Sk[n-2]
?0060
MOV.L SKN1, ER0 ;result in ER0
RTS