# DTMF Tone Generation

Function: Implement DTMF Tone Generation on a C54x DSKPlus

Location: ftp://ftp.ti.com/pub/tms320bbs/c5xxdskfiles/Dtmf.exe
By: Patrick Rowland

> #### DTMF Tone Generation:

> Starting off:
> This suite of files provides a demonstration of DTMF tone generation implemented on the C54x DSKPlus. The list of files necessary to run this application are:

            Dtmf_aic.asm    - analog interface circuit initialization routine
            Dtmf54x.asm     - main assembly program
            Dtmf54x.obj     - object file for mail assembly program
            Dtmfvecs.asm    - vector table for program
            wdialer.exe     - executable to run program on the C54x DSKPlus
                              includin user interface
            wdialer.txt     - text file explaining the basics of using the
                              executable <-READ THIS!!
            phone.ato       - ASCII file that contains list of example phone
                              numbers

> To run this program in a windows environment on a PC, simply double click on the "wdialer.exe" icon in a directory which includes all of the files listed above. Referencing the "wdialer.txt" file will provide the specifics for using the virtual touch pad interface. This code can also be run through the GO DSP Code Explorer. One line of code must be altered in the main assembly program prior to using the Code Explorer and the code then reassembled. This is also explained in "wdialer.txt". To listen to the output DTMF tones , a speaker is required and can be plugged into the output mini-jack (also called RCA jack). (see TMS320C54x DSKPlus User’s Guide page 1-4 for jack location)

> Theory:
> As a short review, DTMF tones for the telephone are generated by combining two sinusoids of different frequencies to make one unique "tone". Each column and row of a telephone have a certain frequency which can range from approximately 700 - 1700 MHz. It is the combination of the row and column frequency that generates the tone we associate with each key on the pad.

> What this application code does is implement the generation of these tones via the C54x DSKPlus. There are two major portions of the code. One creates the tones by combining the proper two sinusoids into the standard DTMF tones we have on our phones. The other generates pauses. A sampling rate of 8kHz insures that everything is well within the Nyquist criteria and other segments of the code deal with transmission and coefficients.

> There is much more that can be covered in addressing this area. TI has published an application note to address this. For an in-depth look at DTMF Tone Generation and Detection, reference the following internet site:

> #### http://www.ti.com/sc/docs/psheets/appnote.htm

> Once there, look under "T" for TMS320C54x and there you should find the following document:
> (Or you can click on the link below to download it now!!)

> 4. DTMF TONE GENERATION AND DETECTION ON THE TMS320C54X

> - spra096.pdf (266 KBytes)

> Hints:
> To begin manipulating this code, look to the line:

>     File: "Dtmf54x.asm"
>             TIME     .word    0d60h           ; pulse duration

> By changing the hexadecimal number "0d60", you can alter the length of the tones you hear. The code uses that specific number to set the timer and govern the length of the tone. By exploring the code and it’s use of the accumulator to watch the timer, one could calculate the exact tone length given the internal clock speed.

> The document mentioned above on the TI internet site also gives reference on how the coefficients used to generate the sinusoids for the columns and rows of the telephone key pad. With the formulas listed there, one could generate different frequencies by altering the coefficients in the main assembly code.