⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtmf_encode.cpp

📁 DTMF Encode to Wav file
💻 CPP
📖 第 1 页 / 共 2 页
字号:
Memory mapped I/O registers 
5632 bytes of user ROM 
224 bytes of RAM 
15-bit multi-function timer 
Power saving STOP, WAIT and Data-Retention modes 
Mask optional COP (computer operating properly) or watchdog timer 
Self check ROM 
Fully static operation with no minimum clock speed 
30 bidirectional I/O pins 
On chip oscillator for use with external crystal or ceramic resonator 2 or 4 MHz operation only while DTMF rec. is functioning 
DTMF receiver 
40 pin plastic dip or 44 pin plastic leaded chip carrier packages 
Being an avid electronics hobbyist I feel this part will see a lot of service in hobby applications. This part is, to the best of my knowledge the first general purpose microcontroller with an integrated DTMF receiver. Currently only a ROM based version is available but as sales grow a 705 or EPROM version may be manufactured. Also, this part is compatible with the 6805 development tools and software.
Arkady Horak <ark@oakhill-csic.sps.mot.com>
Motorola CSIC Microcontroller Division
Austin, TX


Teltone 
M957-0x DIP-22 or SOIC-24, 4b1s, 5 and or 12 Volt (read below) 
CAUTION: M957-02 and M957-01 differ in operating voltage!, M957-01 can operate from 5 - 12V, M957-02 operates 5V only (not suitable for 12 V apps!)
A ready to build schematic by R.G. Krijgsman based on this Teltone M957-2 chip can be found in: "Het Elektuur telefoonboek" ISBN 90-70160-94-3, (Dutch language)


Unknown 
KT3170 DIP-18, minimal ext. parts ? 
UMC, United Microelectronics Corp. 
UM9203 DIP-18 4b1s and 2of8 
UM9204 DIP-14 
UM92870A/B/C DIP-18 (three variants) 
Examples of line-interfaces and app-notes in the UMC communications ICs databook.

Mitel Corp 
MV8870 [*] 
You can get application notes (in PostScript) from the Mitel WEB server: http://www.semicon.mitel.com/prod_sum_dtmf.html or FTP site: ftp://ftp.semicon.mitel.com/pub.10may95/ic/dtmf
[*]: For those in the USA, see the addresses section for this chip.

Note:


Mitel has an Application Note - MSAN-108, titled "Applications of the MT8870 integrated DTMF receiver" in their Digital/Analog Comunications Handbook ISSUE 9. From my experience this app. note is valid for all Mitel tone recs. 
Teltone seem to carry this type-number as well. 


Toshiba 
TC35301AP DIP-28, 4b1s 
You can get Application Notes (http://rel.semi.harris.com:80/docs/datasheets/Linear_Integrated_Circuits/Section_08/index.html) on the following chips from WWW. They are in PostScript so be ready to print or download them.

Harris
http://www.semi.harris.com 
CD22202 DIP-18, 4b1s 
CD22203 DIP-18 4b1s and 2of8 
CD22204 DIP-14 or SOIC-24, 4b1s 
Legend:

3.58 = an inexpensive 3.58 MHz needed 
4b1s = 4-bit 1 strobe output (Hexoutput) 
2of8 = 2-of-8 code 

--------------------------------------------------------------------------------

6) An alternative approach: DSP 
Another way to decode/produce DTMF signals is by applying a DSP, a Digital Signal Processor. Practical examples of such an approach can be found in the TMS320 BBS, which is currently being mirrored at ftp://ftp.ti.com/mrrors/tms320bbs/. You may also wish to see the whole index ftp://ftp.ti.com/mirrors/tms320bbs/00readme
Files of interest concerning this faq are:


TEL-2-1.EXE   57K | DTMF Encoder/Decoder for C3x by DSP
TEL-2-2.EXE   53K | DTMF Detection Data Sheet by Ensigma Ltd.
DTMF10.EXE    24K | TMS320C10 based DTMF decoder
DTMF10E.EXE   19K | TMS320C10 based DTMF encoder 
DTMF_C17.EXE 126K | TMS320C17 based DTMF encoder/decoder 

