Tiva Lab 13: DTMF Tones Generator

 

Objective

  • Produce simply tones by square wave signal
  • Using PWM to generate different frequencies of square wave

Required Reading Material

Background Information 

DTMF (Dual-Tone Multi-Frequency)

The short term of the Dual-Tone Multi-Frequency is DTMF. DTMF Technology is used in push-button telephones, where when a key or button is pressed on the phone, a corresponding and unique tone will be generated. This tone is a combination of two different frequencies.

The DTMF system uses a set of eight audio frequencies transmitted in pairs to represent 16 signals, represented by the ten digits (0 ~ 9), the letters A to D, and the symbols # and *. The DTMF telephone keypad is laid out in a 4x4 matrix of push buttons and each button is associated with two frequencies as shown as belows. Each row represents the low frequency tones (697, 770, 852 and 941 Hz) and each column represents the high frequency tones (1209, 1335, 1477 and 1633 Hz) of the DTMF signal. Pressing a key sends a combination of the row and column frequencies. For example, the key 0 produces a superimposition of tones of 941 and 1336 Hz.

 TelephoneKeypadTones
Figure 1: DTMF Keypad Layout and The Corresponding Tone Frequencies

The frequencies and the keypad layout of DTMF tone dialing has been internationally standardized, but the tolerances on individual frequencies may vary in different countries. The North American standard is 1.5% for the generator and 2% for the receiver. Moreover, the tone has to be held for a specific minimum time before it is accepted as a valid dialing digit. In North America, the minimum time for a digit is about 50 ms and the inter-digit interval is also about 50 ms.

The *, #, A, B, C and D keys are widely used worldwide by amateur radio operators and commercial two-way radio systems for equipment control, repeater control, remote-base operations and some telephone communications systems.


In this lab, the system will generate DTMF tones to dial the numbers,which are pressed on the keypad. The DTMF tone is driven by square wave that is generate by the Pulse Width Modulation (PWM) module of the Tiva TM4C microcontroller instead of Digital-to-Analog Converters (DACs). Since each PWM generator can only produce one square signal, in order to generate dual tones, the system needs two PWM generators to produce two tones in different frequencies.

 

Required Components List

  Passive Buzzer x 1
Resistor 64 10 ohm Resistor x 2
MatrixKeypad 4x4 64 4x4 Matrix Keypad x 1

 

Circuit Diagram

You have to decide which two PWM signals will be used to generate DTMF tone, and then connect the PWM pins with a 10 ohm resistor to drive a passive buzzer as shown as above figure. A matrix keypad is also connected to Tiva LaunchPad board.

dtmf circuit

  

Procedure

 

Configurations

Write down the following configuration information onto your report.

The PWM generator can produce a square wave signal. The frequency of the signal is controlled by the PWM LOAD register. Change the value in the LOAD register will change the frequency of PWM signal (square wave). The formula for the LOAD value in different PWM frequencies is shown as below:

LOAD = \frac{{{f_{PWMTimer}}}}{{{f_{PWM}}}} = \frac{{({f_{SysClk}}/PWMDIV)}}{{{f_{PWM}}}}

  1. Configure the system clock frequency to 40 MHz by using ezTiva LIB API (check here). 
  2. Configure two PWM by calling Setup_PWM() function.
  3. Configure GPIO by calling Setup_GPIO() function.
  4. Create a function: char ReadKeypad() to read the keypad and then return the ASCII code for the key that pressed by user
  5. Create a function: PlayDTMF(digit, duration) to generate dial tones.
    • The digit is a character to represent the dial ton key for '0' ~ '9', 'A' ~ 'D' or '*', '#'.
    • Calculate the LOAD value for each ton frequency.
    • The duration is the period of the tone in ms.
  6. In the infinite for-loop:
    • Call ReadKeypad() to detect the key pressed by user.
    • If any key is pressed, the call PlayDTMF() function to generate dial tone.

 

Sample Code

Lab Experiments

  

Questions

  1. What is the difference between an active and passive buzzer?
  2. Can we use two PWMs that use the same PWM generator to generate the dial tone (for example, uses M0PWM2 and M0PWM3)? Explain why, or why not?

 


Exercises

Program Implementation will require code submission.

Submit your completed project report including your working code.