Go Down

Topic: CM8870 arduino problem (Read 770 times) previous topic - next topic

omereris

Jun 22, 2013, 09:51 pm Last Edit: Jun 22, 2013, 09:53 pm by omereris Reason: 1
Hello ;
I dont know english well :) sorry
I will make Cm8870 arduino project
I m make code for test .
Code: [Select]

const int Q[4]={
  6,5,4,3};           


void setup()
{
  Serial.begin(9600);
 
  for(int i=0;i<4;i++)
    pinMode(Q[i],INPUT);             
}

void loop()
{
  dtmf();
}

void dtmf()
{
 
 
  int a=digitalRead(6);
  int b=digitalRead(5);
  int c=digitalRead(4);
  int d=digitalRead(3);
  Serial.println(a);
  delay(1000);
  Serial.println(b);
  delay(100);
  Serial.println(c);
  delay(100);
  Serial.println(d);

}

I connect arduino - cm8870 with diagram
I connect pc and Telephone audio jack.I press 1 or 9 from telephone .   But serial monitor write =
0
0
0
0
What s the problem

g_u_e_s_t

the code looks ok, as far as i can tell.  do you have a multimeter?  if so, check the outputs of the cm8870 as you hold down telephone numbers, and see if the cm8870 is working like you expect.

omereris

OK I will try multimeter
How to connect audio jack to cm8870 from telephone (galaxy s2 )
My audio jack out is 2 cable . Which cable gnd ?

el_supremo

You aren't checking whether the chip has detected a valid tone. Pin 15 will go high when a valid tone has been detected and the BCD output is valid.
You need to wire pin 15 to a digital input. Then the code can just loop waiting for that pin to go high. When it does, read all four data pins, and then wait for pin 15 to go low.

Code: [Select]

// The digital pin where the chips pin15 is connected
#define Pin15 7

// In setup Pin15 must be declared an input with pullup
// pinMode(Pin15,INPUT_PULLUP);

void loop(void)
{
  // wait for pin 15 to go high
  while(!digitalRead(Pin15));
  int a=digitalRead(6);
  int b=digitalRead(5);
  int c=digitalRead(4);
  int d=digitalRead(3);

  Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  // Wait for pin 15 to go low again.
  while(digitalRead(Pin15));
}


Pete

omereris


You aren't checking whether the chip has detected a valid tone. Pin 15 will go high when a valid tone has been detected and the BCD output is valid.
You need to wire pin 15 to a digital input. Then the code can just loop waiting for that pin to go high. When it does, read all four data pins, and then wait for pin 15 to go low.

Code: [Select]

// The digital pin where the chips pin15 is connected
#define Pin15 7

// In setup Pin15 must be declared an input with pullup
// pinMode(Pin15,INPUT_PULLUP);

void loop(void)
{
  // wait for pin 15 to go high
  while(!digitalRead(Pin15));
  int a=digitalRead(6);
  int b=digitalRead(5);
  int c=digitalRead(4);
  int d=digitalRead(3);

  Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  // Wait for pin 15 to go low again.
  while(digitalRead(Pin15));
}


Pete


Thanks for help.I write same code and connect pin 15 . I open phone conncet jack . I press number but serial monitor does not print .

omereris

I will try another jack . How ? connect ?

Go Up