Texas Instruments (http://www.ti.com) has expanded their WWW presense. They have an excellent search function that will search their whole site for any keywords. You will find it at URL: http://www.ti.com/corp/docs/search.htm.
For example, try searching for "BBS" and you will find the very useful TMS320 Hotline FAQ at http://www.ti.com/sc/docs/dsps/develop/hotfaq2.htm. If you search for "DTMF" you will find a bunch more useful things about DTMF and chips, etc. Way to go, TI!



--------------------------------------------------------------------------------

7) If you live in USA read this section ! 
(From the Editor)
If you are designing a device that will attach to the phone line and you are situates in USA, you will need to make the FCC happy. You can either do this by submitting your completed circuit to them for compliance testing (which can run a few thou$and) or you can purchase a small device that is preapproved by the FCC. It is called DAA for Data Access Arrangement. It is a small, usually potted, module that isolates (literally) your circuit from the phone line.

The FCC section you are trying to satisfy is part 68. You should visit your local library and read up on it whether your get the preapproved part or try to have the FCC [affiliated lab] do the testing .. or just plain hope you don't get caught. It's pretty dry reading but that's life.

There are several different modules on the market that fit into this category. They are:


XE0068 from:
Xecom
374 Turquoise St
Milpitas, Ca. 95035
Tel: 1-408-945-6640
Fax: 1-408-942-1346

"They carry quite a few different daa modules. Some with Touch tone encode/decoder built in which sells for about $45. And a basic daa for about $25."


Various from:
Dallas Semiconductor
ftp://ftp.dalsemi.com/pub/datasheets/
Tel: 1-214-450-0448
[They take VISA]

(From James T. Wyatt)

My favorite odd-device company, Dallas Semiconductor, has two types of hybrids One is a SIMM stick with about everything, you can even get an FCC type-accepted sticker from them for it to make your project look more engineered.

The other part is a chip-only that you have to add some external parts to. It needs a transformer and optocoupler (can get from Radio Shack), and a non- critical resistor/cap or two. You can call them up, give them your VISA number, and get the chip in the mail.

The chip is a DS1360/S and costs about $7 each. Both provide the FCC-mandated 2-second billing delay, automatic output overload limiting, *two* inputs and outputs (for monitor or DTMF inject), ring detection/anti-falsing, remote loop current detect, etc...


CH1840 ($??) and 
CH1807 ($15.95) from Cermetek
Sunnyvale, CA
Tel: 1-408-752-5000
Fax: 1-408-752-5004
"The chip plugs into phone lines, splits the signal between input and output, has pins for ringing, off-hook, etc. The chip has FCC-transferable Part 68 registration, so it's 100% legal to connect whatever you want to it. There's an international version that should work down there in Oz."

Someone was obviously not too happy using Cermetek parts. This is included here NOT because I'm biased but as a general precaution to designers. These things inherenly impose regulations. Need I say more?.. he writes:

I once worked on a telephone-interface project with the unfortunate selection of the Cermetek parts. They were originally chosen for their small size and supposed FCC ease, but it turns out that a DDA interface from discrete parts was much cheaper and much better quality.

Cermetek problems:


They have HORRIBLE noise problems. I don't know why, but they seemed to pick up every electric field in the machine and amplify it to obnoxious levels. Probably something to do with their "solid-state" transformer. 
The "Pre-FCC-approved" parts have to include a "squelch" circuit to comply with FCC maximum level limitations. The FCC specifies the maximum as some number of dB over a one second period. Well, the squelch circuit does not take time into account, so it clips any loud transient sound. This frequently clips normal-level voice signals, and causes a real problem when speaking loudly. 
The "pre-FCC-approved" part is also pretty big, about 1"x2", if I remember. With modern parts, a good circuit can fit in the same space. 
The FCC approval was just as hard with the part as without. We had to include MOVs and other stuff between the Cermetek and the phone line, and still go through all the testing required of a discrete circuit. 
Since they're epoxy-potted modules, they can't be fixed, and we had a serious problem with broken parts. Almost one in three was unusable. 
The sidetone level (audio loopback) was much to high. It was OK once the speaker on the Cermetek end became used to it, but it bothered new users and would probably make data transmission difficult. 

So, if you have the time and the need, invest the effort to build a decent interface from parts. If you just need one for hobbyist needs, the Cermetek might work, but I got better performance from a phone interface ripped from a 1200 baud modem.
There are just my experiences, and they were with early-rev parts, so they may have improved. Still, it would have saved us several months of engineering time if we had avoided Cermetek from the start.

(This from Steve in Vigra - you know who you are :-)


Kit from:
CircuitWerkes
6212 SW 8th Place
Gainesville, FL 32606
Tel: 1-904-331-5999
Fax: 1-904-331-6999

(FYI, this information posted by Dan Hoehnen and dated Sep 11, 1994)

They sell a partial or full kit or an assembled unit for MPC-2. It provides an FCC approved interface (if you buy the pre-assembled unit) that gives you acces to audio in/out, ring detect and off-hook detect connections.

Circuit board only is $9.00, Complete MPC-2 kit is $19.95, MPC-2 that is assembled and FCC approved is $29.95

The above mentioned company also sells an upgrade board that basically conditions the outputs a little better for pc interfacing.

The upgrade can be bought for $69.95 kit, inlcludes an assembled MPC-2. Or assembled for $99.95.



--------------------------------------------------------------------------------

7.1) Can I build my own DAA? 
(From Dieter Christensen)
Telephone hybrids are a real pain in the butt to design. Don't waste your time. Buy one. They're not expensive.

Ok, ok. If you're curious, the reason they're so difficult is that they have to be optimally balanced in such a way that they will work on almost any phone line they are hooked up to. A hybrid's function is to transmit a signal over the phone line at the same time that it is receiving the signal from the other end. Ideally, the received signal will have none of the transmitted signal on it (because otherwise you would hear yourself EXTREMELY loudly whenever you talk into a telephone handset, for instance). The degree to which a hybrid's receiver can cancel out the transmitted signal is called 'rejection' and is usually expressed in db. It depends strongly on the complex impedance of the phone line, and unfortunately each phone line has a different impedance. To design a hybrid with good rejection you gotta twiddle a lot with different caps and resistors and all that, and it can be hairy if you want a design that will work with more than one phone line without having to be adjusted. Ma Bell publishes specs on what the distribution of phone-line impedances is and all that, and you'd try to make your circuit nail the median impedance. Of course, in your application it seems like you're only dealing with one phone line, which makes things a little, but not much, easier.

In addition, your DAA has to be able to deal with all the nasty spikes and so on that come down the line, and that isn't much fun to design, either. And the output levels have to be within Ma Bell's specs, and so on.

But, Anyway, the good news is that the ideal solution is quite simple.

You can purchase a complete DAA and hybrid, which comes on a little thick-film module all pre-engineered and calibrated and adjusted, for less than $20. You just hook up the phone line to two of the pins (you DO need a switch to take it on and off hook) and connect your headphone amplifier and microphone amplifier and dialer (or whatever you are using for your studio) to two other pins. Simple.

You get at least 6db rejection, and typically 12 to 16 db. And you don't have to worry.



--------------------------------------------------------------------------------

8) Addresses 
B.G. Micro, Inc.
P.O. Box 280298
Dallas, TX 75228
Tel: 1-800-276-2206

SSI-202        $2.25
8870           $2.25


Cermetek
Sunnyvale, CA
Tel: 1-408-752-5000
Fax: 1-408-752-5004

73M9001/SSI202/75T202-IP from:
TDK/Silicon Systems (SSi)
Tel: (714) 573 6000 (for closest distributor)
Fax: (714) 573 6914
E-Mail for Info: info@ssi1.com
WWW: http://www.ssi1.com

The SSI202 is manufactured by Silicon Systems Inc (SSI) and the full part number is 75T202-IP.

"It is a 30 pin socketed dual sided surface mount PCB. All protection is on the module and includes a speaker driver and additional relay drivers. Can be used up to 14.4KBPS V32.bis speeds."


Dallas Semiconductor
ftp://ftp.dalsemi.com/pub/datasheets/
Tel: 1-214-450-0448

MITEL Semiconductor
http://www.semicon.mitel.com and
ftp://ftp.semicon.mitel.com
Head office in Canada:

MITEL Semiconductor
360 Legget Dr.
P.O. Box 13320
Kanata, Ontario, Canada K2K 1X3
Tel: 1-800-267-6244
Tel: 1-800-561-0860 (maybe)
Tel: 1-613-592-2122 (ask for Semiconductor Applications)
Fax: 1-613-592-6909

UK Tel: 044 291430000
Fax: 044 291436389

