Pages: [1]   Go Down
Author Topic: CM8870 arduino problem  (Read 607 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello ;
I dont know english well smiley sorry
I will make Cm8870 arduino project
I m make code for test .
Code:
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
« Last Edit: June 22, 2013, 02:53:01 pm by omereris » Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ?
Logged

Offline Offline
Edison Member
*
Karma: 48
Posts: 1614
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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
Logged

Where are the Nick Gammons of yesteryear?

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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 .
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will try another jack . How ı connect ?
Logged

Pages: [1]   Go Up
Jump to: