dtmf 8870 interfacing with 8051

Status
Not open for further replies.

niranjan23

Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
2,109
I want to interface 8870 DTMF IC to uC 8051.....

problem is output of 8870 is binary and how to program 8051 for a binary input.

as I want, when i press 1 2 3 from my cell phone the relay is latched,and again when I press 3 2 1 that get back to its original position..

Please help for this problem...
 

hi

Directly connect 8870 pin to port1 make rest of pins to ground read port in s/w and do what you want
 

As I know 8870 DFMF IC is built for receiving DTMF signals.
for each DTMF signal , 8870 produces a special binary code.
u can connect each output pin of this IC to the micro.then your code will be some if (...) then (...)
for example if the binary code is "1001" then the DTMF is "9".
that's it.
 

Code:
#include<reg51.h>

sbit Std=P1^0;  // tone Detector bit


void ini()     // Initialize Timer 1 for serial communication
{
	TMOD=0x20;  //Timer1, mode 2, baud rate 9600 bps
	TH1=0xFD; 	 //Setting a baudrate of 9600
	SCON=0x50;
	TR1=1;
}

void transmit()  // Funtion to transmit serial data
{
	unsigned char output;
	output=(P2 & 0x0F)+48;
	
	switch(output)
	{
		case '1':
		         SBUF='1';
				 break;
		case '2':
		         SBUF='2';
				 break;
		case '3':
		         SBUF='3';
				 break;
		case '4':
		         SBUF='4';
				 break;
		case '5':
		         SBUF='5';
				 break;
		case '6':
		         SBUF='6';
				 break;
		case '7':
		         SBUF='7';
				 break;
	    case '8':
		         SBUF='8';
				 break;
		case '9':
		         SBUF='9';
				 break;
		case ':':
		         SBUF='0';
				 break;
		case ';':
		         SBUF='*';
				 break;
		case '<':
		         SBUF='#';
				 break;
	}
	while(TI==0);
	TI=0;
}

void main()
{ 
 	P2=0xFF;        // Declare P1 as input port.
	ini();
	
	   
	 while(1)
	 {
	 	unsigned long z;
		while(Std == 0);
		transmit();
	    for (z=0;z<=3000;z++);
      }
}


above is the code which detects the tone and transmits the bit serially of a detected tone
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…