Germay Tel: 49 7117701522
Fax: 49 7117701524 


--------------------------------------------------------------------------------

9) Conclusion/About the Author 
Well, that's the latest I've found on DTMF receivers. There are no doubt other companies producing these kind of chips, so please let me know and I'll improve this list (when I've got the time)
Unfortunately, I'm not that experienced yet to answer any difficult technical questions about this subject.

For suggestions, improvements, info, flames, waterbuckets (?) please e-mail me at: tsjoit@solist.htsa.hva.nl.

I graduated July 1st 1994, so I won't continue writing updates for this faq (no time, no space, no money :)

I like to thank all of you who think this faq was usefull, especially the ones who wrote me e-mail . I was very suprised to see this faq appear in the most strange places on the Net :)

Anyway...have fun with those di-du-dit-di-duh tones :)



--------------------------------------------------------------------------------

10) DTMF in C (on a PC) by Kirk Hobart 
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <conio.h>
 
#define BITS 0xFF00
#define NOISE 0         /* enable noise shaper */
#define TON  0.100      /* tone duration */
#define TOFF 0.100      /* silence duration */
#define RAMP 0.002      /* tone rise and fall time */
#define RATE 11025.0    /* sample rate */
#define numberof(n) (sizeof(n)/sizeof(*n))
 
struct
{
  char letter;
  double f1, f2;
} button[] =
{
  {'1', 697, 1209},
  {'2', 697, 1336},
  {'3', 697, 1477},
  {'A', 697, 1633},
  {'4', 770, 1209},
  {'5', 770, 1336},
  {'6', 770, 1477},
  {'B', 770, 1633},
  {'7', 852, 1209},
  {'8', 852, 1336},
  {'9', 852, 1477},
  {'C', 852, 1633},
  {'*', 941, 1209},
  {'0', 941, 1336},
  {'#', 941, 1477},
  {'D', 941, 1633},
  {'X',  20,   20},
  {'Y', 100,  100},
  {'Z', 500,  500},
};
 
int main(void)
{
  double t, v=0;
  char c;
  int value=0, n;
  FILE *fout;
 
  puts("Press 123A456B789C*0#D to digitize DTMF-tones to file. Fs=11025. ESC quits.");
  fout = fopen("x", "wb");
  while (1)
  {
    c = toupper(getch());
    if (c == 0x1B)
      break;
    for (n=0; n<numberof(button); n++)
    {
      if (c==button[n].letter)
      {
        putchar(c);
        for (t=0.0; t<TON; t+=1/RATE)
        {
          v = sin(2*M_PI*button[n].f1*t) + sin(2*M_PI*button[n].f2*t);
          if (t<RAMP)          /* See Note Below */
            v *= t/RAMP;       /* See Note Below */
          if (t>TON-RAMP)      /* See Note Below */
            v *= (TON-t)/RAMP; /* See Note Below */
          #if NOISE
            value = floor(v*(BITS/4)+BITS/2) + (value&~BITS);
          #else
            value = floor(v*16383+32768.5);
          #endif
          fputc((value&BITS)>>8, fout);
        }
        for (t=0.0; t<TOFF; t+=1/RATE)
          fputc(0x80, fout);
      }
    }
  }
  putchar('\n');
  fclose(fout);
  return 0;
}
            v *= (TON-t)/RAMP;
          #if NOISE
            value = floor(v*(BITS/4)+BITS/2) + (value&~BITS);
          #else
            value = floor(v*16383+32768.5);
          #endif
          fputc((value&BITS)>>8, fout);
        }
        for (t=0.0; t<TOFF; t+=1/RATE)
          fputc(0x80, fout);
      }
    }
  }
  putchar('\n');
  fclose(fout);
  return 0;
}


Note: This provides simple envelope modulation. It ramps the amplitude up and down linearly to avoid the little pops you would otherwise hear when the sound starts and stops. DTMF encoder chips usually don't bother doing this.
Do you understand the noise shaper? It's a more advanced concept. The effect is subtle, and it's not required for DTMF use. It was just a fun experiment :-)



--------------------------------------------------------------------------------

Please check attribution for Author. Processed by filipg@paranoia.com [Feedback Form] [mailto]. The most recent version is available on the WWW server http://www.paranoia.com/~filipg [Copyright] [Disclaimer]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -