CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MT8888 CODE HELP

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
koll_kkc
Guest







MT8888 CODE HELP
PostPosted: Wed Sep 13, 2006 6:59 am     Reply with quote

I need a sample cod for use with MT8888.

Somebody can help me?

Thanks
John Morley



Joined: 09 Aug 2004
Posts: 97

View user's profile Send private message

PostPosted: Wed Sep 13, 2006 3:22 pm     Reply with quote

Hi,

I've only worked with the MT8870 DTMF receiver, but this should give you a start.

Here are the codes that the DTMF receiver will generate:

Code:

//    MT8870 DTMF Decoder Output
//
//    Digit       Code
//      1          1
//      2          2
//      3          3
//      4          4
//      5          5
//      6          6
//      7          7
//      8          8
//      9          9
//      0          10
//      *          11
//      #          12
//      A          13   
//      B          14
//      C          15
//      D          0



Here are some sample pin assignments for the DTMF data lines and DTMF strobe (valid) line:

Code:

#define DTMF_Data1 PIN_A0
#define DTMF_Data2 PIN_A1
#define DTMF_Data3 PIN_A2
#define DTMF_Data4 PIN_A3
#define DTMF_STB PIN_B0




Here is some code to actually grab the DTMF tone:

Code:

int DTMF_CMD;

if (input(DTMF_STB))   // wait for DTMF_STB to go hi...
{

DTMF_CMD= input(DTMF_Data1) + ( 2 * input(DTMF_Data2)) + (4 * input(DTMF_Data3)) + (8 * input(DTMF_Data4));

}



Writing a robust algorithm to receive strings of DTMF tones and validate them is not completely trivial because you have to allow for a user that holds a key for a long time, or waits too long between key presses, etc. This code will help to get you started actually receiving data. If you need help beyond this, let me know.
_________________
John Morley
Mark Weir



Joined: 11 Sep 2003
Posts: 51
Location: New Zealand

View user's profile Send private message

CM8870
PostPosted: Thu Sep 14, 2006 5:00 pm     Reply with quote

Hi John,

Could you please explain your code segement a little more fully. I have been using this device also and I grab the code like this

[#int_EXT
EXT_isr()

{ if (input(tone_pres))// Tone pres looks at pin15 cm8870

{

load_tone = input_d() & 0x0f ; // Read incoming tone
tone_flag = 1; }
}]

The four outputs are connected to portd, I just and out the unwanted bits, so I end up with a 4 bit word called load_tone that I can use in a switch.

I too am interested in the cm8889 transceiver but like our orinal poster am a bit unsure of where to start to build the driver. I managed to get thr receiver only working quite well.

Cheers

Mark

[/code]
John Morley



Joined: 09 Aug 2004
Posts: 97

View user's profile Send private message

PostPosted: Mon Sep 18, 2006 7:37 pm     Reply with quote

Mark,

I "poll" the data valid line from the MT8870 because I don't have any other processes going on. Your technique of using the external interrupt looks OK too. Your method of grabbing the digits also looks fine to me. Does it work as you expect? The possible values for the received tones are shown in the table in my original post.

Sorry, I don't have any transmit code, but it would be easy to put the desired output tone code on some output pins and strobe the "send" line - very nearly the reverse of receiving DTMF data!

Have you got the receive code to store the incoming tones and to put them into an array for validation and processing?

John
_________________
John Morley
Mark Weir



Joined: 11 Sep 2003
Posts: 51
Location: New Zealand

View user's profile Send private message

MT8870
PostPosted: Mon Sep 18, 2006 8:06 pm     Reply with quote

Hi John,
Have you got the receive code to store the incoming tones and to put them into an array for validation and processing?

At the moment I am storing each digit into a separate int, I capture 4 digits for the application. I have been getting away with this so far but I can't honsestly say it's bulletproof. I am interested in knowing how you would use an array as I have not had any experience using them so far and think this would be a better way to validate what was sent.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group