MT8870 DTMF Interfacing with 8051

Introduction

  • DTMF (Dual Tone Multi-Frequency) is a telecommunication signaling technique that uses a mixture of two pure tones (pure sine waves) sounds. It is used in phones to generate dial tones.
  • Whenever a key is pressed, a combination of 2 sine waves (one of lower frequency and one of higher frequency) is transmitted. There are 8 different frequencies, 4 from higher frequency range and 4 from the lower frequency range. This gives us 16 different combinations of lower and higher frequencies to transmit for 16 keys.
  • MT8870 is a DTMF decoder; it helps decodes the key pressed.
  • It consists of bandsplit filter section that helps separate the input signal into a lower frequency and a higher frequency and in turn, helps identify the key pressed.
  • It gives a 4-bit digital output. This gives 16 possible outputs for 16 different keys.
  • The microcontroller can read these 4 bits to detect which key has been pressed.

For more information about the MT8870 DTMF decoder and how to use it, refer to the topic MT8870 DTMF Decoder in the sensors and modules section.

Interfacing diagram

DTMF Decoder Interfacing with 8051

DTMF Decoder Interfacing with 8051

 

Example

Here, we are going to interface the MT8870 DTMF receiver/decoder module to 8051 which will receive key pressed input from the cellphone keypad and display that decoded key on the LCD16x2 display.

 

Programming for DTMF

/*
 * Interfacing DTMF with 8051
 * http://www.electronicwings.com
 */

#include<stdio.h>
#include<reg52.h>
#include<LCD_16x2_8-bit_Header_File.h>

#define DTMF_Input_Read P2

void External_Interrupt_Init();

volatile char Key_detect;		/* flag to check Tone is received or not */

void main()
{   
	unsigned char DTMF_Key;		/* variable to store detected key */           
	LCD_Init();
	LCD_Clear();
	DTMF_Input_Read = 0xff;		/* set port as input */
	LCD_String_xy(0,0,"DTMF Key:");
	External_Interrupt_Init();
	Key_detect = 0;
	while(1)
	{
		MSdelay(1);
		if(Key_detect)                /* Key_detect = 1 indicates Tone Received*/
		{
			Key_detect = 0;
			LCD_Command(0xc0);
			DTMF_Key = 0;
			DTMF_Key = (DTMF_Input_Read & 0x0f);
			switch(DTMF_Key)  /* detect received key*/
			{
				case 0x01: LCD_Char('1');
				           break;
				case 0x02: LCD_Char('2');
					   break;
				case 0x03: LCD_Char('3');
					   break;
				case 0x04: LCD_Char('4');
					   break;
				case 0x05: LCD_Char('5');
					   break;
				case 0x06: LCD_Char('6');
					   break;
				case 0x07: LCD_Char('7');
					   break;
				case 0x08: LCD_Char('8');
					   break;
				case 0x09: LCD_Char('9');
					   break;
				case 0x0A: LCD_Char('0');
					   break;
				case 0x0B: LCD_Char('*');
					   break;
				case 0x0C: LCD_Char('#');
					   break;
			}
		}
	}
}


void External_Interrupt_Init()				
{
	EA  = 1;		/* Enable global interrupt */
	EX0 = 1;      		/* Enable Ext. interrupt0 */			
	IT0 = 1;      		/* Select Ext. interrupt0 on falling edge */ 	
}
/* ISR is used to check tone is received or not */
											
void External0_ISR() interrupt 0    
{
	Key_detect = 1;		/* Toggle pin on falling edge on INT0 pin */
}

 


Components Used

MT8870 DTMF Decoder
MT8870 is a DTMF (Dual Tone Multi-Frequency) receiver, which decodes the dial tone generated from telephone keypad. It is used in interactive voice response systems (IVRS), Remote control, Credit card systems etc.
1
8051 AT89c51
8051 AT89c51
1
LCD16x2 Display
LCD16x2 Display
1

Downloads

DTMF_communication with 8051 Project File Download
MT8870 Datasheet Download
Ad