Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/08/11 07:04
Read: times


 
#181774 - MT8870 DTMF Code
Hi

We are using 8052 in our project with 11.0592MHz crystal. We are using external RAM CY62256. We are using 3 MT8870 ICs for identifying the tone for the digit dialed by the phone instrument. The ICs will work in a sequence.

In hardware side, the DV pins of the MT8870s are connected to port pins P1.5, P1.6, P1.7 respectively. The 4 data lines of MT8870s are connected to P0 port pins 0~3. We are using Timer 0 interrupt with 15 milliseconds delay. The code to sense the change in DV pins and receiving the tone is as shown:


#include<absacc.h>

#define DTMF_CONT_LATCH  XBYTE[0x0500]	/*Keil absolute memory access*/

unsigned char dv_temp[3];/*Temp buffers For 3 MT8870s*/
unsigned char latch_dtmf[3];/*Flag, which will be set when DV pin is high*/
unsigned char code dtmf_cp[3] = {0x20,0x40,0x80};/*For cross-checking DV pins*/

unsigned char i,digitDialed;

unsigned char bdata dv_state;/*used to read the port 1*/
unsigned char bdata dtmf_con_latch;/*DTMF MT8870s Chip selection*/
sbit fo_dtmf1_cs = dtmf_con_latch^0;
sbit fo_dtmf2_cs = dtmf_con_latch^1;
sbit fo_dtmf3_cs = dtmf_con_latch^2;

unsigned char bdata dtvar;	/*To read the data from port 0*/			
sbit dt0	= dtvar^0; 	
sbit dt1	= dtvar^1;
sbit dt2	= dtvar^2;
sbit dt3	= dtvar^3;

sbit DD0	  = P1 ^ 0;
sbit DD1	  = P1 ^ 1;
sbit DD2	  = P1 ^ 2;
sbit DD3	  = P1 ^ 3;

void dtmfReadData(void) using 1
{
	DD0 = 1;	
	DD1 = 1;	/*define Port 1 pins as input*/
	DD2 = 1;
	DD3 = 1;

	dtvar = 0;				
	dt0 = DD0;	/*read the port pins*/			
	dt1 = DD1; 
	dt2 = DD2;
	dt3 = DD3;

	dtmf_con_latch  = 0;	/*Clearing all the MT8870 Chip selections*/
	DTMF_CONT_LATCH = dtmf_con_latch;
}

void selectDTMF(unsigned char id) using 1
{
	switch(id)
	{
		case 0: fo_dtmf1_cs = 1;break;  // select DTMF1
		case 1: fo_dtmf2_cs = 1;break;  // select DTMF2
		case 2: fo_dtmf3_cs = 1;break;  // select DTMF3
		default: break;
	}
	DTMF_CONT_LATCH = dtmf_con_latch;
}

/*Timer 0 interrupt occurs every 15 milliseconds*/
void TimerISR(void) interrupt 1 using 1
{
	--
	--	/*Code*/
	--

	dv_state = P1;

	for(i=0;i<3;i++)
	{
		if(dv_temp[i] != (dv_state & dtmf_cp[i]) )
		{/*If there is a change in the DV pin*/
			dv_temp[i] = (dv_state & dtmf_cp[i]);
			if(dv_temp[i]==dtmf_cp[i])/*If DV pin is high*/
				latch_dtmf[i]=1;/*Set the digit dialed flag*/	  
		}
	}

	if(latch_dtmf[i]==1) 
	{	/*If A Valid Digit Dialing Is Sensed*/
		selectDTMF(i);//Select The Specified MT8870.
		dtmfReadData();//Read The Dtmf Tone Data
		digitDialed = dtvar;
	}	

	for(i=0;i<3;i++)	/*Clearing the flags*/
		latch_dtmf[i]=0;

	--
	--	/*Code*/
	--
}

 


The digit detection is working fine, but in very rare cases, double digit tone is being sensed for a single dialed digit. In some other cases, speech is being recognized as an unidentified tone.

We noticed that digit detection sensitivity is more.

Q. Is the above code a better way of sensing the change in DV pin and receiving the tone sensed by MT8870?

Datasheet : MT8870http://www.zarlink.com/zarlink/mt8870d-datasheet-oct2006.pdf

List of 3 messages in thread
TopicAuthorDate
MT8870 DTMF Code            01/01/70 00:00      
   Odd solution            01/01/70 00:00      
   I agree with Per            01/01/70 00:00      

Back to Subject List